Files
MuditaOS/module-audio/Audio/AudioDeviceFactory.cpp
Marcin Smoczyński bda18b5b54 [EGD-5706] Refactor creating audio device
Audio devices are created in the audio subsystem and it is not possible
to send a device to bt service upon creation.

Introduce hookable audio device factory to allow sharing bluetooth
audio device. Move audio devices from bsp to audio allowing removal of
unwanted bsp -> audio dependency.

Remove Bluetooth proxy device which turned out to be a dead end.

Signed-off-by: Marcin Smoczyński <smoczynski.marcin@gmail.com>
2021-02-17 16:20:59 +01:00

26 lines
654 B
C++

// Copyright (c) 2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "AudioDeviceFactory.hpp"
using namespace audio;
AudioDeviceFactory::AudioDeviceFactory(Observer *observer) : _observer(observer)
{}
std::shared_ptr<AudioDevice> AudioDeviceFactory::CreateDevice(AudioDevice::Type deviceType)
{
std::shared_ptr<AudioDevice> device = getDeviceFromType(deviceType);
if (_observer != nullptr && device) {
_observer->onDeviceCreated(device);
}
return device;
}
void AudioDeviceFactory::setObserver(Observer *observer) noexcept
{
_observer = observer;
}