1
1
Fork 0
forked from suyu/suyu

service/am: Unstub SetTransparentVolumeRate()

Like the other volume setter, this mainly just sets a data member within
the service, nothing too special.
This commit is contained in:
Lioncash 2019-03-17 21:09:25 -04:00
parent ecd3afdc8e
commit c07ebeac19
2 changed files with 17 additions and 1 deletions

View file

@ -99,7 +99,7 @@ IAudioController::IAudioController() : ServiceFramework("IAudioController") {
{1, &IAudioController::GetMainAppletExpectedMasterVolume, "GetMainAppletExpectedMasterVolume"}, {1, &IAudioController::GetMainAppletExpectedMasterVolume, "GetMainAppletExpectedMasterVolume"},
{2, &IAudioController::GetLibraryAppletExpectedMasterVolume, "GetLibraryAppletExpectedMasterVolume"}, {2, &IAudioController::GetLibraryAppletExpectedMasterVolume, "GetLibraryAppletExpectedMasterVolume"},
{3, nullptr, "ChangeMainAppletMasterVolume"}, {3, nullptr, "ChangeMainAppletMasterVolume"},
{4, nullptr, "SetTransparentVolumeRate"}, {4, &IAudioController::SetTransparentAudioRate, "SetTransparentVolumeRate"},
}; };
// clang-format on // clang-format on
@ -139,6 +139,20 @@ void IAudioController::GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestCo
rb.Push(library_applet_volume); rb.Push(library_applet_volume);
} }
void IAudioController::SetTransparentAudioRate(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const float transparent_volume_rate_tmp = rp.Pop<float>();
LOG_DEBUG(Service_AM, "called. transparent_volume_rate={}", transparent_volume_rate_tmp);
// Clamp volume range to 0-100%.
transparent_volume_rate =
std::clamp(transparent_volume_rate_tmp, min_allowed_volume, max_allowed_volume);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
}
IDisplayController::IDisplayController() : ServiceFramework("IDisplayController") { IDisplayController::IDisplayController() : ServiceFramework("IDisplayController") {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {

View file

@ -81,12 +81,14 @@ private:
void SetExpectedMasterVolume(Kernel::HLERequestContext& ctx); void SetExpectedMasterVolume(Kernel::HLERequestContext& ctx);
void GetMainAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx); void GetMainAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx);
void GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx); void GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx);
void SetTransparentAudioRate(Kernel::HLERequestContext& ctx);
static constexpr float min_allowed_volume = 0.0f; static constexpr float min_allowed_volume = 0.0f;
static constexpr float max_allowed_volume = 1.0f; static constexpr float max_allowed_volume = 1.0f;
float main_applet_volume{0.25f}; float main_applet_volume{0.25f};
float library_applet_volume{max_allowed_volume}; float library_applet_volume{max_allowed_volume};
float transparent_volume_rate{min_allowed_volume};
}; };
class IDisplayController final : public ServiceFramework<IDisplayController> { class IDisplayController final : public ServiceFramework<IDisplayController> {