Files
MuditaOS/module-audio/Audio/test/TestEndpoint.cpp
Marcin Smoczyński 8b21df135c [EGD-5742] Add audio format checking
Check if decoder's file format is supported by the sink audio device
before playing the sound. Add list of supported formats to each of audio
devices.

Signed-off-by: Marcin Smoczyński <smoczynski.marcin@gmail.com>
2021-04-12 10:00:00 +02:00

55 lines
1.2 KiB
C++

// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "TestEndpoint.hpp"
#include <Audio/AudioFormat.hpp>
using audio::AudioFormat;
using audio::test::TestSink;
using audio::test::TestSource;
TestSink::TestSink(std::vector<AudioFormat> supportedFormats) : formats(std::move(supportedFormats))
{}
auto TestSink::getSupportedFormats() -> const std::vector<AudioFormat> &
{
return formats;
}
void TestSink::onDataSend()
{}
void TestSink::enableOutput()
{}
void TestSink::disableOutput()
{}
TestSource::TestSource(std::vector<AudioFormat> supportedFormats, AudioFormat sourceFormat)
: formats(std::move(supportedFormats)), sourceFormat(std::move(sourceFormat))
{}
TestSource::TestSource(AudioFormat audioFormat)
: formats(std::vector<AudioFormat>{audioFormat}), sourceFormat(std::move(audioFormat))
{}
auto TestSource::getSourceFormat() -> AudioFormat
{
return sourceFormat;
}
void TestSource::onDataReceive()
{}
void TestSource::enableInput()
{}
void TestSource::disableInput()
{}
auto TestSource::getSupportedFormats() -> const std::vector<AudioFormat> &
{
return formats;
}