audctl.cpp 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Copyright 2018 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include "common/logging/log.h"
  5. #include "core/hle/ipc_helpers.h"
  6. #include "core/hle/service/audio/audctl.h"
  7. namespace Service::Audio {
  8. AudCtl::AudCtl() : ServiceFramework{"audctl"} {
  9. // clang-format off
  10. static const FunctionInfo functions[] = {
  11. {0, nullptr, "GetTargetVolume"},
  12. {1, nullptr, "SetTargetVolume"},
  13. {2, &AudCtl::GetTargetVolumeMin, "GetTargetVolumeMin"},
  14. {3, &AudCtl::GetTargetVolumeMax, "GetTargetVolumeMax"},
  15. {4, nullptr, "IsTargetMute"},
  16. {5, nullptr, "SetTargetMute"},
  17. {6, nullptr, "IsTargetConnected"},
  18. {7, nullptr, "SetDefaultTarget"},
  19. {8, nullptr, "GetDefaultTarget"},
  20. {9, nullptr, "GetAudioOutputMode"},
  21. {10, nullptr, "SetAudioOutputMode"},
  22. {11, nullptr, "SetForceMutePolicy"},
  23. {12, nullptr, "GetForceMutePolicy"},
  24. {13, nullptr, "GetOutputModeSetting"},
  25. {14, nullptr, "SetOutputModeSetting"},
  26. {15, nullptr, "SetOutputTarget"},
  27. {16, nullptr, "SetInputTargetForceEnabled"},
  28. {17, nullptr, "SetHeadphoneOutputLevelMode"},
  29. {18, nullptr, "GetHeadphoneOutputLevelMode"},
  30. {19, nullptr, "AcquireAudioVolumeUpdateEventForPlayReport"},
  31. {20, nullptr, "AcquireAudioOutputDeviceUpdateEventForPlayReport"},
  32. {21, nullptr, "GetAudioOutputTargetForPlayReport"},
  33. {22, nullptr, "NotifyHeadphoneVolumeWarningDisplayedEvent"},
  34. {23, nullptr, "SetSystemOutputMasterVolume"},
  35. {24, nullptr, "GetSystemOutputMasterVolume"},
  36. {25, nullptr, "GetAudioVolumeDataForPlayReport"},
  37. {26, nullptr, "UpdateHeadphoneSettings"},
  38. };
  39. // clang-format on
  40. RegisterHandlers(functions);
  41. }
  42. AudCtl::~AudCtl() = default;
  43. void AudCtl::GetTargetVolumeMin(Kernel::HLERequestContext& ctx) {
  44. LOG_DEBUG(Audio, "called.");
  45. // This service function is currently hardcoded on the
  46. // actual console to this value (as of 8.0.0).
  47. constexpr s32 target_min_volume = 0;
  48. IPC::ResponseBuilder rb{ctx, 3};
  49. rb.Push(RESULT_SUCCESS);
  50. rb.Push(target_min_volume);
  51. }
  52. void AudCtl::GetTargetVolumeMax(Kernel::HLERequestContext& ctx) {
  53. LOG_DEBUG(Audio, "called.");
  54. // This service function is currently hardcoded on the
  55. // actual console to this value (as of 8.0.0).
  56. constexpr s32 target_max_volume = 15;
  57. IPC::ResponseBuilder rb{ctx, 3};
  58. rb.Push(RESULT_SUCCESS);
  59. rb.Push(target_max_volume);
  60. }
  61. } // namespace Service::Audio