From f7a6b7200659cec945ed8cb144c38d155b273688 Mon Sep 17 00:00:00 2001 From: Hubert Chrzaniuk Date: Mon, 15 Feb 2021 08:51:32 +0100 Subject: [PATCH] [EGD-4342] Remove audio profile db callback This callback is not needed. --- .../Audio/Operation/IdleOperation.cpp | 2 +- module-audio/Audio/Operation/Operation.cpp | 2 +- module-audio/Audio/Profiles/Profile.cpp | 38 ++++++------------- module-audio/Audio/Profiles/Profile.hpp | 6 +-- module-audio/Audio/Profiles/ProfileIdle.hpp | 2 +- .../Profiles/ProfilePlaybackBluetoothA2DP.hpp | 5 +-- .../Profiles/ProfilePlaybackHeadphones.hpp | 5 +-- .../Profiles/ProfilePlaybackLoudspeaker.hpp | 5 +-- .../Profiles/ProfileRecordingBluetoothHSP.hpp | 5 +-- .../Profiles/ProfileRecordingHeadphones.hpp | 5 +-- .../Profiles/ProfileRecordingOnBoardMic.hpp | 5 +-- .../Profiles/ProfileRoutingBluetoothHSP.hpp | 5 +-- .../Profiles/ProfileRoutingEarspeaker.hpp | 5 +-- .../Profiles/ProfileRoutingHeadphones.hpp | 5 +-- .../Profiles/ProfileRoutingLoudspeaker.hpp | 5 +-- 15 files changed, 36 insertions(+), 64 deletions(-) diff --git a/module-audio/Audio/Operation/IdleOperation.cpp b/module-audio/Audio/Operation/IdleOperation.cpp index 8751d88e7db453da47de8e6cc19c1ad020b300aa..099f9ddc5873388cc0edbdf34fc452ba861674d6 100644 --- a/module-audio/Audio/Operation/IdleOperation.cpp +++ b/module-audio/Audio/Operation/IdleOperation.cpp @@ -10,7 +10,7 @@ namespace audio IdleOperation::IdleOperation([[maybe_unused]] const char *file) : Operation(nullptr) { - supportedProfiles.emplace_back(Profile::Create(Profile::Type::Idle, nullptr), true); + supportedProfiles.emplace_back(Profile::Create(Profile::Type::Idle), true); currentProfile = supportedProfiles[0].profile; } diff --git a/module-audio/Audio/Operation/Operation.cpp b/module-audio/Audio/Operation/Operation.cpp index bae1785cb64afb7401df36018913d5566dfa05c7..7409bf3ebe7925c548ffe7342353173ac50b4836 100644 --- a/module-audio/Audio/Operation/Operation.cpp +++ b/module-audio/Audio/Operation/Operation.cpp @@ -91,7 +91,7 @@ namespace audio gain = utils::getNumericValue(val.value()); } - supportedProfiles.emplace_back(Profile::Create(profile, nullptr, volume, gain), isAvailable); + supportedProfiles.emplace_back(Profile::Create(profile, volume, gain), isAvailable); } std::optional> Operation::CreateDevice(bsp::AudioDevice::Type type) diff --git a/module-audio/Audio/Profiles/Profile.cpp b/module-audio/Audio/Profiles/Profile.cpp index 1f0d566f234f6362d75b8d251386ed9d330e1b45..8300ddc376254bdd172cf825d8d713ea1f544c7b 100644 --- a/module-audio/Audio/Profiles/Profile.cpp +++ b/module-audio/Audio/Profiles/Profile.cpp @@ -25,7 +25,6 @@ namespace audio { std::unique_ptr Profile::Create(const Type t, - std::function callback, std::optional vol, std::optional gain) { @@ -34,43 +33,43 @@ namespace audio switch (t) { case Type::PlaybackHeadphones: assert(vol); - inst = std::make_unique(callback, vol.value()); + inst = std::make_unique(vol.value()); break; case Type::PlaybackLoudspeaker: assert(vol); - inst = std::make_unique(callback, vol.value()); + inst = std::make_unique(vol.value()); break; case Type::PlaybackBluetoothA2DP: assert(vol); - inst = std::make_unique(callback, vol.value()); + inst = std::make_unique(vol.value()); break; case Type::RecordingBuiltInMic: assert(gain); - inst = std::make_unique(callback, gain.value()); + inst = std::make_unique(gain.value()); break; case Type::RecordingHeadphones: assert(gain); - inst = std::make_unique(callback, gain.value()); + inst = std::make_unique(gain.value()); break; case Type::RecordingBluetoothHSP: assert(gain); - inst = std::make_unique(callback, gain.value()); + inst = std::make_unique(gain.value()); break; case Type::RoutingHeadphones: assert(gain && vol); - inst = std::make_unique(callback, vol.value(), gain.value()); + inst = std::make_unique(vol.value(), gain.value()); break; case Type::RoutingLoudspeaker: assert(gain && vol); - inst = std::make_unique(callback, vol.value(), gain.value()); + inst = std::make_unique(vol.value(), gain.value()); break; case Type::RoutingEarspeaker: assert(gain && vol); - inst = std::make_unique(callback, vol.value(), gain.value()); + inst = std::make_unique(vol.value(), gain.value()); break; case Type::RoutingBluetoothHSP: assert(gain && vol); - inst = std::make_unique(callback, vol.value(), gain.value()); + inst = std::make_unique(vol.value(), gain.value()); break; case Type::Idle: inst = std::make_unique(); @@ -83,41 +82,28 @@ namespace audio Profile::Profile(const std::string &name, const Type type, const bsp::AudioDevice::Format &fmt, - bsp::AudioDevice::Type devType, - std::function callback) - : audioFormat(fmt), audioDeviceType(devType), name(name), type(type), dbAccessCallback(callback) + bsp::AudioDevice::Type devType) + : audioFormat(fmt), audioDeviceType(devType), name(name), type(type) {} void Profile::SetInputGain(Gain gain) { audioFormat.inputGain = gain; - if (dbAccessCallback) { - dbAccessCallback(); - } } void Profile::SetOutputVolume(Volume vol) { audioFormat.outputVolume = vol; - if (dbAccessCallback) { - dbAccessCallback(); - } } void Profile::SetInputPath(bsp::AudioDevice::InputPath path) { audioFormat.inputPath = path; - if (dbAccessCallback) { - dbAccessCallback(); - } } void Profile::SetOutputPath(bsp::AudioDevice::OutputPath path) { audioFormat.outputPath = path; - if (dbAccessCallback) { - dbAccessCallback(); - } } void Profile::SetInOutFlags(uint32_t flags) diff --git a/module-audio/Audio/Profiles/Profile.hpp b/module-audio/Audio/Profiles/Profile.hpp index f23415b82ad06a8607df3b01e1508253658f87df..f6af63f3497ca217b82ba5b2da0131ffe8522102 100644 --- a/module-audio/Audio/Profiles/Profile.hpp +++ b/module-audio/Audio/Profiles/Profile.hpp @@ -43,7 +43,6 @@ namespace audio }; static std::unique_ptr Create(const Type t, - std::function callback = nullptr, std::optional vol = 0, std::optional gain = 0); @@ -113,16 +112,13 @@ namespace audio Profile(const std::string &name, const Type type, const bsp::AudioDevice::Format &fmt, - bsp::AudioDevice::Type devType, - std::function callback); + bsp::AudioDevice::Type devType); bsp::AudioDevice::Format audioFormat{}; bsp::AudioDevice::Type audioDeviceType = bsp::AudioDevice::Type::Audiocodec; std::string name; Type type = Type::Idle; - - std::function dbAccessCallback = nullptr; }; [[nodiscard]] const std::string str(const Profile::Type &profileType); diff --git a/module-audio/Audio/Profiles/ProfileIdle.hpp b/module-audio/Audio/Profiles/ProfileIdle.hpp index 65a6b7fb83836f17fff308a33e62dd0f0b331805..5fb7e27b663c7cea02296bf6dda1e181312b0077 100644 --- a/module-audio/Audio/Profiles/ProfileIdle.hpp +++ b/module-audio/Audio/Profiles/ProfileIdle.hpp @@ -11,7 +11,7 @@ namespace audio class ProfileIdle : public Profile { public: - ProfileIdle() : Profile("Idle", Type::Idle, bsp::AudioDevice::Format{}, bsp::AudioDevice::Type::None, nullptr) + ProfileIdle() : Profile("Idle", Type::Idle, bsp::AudioDevice::Format{}, bsp::AudioDevice::Type::None) {} }; diff --git a/module-audio/Audio/Profiles/ProfilePlaybackBluetoothA2DP.hpp b/module-audio/Audio/Profiles/ProfilePlaybackBluetoothA2DP.hpp index b0b72cb16103e59b5193006e81e4518fa1834906..3e08dea29bd9928c3beb32f304e9c6438e769502 100644 --- a/module-audio/Audio/Profiles/ProfilePlaybackBluetoothA2DP.hpp +++ b/module-audio/Audio/Profiles/ProfilePlaybackBluetoothA2DP.hpp @@ -11,7 +11,7 @@ namespace audio class ProfilePlaybackBluetoothA2DP : public Profile { public: - ProfilePlaybackBluetoothA2DP(std::function callback, Volume volume) + ProfilePlaybackBluetoothA2DP(Volume volume) : Profile("Playback Bluetooth A2DP", Type::PlaybackBluetoothA2DP, bsp::AudioDevice::Format{.sampleRate_Hz = 44100, @@ -21,8 +21,7 @@ namespace audio .inputGain = 0, .inputPath = bsp::AudioDevice::InputPath::None, .outputPath = bsp::AudioDevice::OutputPath::BluetoothA2DP}, - bsp::AudioDevice::Type::Bluetooth, - callback) + bsp::AudioDevice::Type::Bluetooth) {} }; diff --git a/module-audio/Audio/Profiles/ProfilePlaybackHeadphones.hpp b/module-audio/Audio/Profiles/ProfilePlaybackHeadphones.hpp index 24ba600ca8c08034b03a2256971f94bd486f7e07..c9271f79dba1209ee316c95390ff51386fecfce1 100644 --- a/module-audio/Audio/Profiles/ProfilePlaybackHeadphones.hpp +++ b/module-audio/Audio/Profiles/ProfilePlaybackHeadphones.hpp @@ -10,7 +10,7 @@ namespace audio class ProfilePlaybackHeadphones : public Profile { public: - ProfilePlaybackHeadphones(std::function callback, Volume volume) + ProfilePlaybackHeadphones(Volume volume) : Profile("Playback Headphones", Type::PlaybackHeadphones, bsp::AudioDevice::Format{.sampleRate_Hz = 0, @@ -20,8 +20,7 @@ namespace audio .inputGain = 0, .inputPath = bsp::AudioDevice::InputPath::None, .outputPath = bsp::AudioDevice::OutputPath::Headphones}, - bsp::AudioDevice::Type::Audiocodec, - callback) + bsp::AudioDevice::Type::Audiocodec) {} }; diff --git a/module-audio/Audio/Profiles/ProfilePlaybackLoudspeaker.hpp b/module-audio/Audio/Profiles/ProfilePlaybackLoudspeaker.hpp index ca4b2a6777d99a41eae55e1d5647b7b3a8e5033d..51a2d97a0d6b863fe8d0130e64056884028ff5ef 100644 --- a/module-audio/Audio/Profiles/ProfilePlaybackLoudspeaker.hpp +++ b/module-audio/Audio/Profiles/ProfilePlaybackLoudspeaker.hpp @@ -11,7 +11,7 @@ namespace audio class ProfilePlaybackLoudspeaker : public Profile { public: - ProfilePlaybackLoudspeaker(std::function callback, Volume volume) + ProfilePlaybackLoudspeaker(Volume volume) : Profile("Playback Loudspeaker", Type::PlaybackLoudspeaker, bsp::AudioDevice::Format{.sampleRate_Hz = 0, @@ -21,8 +21,7 @@ namespace audio .inputGain = 0, .inputPath = bsp::AudioDevice::InputPath::None, .outputPath = bsp::AudioDevice::OutputPath::Loudspeaker}, - bsp::AudioDevice::Type::Audiocodec, - callback) + bsp::AudioDevice::Type::Audiocodec) {} }; diff --git a/module-audio/Audio/Profiles/ProfileRecordingBluetoothHSP.hpp b/module-audio/Audio/Profiles/ProfileRecordingBluetoothHSP.hpp index 175d005adba914d21add132194758e2a0de24afc..a9ce1c26f739ceef4c8012bd6fc7d41817e9c99b 100644 --- a/module-audio/Audio/Profiles/ProfileRecordingBluetoothHSP.hpp +++ b/module-audio/Audio/Profiles/ProfileRecordingBluetoothHSP.hpp @@ -11,7 +11,7 @@ namespace audio class ProfileRecordingBluetoothHSP : public Profile { public: - ProfileRecordingBluetoothHSP(std::function callback, Gain gain) + ProfileRecordingBluetoothHSP(Gain gain) : Profile( "Recording Bluetooth HSP", Type::RecordingHeadphones, @@ -23,8 +23,7 @@ namespace audio .inputGain = static_cast(gain), .inputPath = bsp::AudioDevice::InputPath::BluetoothHSP, .outputPath = bsp::AudioDevice::OutputPath::None}, - bsp::AudioDevice::Type::Bluetooth, - callback) + bsp::AudioDevice::Type::Bluetooth) {} }; diff --git a/module-audio/Audio/Profiles/ProfileRecordingHeadphones.hpp b/module-audio/Audio/Profiles/ProfileRecordingHeadphones.hpp index 5d26d43b41e85e14b9948e275844f71c731cc1ca..c8b330d2ce2f18e31bf57206a58fba5c7a74ac16 100644 --- a/module-audio/Audio/Profiles/ProfileRecordingHeadphones.hpp +++ b/module-audio/Audio/Profiles/ProfileRecordingHeadphones.hpp @@ -10,7 +10,7 @@ namespace audio class ProfileRecordingHeadphones : public Profile { public: - ProfileRecordingHeadphones(std::function callback, Gain gain) + ProfileRecordingHeadphones(Gain gain) : Profile( "Recording Headset", Type::RecordingHeadphones, @@ -22,8 +22,7 @@ namespace audio .inputGain = static_cast(gain), .inputPath = bsp::AudioDevice::InputPath::Headphones, .outputPath = bsp::AudioDevice::OutputPath::None}, - bsp::AudioDevice::Type::Audiocodec, - callback) + bsp::AudioDevice::Type::Audiocodec) {} }; diff --git a/module-audio/Audio/Profiles/ProfileRecordingOnBoardMic.hpp b/module-audio/Audio/Profiles/ProfileRecordingOnBoardMic.hpp index 3f8bb6d031204414f302d75594e23b4482627463..0d650376b446155f01d89ce97ee35606c7afc421 100644 --- a/module-audio/Audio/Profiles/ProfileRecordingOnBoardMic.hpp +++ b/module-audio/Audio/Profiles/ProfileRecordingOnBoardMic.hpp @@ -10,7 +10,7 @@ namespace audio class ProfileRecordingOnBoardMic : public Profile { public: - ProfileRecordingOnBoardMic(std::function callback, Gain gain) + ProfileRecordingOnBoardMic(Gain gain) : Profile( "Recording On Board Microphone", Type::RecordingBuiltInMic, @@ -22,8 +22,7 @@ namespace audio .inputGain = static_cast(gain), .inputPath = bsp::AudioDevice::InputPath::Microphone, .outputPath = bsp::AudioDevice::OutputPath::None}, - bsp::AudioDevice::Type::Audiocodec, - callback) + bsp::AudioDevice::Type::Audiocodec) {} }; diff --git a/module-audio/Audio/Profiles/ProfileRoutingBluetoothHSP.hpp b/module-audio/Audio/Profiles/ProfileRoutingBluetoothHSP.hpp index a6e283b058525adf9b2be0efb4f5a31e30ad0253..d86ab9bfbb093b3862bc8198e56532afbdd6a48c 100644 --- a/module-audio/Audio/Profiles/ProfileRoutingBluetoothHSP.hpp +++ b/module-audio/Audio/Profiles/ProfileRoutingBluetoothHSP.hpp @@ -10,7 +10,7 @@ namespace audio class ProfileRoutingBluetoothHSP : public Profile { public: - ProfileRoutingBluetoothHSP(std::function callback, Volume volume, Gain gain) + ProfileRoutingBluetoothHSP(Volume volume, Gain gain) : Profile("Routing Bluetooth HSP", Type::RoutingBluetoothHSP, bsp::AudioDevice::Format{ @@ -23,8 +23,7 @@ namespace audio .inputGain = static_cast(gain), .inputPath = bsp::AudioDevice::InputPath::BluetoothHSP, .outputPath = bsp::AudioDevice::OutputPath::BluetoothHSP}, - bsp::AudioDevice::Type::Bluetooth, - callback) + bsp::AudioDevice::Type::Bluetooth) {} }; diff --git a/module-audio/Audio/Profiles/ProfileRoutingEarspeaker.hpp b/module-audio/Audio/Profiles/ProfileRoutingEarspeaker.hpp index 080a4c62f7b8cb72da5cdf64f32f1ade3bd8d146..78cb23e58f17a959031fff73e5d613e3bc12dd18 100644 --- a/module-audio/Audio/Profiles/ProfileRoutingEarspeaker.hpp +++ b/module-audio/Audio/Profiles/ProfileRoutingEarspeaker.hpp @@ -10,7 +10,7 @@ namespace audio class ProfileRoutingEarspeaker : public Profile { public: - ProfileRoutingEarspeaker(std::function callback, Volume volume, Gain gain) + ProfileRoutingEarspeaker(Volume volume, Gain gain) : Profile("Routing Earspeaker", Type::RoutingEarspeaker, bsp::AudioDevice::Format{ @@ -23,8 +23,7 @@ namespace audio .inputGain = static_cast(gain), .inputPath = bsp::AudioDevice::InputPath::Microphone, .outputPath = bsp::AudioDevice::OutputPath::Earspeaker}, - bsp::AudioDevice::Type::Audiocodec, - callback) + bsp::AudioDevice::Type::Audiocodec) {} }; diff --git a/module-audio/Audio/Profiles/ProfileRoutingHeadphones.hpp b/module-audio/Audio/Profiles/ProfileRoutingHeadphones.hpp index b00503e2ce3852f9627d463d60bf1e660fe1f8ea..e3127501ce61080d766ab7c42c09f278fa9a8422 100644 --- a/module-audio/Audio/Profiles/ProfileRoutingHeadphones.hpp +++ b/module-audio/Audio/Profiles/ProfileRoutingHeadphones.hpp @@ -10,7 +10,7 @@ namespace audio class ProfileRoutingHeadphones : public Profile { public: - ProfileRoutingHeadphones(std::function callback, Volume volume, Gain gain) + ProfileRoutingHeadphones(Volume volume, Gain gain) : Profile("Routing Headset", Type::RoutingHeadphones, bsp::AudioDevice::Format{ @@ -23,8 +23,7 @@ namespace audio .inputGain = static_cast(gain), .inputPath = bsp::AudioDevice::InputPath::Headphones, .outputPath = bsp::AudioDevice::OutputPath::HeadphonesMono}, - bsp::AudioDevice::Type::Audiocodec, - callback) + bsp::AudioDevice::Type::Audiocodec) {} }; diff --git a/module-audio/Audio/Profiles/ProfileRoutingLoudspeaker.hpp b/module-audio/Audio/Profiles/ProfileRoutingLoudspeaker.hpp index 815a5acb061ebfc014a0ec97eff09419377710ed..733368be31dc371a3f6323187884a88e775ec9fb 100644 --- a/module-audio/Audio/Profiles/ProfileRoutingLoudspeaker.hpp +++ b/module-audio/Audio/Profiles/ProfileRoutingLoudspeaker.hpp @@ -10,7 +10,7 @@ namespace audio class ProfileRoutingLoudspeaker : public Profile { public: - ProfileRoutingLoudspeaker(std::function callback, Volume volume, Gain gain) + ProfileRoutingLoudspeaker(Volume volume, Gain gain) : Profile("Routing Speakerphone", Type::RoutingLoudspeaker, bsp::AudioDevice::Format{ @@ -23,8 +23,7 @@ namespace audio .inputGain = static_cast(gain), .inputPath = bsp::AudioDevice::InputPath::Microphone, .outputPath = bsp::AudioDevice::OutputPath::LoudspeakerMono}, - bsp::AudioDevice::Type::Audiocodec, - callback) + bsp::AudioDevice::Type::Audiocodec) {} };