diff options
| author | 2021-05-08 03:07:10 -0700 | |
|---|---|---|
| committer | 2021-05-11 10:24:53 -0700 | |
| commit | b9f543b29f2d2fbb44dbf5d821cc6b5fd10af118 (patch) | |
| tree | badebcb7ca2ebf3d0a77a0c01a7b1ea0609812e2 | |
| parent | core: hle: ipc_helpers: Fix cast on raw_data_size calculation. (diff) | |
| download | yuzu-b9f543b29f2d2fbb44dbf5d821cc6b5fd10af118.tar.gz yuzu-b9f543b29f2d2fbb44dbf5d821cc6b5fd10af118.tar.xz yuzu-b9f543b29f2d2fbb44dbf5d821cc6b5fd10af118.zip | |
audren
| -rw-r--r-- | src/core/hle/service/audio/audren_u.cpp | 39 | ||||
| -rw-r--r-- | src/core/hle/service/audio/audren_u.h | 2 |
2 files changed, 16 insertions, 25 deletions
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 513bd3730..65887011f 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp | |||
| @@ -169,10 +169,9 @@ private: | |||
| 169 | 169 | ||
| 170 | class IAudioDevice final : public ServiceFramework<IAudioDevice> { | 170 | class IAudioDevice final : public ServiceFramework<IAudioDevice> { |
| 171 | public: | 171 | public: |
| 172 | explicit IAudioDevice(Core::System& system_, u32_le revision_num) | 172 | explicit IAudioDevice(Core::System& system_, Kernel::KEvent& buffer_event_, u32_le revision_) |
| 173 | : ServiceFramework{system_, "IAudioDevice"}, revision{revision_num}, | 173 | : ServiceFramework{system_, "IAudioDevice"}, buffer_event{buffer_event_}, revision{ |
| 174 | buffer_event{system.Kernel()}, audio_input_device_switch_event{system.Kernel()}, | 174 | revision_} { |
| 175 | audio_output_device_switch_event{system.Kernel()} { | ||
| 176 | static const FunctionInfo functions[] = { | 175 | static const FunctionInfo functions[] = { |
| 177 | {0, &IAudioDevice::ListAudioDeviceName, "ListAudioDeviceName"}, | 176 | {0, &IAudioDevice::ListAudioDeviceName, "ListAudioDeviceName"}, |
| 178 | {1, &IAudioDevice::SetAudioDeviceOutputVolume, "SetAudioDeviceOutputVolume"}, | 177 | {1, &IAudioDevice::SetAudioDeviceOutputVolume, "SetAudioDeviceOutputVolume"}, |
| @@ -189,18 +188,6 @@ public: | |||
| 189 | {13, nullptr, "GetAudioSystemMasterVolumeSetting"}, | 188 | {13, nullptr, "GetAudioSystemMasterVolumeSetting"}, |
| 190 | }; | 189 | }; |
| 191 | RegisterHandlers(functions); | 190 | RegisterHandlers(functions); |
| 192 | |||
| 193 | Kernel::KAutoObject::Create(std::addressof(buffer_event)); | ||
| 194 | buffer_event.Initialize("IAudioOutBufferReleasedEvent"); | ||
| 195 | |||
| 196 | // Should be similar to audio_output_device_switch_event | ||
| 197 | Kernel::KAutoObject::Create(std::addressof(audio_input_device_switch_event)); | ||
| 198 | audio_input_device_switch_event.Initialize("IAudioDevice:AudioInputDeviceSwitchedEvent"); | ||
| 199 | |||
| 200 | // Should only be signalled when an audio output device has been changed, example: speaker | ||
| 201 | // to headset | ||
| 202 | Kernel::KAutoObject::Create(std::addressof(audio_output_device_switch_event)); | ||
| 203 | audio_output_device_switch_event.Initialize("IAudioDevice:AudioOutputDeviceSwitchedEvent"); | ||
| 204 | } | 191 | } |
| 205 | 192 | ||
| 206 | private: | 193 | private: |
| @@ -310,7 +297,7 @@ private: | |||
| 310 | 297 | ||
| 311 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 298 | IPC::ResponseBuilder rb{ctx, 2, 1}; |
| 312 | rb.Push(RESULT_SUCCESS); | 299 | rb.Push(RESULT_SUCCESS); |
| 313 | rb.PushCopyObjects(audio_input_device_switch_event.GetReadableEvent()); | 300 | rb.PushCopyObjects(buffer_event.GetReadableEvent()); |
| 314 | } | 301 | } |
| 315 | 302 | ||
| 316 | void QueryAudioDeviceOutputEvent(Kernel::HLERequestContext& ctx) { | 303 | void QueryAudioDeviceOutputEvent(Kernel::HLERequestContext& ctx) { |
| @@ -318,17 +305,16 @@ private: | |||
| 318 | 305 | ||
| 319 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 306 | IPC::ResponseBuilder rb{ctx, 2, 1}; |
| 320 | rb.Push(RESULT_SUCCESS); | 307 | rb.Push(RESULT_SUCCESS); |
| 321 | rb.PushCopyObjects(audio_output_device_switch_event.GetReadableEvent()); | 308 | rb.PushCopyObjects(buffer_event.GetReadableEvent()); |
| 322 | } | 309 | } |
| 323 | 310 | ||
| 311 | Kernel::KEvent& buffer_event; | ||
| 324 | u32_le revision = 0; | 312 | u32_le revision = 0; |
| 325 | Kernel::KEvent buffer_event; | 313 | }; |
| 326 | Kernel::KEvent audio_input_device_switch_event; | ||
| 327 | Kernel::KEvent audio_output_device_switch_event; | ||
| 328 | 314 | ||
| 329 | }; // namespace Audio | 315 | AudRenU::AudRenU(Core::System& system_) |
| 316 | : ServiceFramework{system_, "audren:u"}, buffer_event{system.Kernel()} { | ||
| 330 | 317 | ||
| 331 | AudRenU::AudRenU(Core::System& system_) : ServiceFramework{system_, "audren:u"} { | ||
| 332 | // clang-format off | 318 | // clang-format off |
| 333 | static const FunctionInfo functions[] = { | 319 | static const FunctionInfo functions[] = { |
| 334 | {0, &AudRenU::OpenAudioRenderer, "OpenAudioRenderer"}, | 320 | {0, &AudRenU::OpenAudioRenderer, "OpenAudioRenderer"}, |
| @@ -340,6 +326,9 @@ AudRenU::AudRenU(Core::System& system_) : ServiceFramework{system_, "audren:u"} | |||
| 340 | // clang-format on | 326 | // clang-format on |
| 341 | 327 | ||
| 342 | RegisterHandlers(functions); | 328 | RegisterHandlers(functions); |
| 329 | |||
| 330 | Kernel::KAutoObject::Create(std::addressof(buffer_event)); | ||
| 331 | buffer_event.Initialize("IAudioOutBufferReleasedEvent"); | ||
| 343 | } | 332 | } |
| 344 | 333 | ||
| 345 | AudRenU::~AudRenU() = default; | 334 | AudRenU::~AudRenU() = default; |
| @@ -662,7 +651,7 @@ void AudRenU::GetAudioDeviceService(Kernel::HLERequestContext& ctx) { | |||
| 662 | // always assumes the initial release revision (REV1). | 651 | // always assumes the initial release revision (REV1). |
| 663 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 652 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 664 | rb.Push(RESULT_SUCCESS); | 653 | rb.Push(RESULT_SUCCESS); |
| 665 | rb.PushIpcInterface<IAudioDevice>(system, Common::MakeMagic('R', 'E', 'V', '1')); | 654 | rb.PushIpcInterface<IAudioDevice>(system, buffer_event, Common::MakeMagic('R', 'E', 'V', '1')); |
| 666 | } | 655 | } |
| 667 | 656 | ||
| 668 | void AudRenU::OpenAudioRendererForManualExecution(Kernel::HLERequestContext& ctx) { | 657 | void AudRenU::OpenAudioRendererForManualExecution(Kernel::HLERequestContext& ctx) { |
| @@ -684,7 +673,7 @@ void AudRenU::GetAudioDeviceServiceWithRevisionInfo(Kernel::HLERequestContext& c | |||
| 684 | 673 | ||
| 685 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 674 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 686 | rb.Push(RESULT_SUCCESS); | 675 | rb.Push(RESULT_SUCCESS); |
| 687 | rb.PushIpcInterface<IAudioDevice>(system, revision); | 676 | rb.PushIpcInterface<IAudioDevice>(system, buffer_event, revision); |
| 688 | } | 677 | } |
| 689 | 678 | ||
| 690 | void AudRenU::OpenAudioRendererImpl(Kernel::HLERequestContext& ctx) { | 679 | void AudRenU::OpenAudioRendererImpl(Kernel::HLERequestContext& ctx) { |
diff --git a/src/core/hle/service/audio/audren_u.h b/src/core/hle/service/audio/audren_u.h index 37e8b4716..0ee6f9542 100644 --- a/src/core/hle/service/audio/audren_u.h +++ b/src/core/hle/service/audio/audren_u.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "core/hle/kernel/k_event.h" | ||
| 7 | #include "core/hle/service/service.h" | 8 | #include "core/hle/service/service.h" |
| 8 | 9 | ||
| 9 | namespace Core { | 10 | namespace Core { |
| @@ -31,6 +32,7 @@ private: | |||
| 31 | void OpenAudioRendererImpl(Kernel::HLERequestContext& ctx); | 32 | void OpenAudioRendererImpl(Kernel::HLERequestContext& ctx); |
| 32 | 33 | ||
| 33 | std::size_t audren_instance_count = 0; | 34 | std::size_t audren_instance_count = 0; |
| 35 | Kernel::KEvent buffer_event; | ||
| 34 | }; | 36 | }; |
| 35 | 37 | ||
| 36 | // Describes a particular audio feature that may be supported in a particular revision. | 38 | // Describes a particular audio feature that may be supported in a particular revision. |