mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-07-30 09:48:46 -04:00
* [EGD-558][fix] change error to info * [EGD-558] added volume control of currently active audio operation * [EGD-558] added ringing on incoming call * [EGD-558] mini clean up in callwindow * [EGD-558] removed reinterpret_casts and added some logging * [EGD-558] rewritten methods to increment/decrement volume * [EGD-558] clean up * [EGD-558] moved volume control to application class added nullptr checks * [EGD-558] fixed types * [EGD-558] added some audio debug logs * [EGD-558] left a comment why ringing sound is currently disabled * [EGD-558] PR fixes * [EGD-558] PR fix * [EGD-558] added propper error codes on pointer checking in Audio.cpp
55 lines
1.4 KiB
C++
55 lines
1.4 KiB
C++
#include "Operation.hpp"
|
|
|
|
#include <algorithm>
|
|
|
|
#include "IdleOperation.hpp"
|
|
#include "PlaybackOperation.hpp"
|
|
#include "RecorderOperation.hpp"
|
|
#include "RouterOperation.hpp"
|
|
|
|
#include "bsp/audio/bsp_audio.hpp"
|
|
#include "Audio/decoder/decoder.hpp"
|
|
|
|
namespace audio
|
|
{
|
|
|
|
std::optional<std::unique_ptr<Operation>> Operation::Create(Operation::Type t, const char *fileName)
|
|
{
|
|
std::unique_ptr<Operation> inst;
|
|
|
|
switch (t) {
|
|
case Type::Idle:
|
|
inst = std::make_unique<IdleOperation>(fileName);
|
|
break;
|
|
case Type::Playback:
|
|
inst = std::make_unique<PlaybackOperation>(fileName);
|
|
break;
|
|
case Type::Router:
|
|
inst = std::make_unique<RouterOperation>(fileName);
|
|
break;
|
|
case Type::Recorder:
|
|
inst = std::make_unique<RecorderOperation>(fileName);
|
|
break;
|
|
}
|
|
|
|
if (inst->isInitialized) {
|
|
return inst;
|
|
}
|
|
else {
|
|
return {};
|
|
}
|
|
}
|
|
|
|
std::optional<Profile *> Operation::GetProfile(const Profile::Type type)
|
|
{
|
|
auto ret = std::find_if(
|
|
availableProfiles.begin(), availableProfiles.end(), [type](const auto &w) { return w->GetType() == type; });
|
|
if (ret == availableProfiles.end()) {
|
|
return {};
|
|
}
|
|
else {
|
|
return (*ret).get();
|
|
}
|
|
}
|
|
|
|
} // namespace audio
|