mirror of
https://github.com/yuzu-emu/yuzu-android
synced 2024-12-26 07:21:21 -08:00
service/am: Unstub SetExpectedMasterVolume()
This function passes in the desired main applet and library applet volume levels. We can then just pass those values back within the relevant volume getter functions, allowing us to unstub those as well. The initial values for the library and main applet volumes differ. The main applet volume is 0.25 by default, while the library applet volume is initialized to 1.0 by default in the services themselves.
This commit is contained in:
parent
c57d8eb66c
commit
ecd3afdc8e
@ -2,10 +2,10 @@
|
|||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <stack>
|
|
||||||
#include "audio_core/audio_renderer.h"
|
#include "audio_core/audio_renderer.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/file_sys/savedata_factory.h"
|
#include "core/file_sys/savedata_factory.h"
|
||||||
@ -93,38 +93,50 @@ void IWindowController::AcquireForegroundRights(Kernel::HLERequestContext& ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
IAudioController::IAudioController() : ServiceFramework("IAudioController") {
|
IAudioController::IAudioController() : ServiceFramework("IAudioController") {
|
||||||
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &IAudioController::SetExpectedMasterVolume, "SetExpectedMasterVolume"},
|
{0, &IAudioController::SetExpectedMasterVolume, "SetExpectedMasterVolume"},
|
||||||
{1, &IAudioController::GetMainAppletExpectedMasterVolume,
|
{1, &IAudioController::GetMainAppletExpectedMasterVolume, "GetMainAppletExpectedMasterVolume"},
|
||||||
"GetMainAppletExpectedMasterVolume"},
|
{2, &IAudioController::GetLibraryAppletExpectedMasterVolume, "GetLibraryAppletExpectedMasterVolume"},
|
||||||
{2, &IAudioController::GetLibraryAppletExpectedMasterVolume,
|
|
||||||
"GetLibraryAppletExpectedMasterVolume"},
|
|
||||||
{3, nullptr, "ChangeMainAppletMasterVolume"},
|
{3, nullptr, "ChangeMainAppletMasterVolume"},
|
||||||
{4, nullptr, "SetTransparentVolumeRate"},
|
{4, nullptr, "SetTransparentVolumeRate"},
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
RegisterHandlers(functions);
|
RegisterHandlers(functions);
|
||||||
}
|
}
|
||||||
|
|
||||||
IAudioController::~IAudioController() = default;
|
IAudioController::~IAudioController() = default;
|
||||||
|
|
||||||
void IAudioController::SetExpectedMasterVolume(Kernel::HLERequestContext& ctx) {
|
void IAudioController::SetExpectedMasterVolume(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service_AM, "(STUBBED) called");
|
IPC::RequestParser rp{ctx};
|
||||||
|
const float main_applet_volume_tmp = rp.Pop<float>();
|
||||||
|
const float library_applet_volume_tmp = rp.Pop<float>();
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_AM, "called. main_applet_volume={}, library_applet_volume={}",
|
||||||
|
main_applet_volume_tmp, library_applet_volume_tmp);
|
||||||
|
|
||||||
|
// Ensure the volume values remain within the 0-100% range
|
||||||
|
main_applet_volume = std::clamp(main_applet_volume_tmp, min_allowed_volume, max_allowed_volume);
|
||||||
|
library_applet_volume =
|
||||||
|
std::clamp(library_applet_volume_tmp, min_allowed_volume, max_allowed_volume);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IAudioController::GetMainAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx) {
|
void IAudioController::GetMainAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service_AM, "(STUBBED) called");
|
LOG_DEBUG(Service_AM, "called. main_applet_volume={}", main_applet_volume);
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push(volume);
|
rb.Push(main_applet_volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IAudioController::GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx) {
|
void IAudioController::GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service_AM, "(STUBBED) called");
|
LOG_DEBUG(Service_AM, "called. library_applet_volume={}", library_applet_volume);
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push(volume);
|
rb.Push(library_applet_volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
IDisplayController::IDisplayController() : ServiceFramework("IDisplayController") {
|
IDisplayController::IDisplayController() : ServiceFramework("IDisplayController") {
|
||||||
|
@ -82,7 +82,11 @@ private:
|
|||||||
void GetMainAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx);
|
void GetMainAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx);
|
||||||
void GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx);
|
void GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
u32 volume{100};
|
static constexpr float min_allowed_volume = 0.0f;
|
||||||
|
static constexpr float max_allowed_volume = 1.0f;
|
||||||
|
|
||||||
|
float main_applet_volume{0.25f};
|
||||||
|
float library_applet_volume{max_allowed_volume};
|
||||||
};
|
};
|
||||||
|
|
||||||
class IDisplayController final : public ServiceFramework<IDisplayController> {
|
class IDisplayController final : public ServiceFramework<IDisplayController> {
|
||||||
|
Loading…
Reference in New Issue
Block a user