summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/am/am.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-03-18 03:39:29 +0100
committerLioncash <mathew1800@gmail.com>2019-03-18 14:18:34 +0100
commit26b809549b7cdadd75b55a1799d6cb7a2184b0a1 (patch)
tree621fec1fb83e2ff6f96fd6a76f2787a8dd5eeee7 /src/core/hle/service/am/am.cpp
parentservice/am: Unstub SetTransparentVolumeRate() (diff)
downloadyuzu-26b809549b7cdadd75b55a1799d6cb7a2184b0a1.tar
yuzu-26b809549b7cdadd75b55a1799d6cb7a2184b0a1.tar.gz
yuzu-26b809549b7cdadd75b55a1799d6cb7a2184b0a1.tar.bz2
yuzu-26b809549b7cdadd75b55a1799d6cb7a2184b0a1.tar.lz
yuzu-26b809549b7cdadd75b55a1799d6cb7a2184b0a1.tar.xz
yuzu-26b809549b7cdadd75b55a1799d6cb7a2184b0a1.tar.zst
yuzu-26b809549b7cdadd75b55a1799d6cb7a2184b0a1.zip
Diffstat (limited to 'src/core/hle/service/am/am.cpp')
-rw-r--r--src/core/hle/service/am/am.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 4ef449ccb..c750d70ac 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -98,7 +98,7 @@ IAudioController::IAudioController() : ServiceFramework("IAudioController") {
{0, &IAudioController::SetExpectedMasterVolume, "SetExpectedMasterVolume"},
{1, &IAudioController::GetMainAppletExpectedMasterVolume, "GetMainAppletExpectedMasterVolume"},
{2, &IAudioController::GetLibraryAppletExpectedMasterVolume, "GetLibraryAppletExpectedMasterVolume"},
- {3, nullptr, "ChangeMainAppletMasterVolume"},
+ {3, &IAudioController::ChangeMainAppletMasterVolume, "ChangeMainAppletMasterVolume"},
{4, &IAudioController::SetTransparentAudioRate, "SetTransparentVolumeRate"},
};
// clang-format on
@@ -139,6 +139,26 @@ void IAudioController::GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestCo
rb.Push(library_applet_volume);
}
+void IAudioController::ChangeMainAppletMasterVolume(Kernel::HLERequestContext& ctx) {
+ struct Parameters {
+ float volume;
+ s64 fade_time_ns;
+ };
+ static_assert(sizeof(Parameters) == 16);
+
+ IPC::RequestParser rp{ctx};
+ const auto parameters = rp.PopRaw<Parameters>();
+
+ LOG_DEBUG(Service_AM, "called. volume={}, fade_time_ns={}", parameters.volume,
+ parameters.fade_time_ns);
+
+ main_applet_volume = std::clamp(parameters.volume, min_allowed_volume, max_allowed_volume);
+ fade_time_ns = std::chrono::nanoseconds{parameters.fade_time_ns};
+
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+}
+
void IAudioController::SetTransparentAudioRate(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const float transparent_volume_rate_tmp = rp.Pop<float>();