~aleteoryx/muditaos

muditaos/module-audio/Audio/test/DummyAudioDevice.cpp -rw-r--r-- 1.8 KiB
a405cad6Aleteoryx trim readme 8 days 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/blob/master/LICENSE.md

#include "DummyAudioDevice.hpp"

using namespace audio;

class DummyAudioFactory : public AudioDeviceFactory
{
  public:
    std::shared_ptr<AudioDevice> createCellularAudioDevice() override
    {
        return nullptr;
    }

  protected:
    std::shared_ptr<AudioDevice> getDevice([[maybe_unused]] const audio::Profile &profile) override
    {
        if (profile.GetAudioDeviceType() == AudioDevice::Type::Audiocodec) {
            return std::make_shared<DummyAudioDevice>();
        }
        return nullptr;
    }
};

std::unique_ptr<AudioDeviceFactory> AudioPlatform::GetDeviceFactory()
{
    return std::make_unique<DummyAudioFactory>();
}

auto DummyAudioDevice::Start() -> AudioDevice::RetCode
{
    return AudioDevice::RetCode::Success;
}
auto DummyAudioDevice::Stop() -> AudioDevice::RetCode
{
    return AudioDevice::RetCode::Success;
}
auto DummyAudioDevice::setOutputVolume(float vol) -> AudioDevice::RetCode
{
    return AudioDevice::RetCode::Success;
}
auto DummyAudioDevice::setInputGain(float gain) -> AudioDevice::RetCode
{
    return AudioDevice::RetCode::Success;
}
auto DummyAudioDevice::getTraits() const -> Endpoint::Traits
{
    return Endpoint::Traits();
}
auto DummyAudioDevice::getSupportedFormats() -> std::vector<audio::AudioFormat>
{
    return std::vector<audio::AudioFormat>();
}
auto DummyAudioDevice::getSourceFormat() -> audio::AudioFormat
{
    return audio::AudioFormat();
}

void DummyAudioDevice::onDataSend()
{}
void DummyAudioDevice::onDataReceive()
{}
void DummyAudioDevice::enableInput()
{}
void DummyAudioDevice::enableOutput()
{}
void DummyAudioDevice::disableInput()
{}
void DummyAudioDevice::disableOutput()
{}