// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "CallAudio.hpp" #include "Service/Message.hpp" #include "log/log.hpp" #include #include #include "service-audio/AudioServiceName.hpp" #include #include struct CallRingAudio::CallMeta { sys::Async async; }; CallRingAudio::CallRingAudio(sys::Service &s) : owner(s), meta(new CallRingAudio::CallMeta) {} CallRingAudio::~CallRingAudio() { delete meta; } void CallRingAudio::play() { started = true; const auto file = AudioServiceAPI::GetSound(&owner, audio::PlaybackType::CallRingtone); meta->async = owner.async_call( service::name::audio, file, audio::PlaybackType::CallRingtone); } void CallRingAudio::stop() { if (not started) { return; } owner.sync(meta->async); AudioServiceAPI::StopAll(&owner); }