~aleteoryx/muditaos

ref: 3d13f10839e218b65dc247f03a15fb5dfa87bc8b muditaos/module-audio/board/rt1051/puretx/PureTxAudioDeviceFactory.cpp -rw-r--r-- 1.5 KiB
3d13f108 — Bartosz [MOS-668] Modify USB notifications logging 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "PureTxAudioDeviceFactory.hpp"
#include "PureTxAudioCodec.hpp"
#include "RT1051CellularAudio.hpp"
#include "audio/BluetoothAudioDevice.hpp"

#include <Audio/Profiles/Profile.hpp>

using audio::AudioDevice;
using audio::PureTxAudioCodec;
using audio::PureTxAudioDeviceFactory;
using audio::RT1051CellularAudio;

std::shared_ptr<AudioDevice> PureTxAudioDeviceFactory::getDevice(const audio::Profile &profile)
{
    std::shared_ptr<AudioDevice> device;
    switch (profile.GetAudioDeviceType()) {
    case AudioDevice::Type::Audiocodec: {
        device = std::make_shared<PureTxAudioCodec>(profile.GetAudioConfiguration());
    } break;

    case AudioDevice::Type::BluetoothA2DP: {
        device = std::make_shared<bluetooth::A2DPAudioDevice>();
    } break;

    case AudioDevice::Type::BluetoothHSP: {
        device = std::make_shared<bluetooth::CVSDAudioDevice>(bluetooth::AudioProfile::HSP);
    } break;

    case AudioDevice::Type::BluetoothHFP: {
        device = std::make_shared<bluetooth::CVSDAudioDevice>(bluetooth::AudioProfile::HFP);
    } break;

    case AudioDevice::Type::Cellular: {
        device = std::make_shared<RT1051CellularAudio>();
    } break;

    default:
        break;
    };

    return device;
}

std::shared_ptr<AudioDevice> PureTxAudioDeviceFactory::createCellularAudioDevice()
{
    return std::make_shared<RT1051CellularAudio>();
}