M module-audio/Audio/Operation/IdleOperation.cpp => module-audio/Audio/Operation/IdleOperation.cpp +1 -1
@@ 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;
}
M module-audio/Audio/Operation/Operation.cpp => module-audio/Audio/Operation/Operation.cpp +1 -1
@@ 91,7 91,7 @@ namespace audio
gain = utils::getNumericValue<audio::Gain>(val.value());
}
- supportedProfiles.emplace_back(Profile::Create(profile, nullptr, volume, gain), isAvailable);
+ supportedProfiles.emplace_back(Profile::Create(profile, volume, gain), isAvailable);
}
std::optional<std::unique_ptr<bsp::AudioDevice>> Operation::CreateDevice(bsp::AudioDevice::Type type)
M module-audio/Audio/Profiles/Profile.cpp => module-audio/Audio/Profiles/Profile.cpp +12 -26
@@ 25,7 25,6 @@ namespace audio
{
std::unique_ptr<Profile> Profile::Create(const Type t,
- std::function<int32_t()> callback,
std::optional<Volume> vol,
std::optional<Gain> gain)
{
@@ 34,43 33,43 @@ namespace audio
switch (t) {
case Type::PlaybackHeadphones:
assert(vol);
- inst = std::make_unique<ProfilePlaybackHeadphones>(callback, vol.value());
+ inst = std::make_unique<ProfilePlaybackHeadphones>(vol.value());
break;
case Type::PlaybackLoudspeaker:
assert(vol);
- inst = std::make_unique<ProfilePlaybackLoudspeaker>(callback, vol.value());
+ inst = std::make_unique<ProfilePlaybackLoudspeaker>(vol.value());
break;
case Type::PlaybackBluetoothA2DP:
assert(vol);
- inst = std::make_unique<ProfilePlaybackBluetoothA2DP>(callback, vol.value());
+ inst = std::make_unique<ProfilePlaybackBluetoothA2DP>(vol.value());
break;
case Type::RecordingBuiltInMic:
assert(gain);
- inst = std::make_unique<ProfileRecordingOnBoardMic>(callback, gain.value());
+ inst = std::make_unique<ProfileRecordingOnBoardMic>(gain.value());
break;
case Type::RecordingHeadphones:
assert(gain);
- inst = std::make_unique<ProfileRecordingHeadphones>(callback, gain.value());
+ inst = std::make_unique<ProfileRecordingHeadphones>(gain.value());
break;
case Type::RecordingBluetoothHSP:
assert(gain);
- inst = std::make_unique<ProfileRecordingBluetoothHSP>(callback, gain.value());
+ inst = std::make_unique<ProfileRecordingBluetoothHSP>(gain.value());
break;
case Type::RoutingHeadphones:
assert(gain && vol);
- inst = std::make_unique<ProfileRoutingHeadphones>(callback, vol.value(), gain.value());
+ inst = std::make_unique<ProfileRoutingHeadphones>(vol.value(), gain.value());
break;
case Type::RoutingLoudspeaker:
assert(gain && vol);
- inst = std::make_unique<ProfileRoutingLoudspeaker>(callback, vol.value(), gain.value());
+ inst = std::make_unique<ProfileRoutingLoudspeaker>(vol.value(), gain.value());
break;
case Type::RoutingEarspeaker:
assert(gain && vol);
- inst = std::make_unique<ProfileRoutingEarspeaker>(callback, vol.value(), gain.value());
+ inst = std::make_unique<ProfileRoutingEarspeaker>(vol.value(), gain.value());
break;
case Type::RoutingBluetoothHSP:
assert(gain && vol);
- inst = std::make_unique<ProfileRoutingBluetoothHSP>(callback, vol.value(), gain.value());
+ inst = std::make_unique<ProfileRoutingBluetoothHSP>(vol.value(), gain.value());
break;
case Type::Idle:
inst = std::make_unique<ProfileIdle>();
@@ 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<int32_t()> 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)
M module-audio/Audio/Profiles/Profile.hpp => module-audio/Audio/Profiles/Profile.hpp +1 -5
@@ 43,7 43,6 @@ namespace audio
};
static std::unique_ptr<Profile> Create(const Type t,
- std::function<int32_t()> callback = nullptr,
std::optional<Volume> vol = 0,
std::optional<Gain> 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<int32_t()> 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<int32_t()> dbAccessCallback = nullptr;
};
[[nodiscard]] const std::string str(const Profile::Type &profileType);
M module-audio/Audio/Profiles/ProfileIdle.hpp => module-audio/Audio/Profiles/ProfileIdle.hpp +1 -1
@@ 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)
{}
};
M module-audio/Audio/Profiles/ProfilePlaybackBluetoothA2DP.hpp => module-audio/Audio/Profiles/ProfilePlaybackBluetoothA2DP.hpp +2 -3
@@ 11,7 11,7 @@ namespace audio
class ProfilePlaybackBluetoothA2DP : public Profile
{
public:
- ProfilePlaybackBluetoothA2DP(std::function<int32_t()> 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)
{}
};
M module-audio/Audio/Profiles/ProfilePlaybackHeadphones.hpp => module-audio/Audio/Profiles/ProfilePlaybackHeadphones.hpp +2 -3
@@ 10,7 10,7 @@ namespace audio
class ProfilePlaybackHeadphones : public Profile
{
public:
- ProfilePlaybackHeadphones(std::function<int32_t()> 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)
{}
};
M module-audio/Audio/Profiles/ProfilePlaybackLoudspeaker.hpp => module-audio/Audio/Profiles/ProfilePlaybackLoudspeaker.hpp +2 -3
@@ 11,7 11,7 @@ namespace audio
class ProfilePlaybackLoudspeaker : public Profile
{
public:
- ProfilePlaybackLoudspeaker(std::function<int32_t()> 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)
{}
};
M module-audio/Audio/Profiles/ProfileRecordingBluetoothHSP.hpp => module-audio/Audio/Profiles/ProfileRecordingBluetoothHSP.hpp +2 -3
@@ 11,7 11,7 @@ namespace audio
class ProfileRecordingBluetoothHSP : public Profile
{
public:
- ProfileRecordingBluetoothHSP(std::function<int32_t()> callback, Gain gain)
+ ProfileRecordingBluetoothHSP(Gain gain)
: Profile(
"Recording Bluetooth HSP",
Type::RecordingHeadphones,
@@ 23,8 23,7 @@ namespace audio
.inputGain = static_cast<float>(gain),
.inputPath = bsp::AudioDevice::InputPath::BluetoothHSP,
.outputPath = bsp::AudioDevice::OutputPath::None},
- bsp::AudioDevice::Type::Bluetooth,
- callback)
+ bsp::AudioDevice::Type::Bluetooth)
{}
};
M module-audio/Audio/Profiles/ProfileRecordingHeadphones.hpp => module-audio/Audio/Profiles/ProfileRecordingHeadphones.hpp +2 -3
@@ 10,7 10,7 @@ namespace audio
class ProfileRecordingHeadphones : public Profile
{
public:
- ProfileRecordingHeadphones(std::function<int32_t()> callback, Gain gain)
+ ProfileRecordingHeadphones(Gain gain)
: Profile(
"Recording Headset",
Type::RecordingHeadphones,
@@ 22,8 22,7 @@ namespace audio
.inputGain = static_cast<float>(gain),
.inputPath = bsp::AudioDevice::InputPath::Headphones,
.outputPath = bsp::AudioDevice::OutputPath::None},
- bsp::AudioDevice::Type::Audiocodec,
- callback)
+ bsp::AudioDevice::Type::Audiocodec)
{}
};
M module-audio/Audio/Profiles/ProfileRecordingOnBoardMic.hpp => module-audio/Audio/Profiles/ProfileRecordingOnBoardMic.hpp +2 -3
@@ 10,7 10,7 @@ namespace audio
class ProfileRecordingOnBoardMic : public Profile
{
public:
- ProfileRecordingOnBoardMic(std::function<int32_t()> callback, Gain gain)
+ ProfileRecordingOnBoardMic(Gain gain)
: Profile(
"Recording On Board Microphone",
Type::RecordingBuiltInMic,
@@ 22,8 22,7 @@ namespace audio
.inputGain = static_cast<float>(gain),
.inputPath = bsp::AudioDevice::InputPath::Microphone,
.outputPath = bsp::AudioDevice::OutputPath::None},
- bsp::AudioDevice::Type::Audiocodec,
- callback)
+ bsp::AudioDevice::Type::Audiocodec)
{}
};
M module-audio/Audio/Profiles/ProfileRoutingBluetoothHSP.hpp => module-audio/Audio/Profiles/ProfileRoutingBluetoothHSP.hpp +2 -3
@@ 10,7 10,7 @@ namespace audio
class ProfileRoutingBluetoothHSP : public Profile
{
public:
- ProfileRoutingBluetoothHSP(std::function<int32_t()> 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<float>(gain),
.inputPath = bsp::AudioDevice::InputPath::BluetoothHSP,
.outputPath = bsp::AudioDevice::OutputPath::BluetoothHSP},
- bsp::AudioDevice::Type::Bluetooth,
- callback)
+ bsp::AudioDevice::Type::Bluetooth)
{}
};
M module-audio/Audio/Profiles/ProfileRoutingEarspeaker.hpp => module-audio/Audio/Profiles/ProfileRoutingEarspeaker.hpp +2 -3
@@ 10,7 10,7 @@ namespace audio
class ProfileRoutingEarspeaker : public Profile
{
public:
- ProfileRoutingEarspeaker(std::function<int32_t()> 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<float>(gain),
.inputPath = bsp::AudioDevice::InputPath::Microphone,
.outputPath = bsp::AudioDevice::OutputPath::Earspeaker},
- bsp::AudioDevice::Type::Audiocodec,
- callback)
+ bsp::AudioDevice::Type::Audiocodec)
{}
};
M module-audio/Audio/Profiles/ProfileRoutingHeadphones.hpp => module-audio/Audio/Profiles/ProfileRoutingHeadphones.hpp +2 -3
@@ 10,7 10,7 @@ namespace audio
class ProfileRoutingHeadphones : public Profile
{
public:
- ProfileRoutingHeadphones(std::function<int32_t()> 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<float>(gain),
.inputPath = bsp::AudioDevice::InputPath::Headphones,
.outputPath = bsp::AudioDevice::OutputPath::HeadphonesMono},
- bsp::AudioDevice::Type::Audiocodec,
- callback)
+ bsp::AudioDevice::Type::Audiocodec)
{}
};
M module-audio/Audio/Profiles/ProfileRoutingLoudspeaker.hpp => module-audio/Audio/Profiles/ProfileRoutingLoudspeaker.hpp +2 -3
@@ 10,7 10,7 @@ namespace audio
class ProfileRoutingLoudspeaker : public Profile
{
public:
- ProfileRoutingLoudspeaker(std::function<int32_t()> 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<float>(gain),
.inputPath = bsp::AudioDevice::InputPath::Microphone,
.outputPath = bsp::AudioDevice::OutputPath::LoudspeakerMono},
- bsp::AudioDevice::Type::Audiocodec,
- callback)
+ bsp::AudioDevice::Type::Audiocodec)
{}
};