summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/am/am.cpp16
-rw-r--r--src/core/hle/service/am/am.h2
2 files changed, 17 insertions, 1 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 4f1541e9d..4ef449ccb 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -99,7 +99,7 @@ IAudioController::IAudioController() : ServiceFramework("IAudioController") {
99 {1, &IAudioController::GetMainAppletExpectedMasterVolume, "GetMainAppletExpectedMasterVolume"}, 99 {1, &IAudioController::GetMainAppletExpectedMasterVolume, "GetMainAppletExpectedMasterVolume"},
100 {2, &IAudioController::GetLibraryAppletExpectedMasterVolume, "GetLibraryAppletExpectedMasterVolume"}, 100 {2, &IAudioController::GetLibraryAppletExpectedMasterVolume, "GetLibraryAppletExpectedMasterVolume"},
101 {3, nullptr, "ChangeMainAppletMasterVolume"}, 101 {3, nullptr, "ChangeMainAppletMasterVolume"},
102 {4, nullptr, "SetTransparentVolumeRate"}, 102 {4, &IAudioController::SetTransparentAudioRate, "SetTransparentVolumeRate"},
103 }; 103 };
104 // clang-format on 104 // clang-format on
105 105
@@ -139,6 +139,20 @@ void IAudioController::GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestCo
139 rb.Push(library_applet_volume); 139 rb.Push(library_applet_volume);
140} 140}
141 141
142void IAudioController::SetTransparentAudioRate(Kernel::HLERequestContext& ctx) {
143 IPC::RequestParser rp{ctx};
144 const float transparent_volume_rate_tmp = rp.Pop<float>();
145
146 LOG_DEBUG(Service_AM, "called. transparent_volume_rate={}", transparent_volume_rate_tmp);
147
148 // Clamp volume range to 0-100%.
149 transparent_volume_rate =
150 std::clamp(transparent_volume_rate_tmp, min_allowed_volume, max_allowed_volume);
151
152 IPC::ResponseBuilder rb{ctx, 2};
153 rb.Push(RESULT_SUCCESS);
154}
155
142IDisplayController::IDisplayController() : ServiceFramework("IDisplayController") { 156IDisplayController::IDisplayController() : ServiceFramework("IDisplayController") {
143 // clang-format off 157 // clang-format off
144 static const FunctionInfo functions[] = { 158 static const FunctionInfo functions[] = {
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h
index bca06c25d..b77a8c96c 100644
--- a/src/core/hle/service/am/am.h
+++ b/src/core/hle/service/am/am.h
@@ -81,12 +81,14 @@ private:
81 void SetExpectedMasterVolume(Kernel::HLERequestContext& ctx); 81 void SetExpectedMasterVolume(Kernel::HLERequestContext& ctx);
82 void GetMainAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx); 82 void GetMainAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx);
83 void GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx); 83 void GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx);
84 void SetTransparentAudioRate(Kernel::HLERequestContext& ctx);
84 85
85 static constexpr float min_allowed_volume = 0.0f; 86 static constexpr float min_allowed_volume = 0.0f;
86 static constexpr float max_allowed_volume = 1.0f; 87 static constexpr float max_allowed_volume = 1.0f;
87 88
88 float main_applet_volume{0.25f}; 89 float main_applet_volume{0.25f};
89 float library_applet_volume{max_allowed_volume}; 90 float library_applet_volume{max_allowed_volume};
91 float transparent_volume_rate{min_allowed_volume};
90}; 92};
91 93
92class IDisplayController final : public ServiceFramework<IDisplayController> { 94class IDisplayController final : public ServiceFramework<IDisplayController> {