From ba661c8d9a4f28976613223b0cc459da9e0e3436 Mon Sep 17 00:00:00 2001 From: Morph1984 <39850852+Morph1984@users.noreply.github.com> Date: Tue, 3 Sep 2019 16:05:33 -0400 Subject: [PATCH 1/4] service/audio/audren_u: Stub IAudioDevice::GetAudioDeviceOutputVolume --- src/core/hle/service/audio/audren_u.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 5b0b7f17e3..278332cfef 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp @@ -165,13 +165,13 @@ public: static const FunctionInfo functions[] = { {0, &IAudioDevice::ListAudioDeviceName, "ListAudioDeviceName"}, {1, &IAudioDevice::SetAudioDeviceOutputVolume, "SetAudioDeviceOutputVolume"}, - {2, nullptr, "GetAudioDeviceOutputVolume"}, + {2, &IAudioDevice::GetAudioDeviceOutputVolume, "GetAudioDeviceOutputVolume"}, {3, &IAudioDevice::GetActiveAudioDeviceName, "GetActiveAudioDeviceName"}, {4, &IAudioDevice::QueryAudioDeviceSystemEvent, "QueryAudioDeviceSystemEvent"}, {5, &IAudioDevice::GetActiveChannelCount, "GetActiveChannelCount"}, {6, &IAudioDevice::ListAudioDeviceName, "ListAudioDeviceNameAuto"}, {7, &IAudioDevice::SetAudioDeviceOutputVolume, "SetAudioDeviceOutputVolumeAuto"}, - {8, nullptr, "GetAudioDeviceOutputVolumeAuto"}, + {8, &IAudioDevice::GetAudioDeviceOutputVolume, "GetAudioDeviceOutputVolumeAuto"}, {10, &IAudioDevice::GetActiveAudioDeviceName, "GetActiveAudioDeviceNameAuto"}, {11, nullptr, "QueryAudioDeviceInputEvent"}, {12, &IAudioDevice::QueryAudioDeviceOutputEvent, "QueryAudioDeviceOutputEvent"}, @@ -246,6 +246,19 @@ private: rb.Push(RESULT_SUCCESS); } + void GetAudioDeviceOutputVolume(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + + const auto device_name_buffer = ctx.ReadBuffer(); + const std::string name = Common::StringFromBuffer(device_name_buffer); + + LOG_WARNING(Service_Audio, "(STUBBED) called. name={}", name); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(RESULT_SUCCESS); + rb.Push(1); + } + void GetActiveAudioDeviceName(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_Audio, "(STUBBED) called"); From b1ca56bed2eca5ee2b2f71ad8215fd19dddc26a4 Mon Sep 17 00:00:00 2001 From: Morph1984 <39850852+Morph1984@users.noreply.github.com> Date: Tue, 3 Sep 2019 22:30:20 -0400 Subject: [PATCH 2/4] Change u32 -> f32 Volume is a f32 value. (SwIPC describes it as a u32, but it is actually f32 as corroborated by switchbrew docs and SetAudioDeviceOutputVolume) ```cpp const f32 volume = rp.Pop(); ``` --- src/core/hle/service/audio/audren_u.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 278332cfef..547dab26de 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp @@ -256,7 +256,7 @@ private: IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); - rb.Push(1); + rb.Push(1); } void GetActiveAudioDeviceName(Kernel::HLERequestContext& ctx) { From 58783b8a464d783d9c8d22fc8d7307dc0da95d33 Mon Sep 17 00:00:00 2001 From: Morph1984 <39850852+Morph1984@users.noreply.github.com> Date: Tue, 3 Sep 2019 23:06:32 -0400 Subject: [PATCH 3/4] explicitly represent 1 as a float (1.0f instead of 1) --- src/core/hle/service/audio/audren_u.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 547dab26de..dd9b20e868 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp @@ -256,7 +256,7 @@ private: IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); - rb.Push(1); + rb.Push(1.0f); } void GetActiveAudioDeviceName(Kernel::HLERequestContext& ctx) { From ec95c73a127fbc909a1a0a75dd6433a77d1e9e42 Mon Sep 17 00:00:00 2001 From: Morph1984 <39850852+Morph1984@users.noreply.github.com> Date: Tue, 3 Sep 2019 23:20:19 -0400 Subject: [PATCH 4/4] remove We can remove this since its already a f32 value --- src/core/hle/service/audio/audren_u.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index dd9b20e868..b4bd9adf02 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp @@ -256,7 +256,7 @@ private: IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); - rb.Push(1.0f); + rb.Push(1.0f); } void GetActiveAudioDeviceName(Kernel::HLERequestContext& ctx) {