Extend the IAudioController implementation with volume stubs

This is used by ARMS.
This commit is contained in:
Billy Laws 2020-07-09 20:41:25 +01:00 committed by ◱ PixelyIon
parent 4cd7502df2
commit 3734599615
2 changed files with 35 additions and 0 deletions

View File

@ -5,5 +5,21 @@
namespace skyline::service::am { namespace skyline::service::am {
IAudioController::IAudioController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_IAudioController, "am:IAudioController", { IAudioController::IAudioController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_IAudioController, "am:IAudioController", {
{0x0, SFUNC(IAudioController::SetExpectedMasterVolume)},
{0x1, SFUNC(IAudioController::GetMainAppletExpectedMasterVolume)},
{0x2, SFUNC(IAudioController::GetLibraryAppletExpectedMasterVolume)}
}) {} }) {}
void IAudioController::SetExpectedMasterVolume(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
mainAppletVolume = request.Pop<float>();
libraryAppletVolume = request.Pop<float>();
}
void IAudioController::GetMainAppletExpectedMasterVolume(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
response.Push<float>(mainAppletVolume);
}
void IAudioController::GetLibraryAppletExpectedMasterVolume(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
response.Push<float>(libraryAppletVolume);
}
} }

View File

@ -11,7 +11,26 @@ namespace skyline::service::am {
* @brief This has functions relating to volume control (https://switchbrew.org/wiki/Applet_Manager_services#IAudioController) * @brief This has functions relating to volume control (https://switchbrew.org/wiki/Applet_Manager_services#IAudioController)
*/ */
class IAudioController : public BaseService { class IAudioController : public BaseService {
private:
float mainAppletVolume{1.0f}; //!< The volume that is expected to be used for the main applet
float libraryAppletVolume{1.0f}; //!< The volume that is expected to be used for the library applet
public: public:
IAudioController(const DeviceState &state, ServiceManager &manager); IAudioController(const DeviceState &state, ServiceManager &manager);
/**
* @brief This sets the expected volumes for an application (https://switchbrew.org/wiki/Applet_Manager_services#SetExpectedMasterVolume)
*/
void SetExpectedMasterVolume(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
/**
* @brief This returns the main applet volume that is expected by the application (https://switchbrew.org/wiki/Applet_Manager_services#GetMainAppletExpectedMasterVolume)
*/
void GetMainAppletExpectedMasterVolume(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
/**
* @brief This returns the library applet volume that is expected by the application (https://switchbrew.org/wiki/Applet_Manager_services#GetLibraryAppletExpectedMasterVolume)
*/
void GetLibraryAppletExpectedMasterVolume(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
}; };
} }