diff options
author | bunnei <bunneidev@gmail.com> | 2018-02-14 02:47:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-14 02:47:33 +0100 |
commit | 0a55eb588b55a10ca8c864bbc82423a40245283d (patch) | |
tree | e59b5ab87924bb29a5b1fd03936c3cfe6d01ad86 /src/core/hle | |
parent | Merge pull request #181 from bunnei/vi-fixes-2 (diff) | |
download | yuzu-0a55eb588b55a10ca8c864bbc82423a40245283d.tar yuzu-0a55eb588b55a10ca8c864bbc82423a40245283d.tar.gz yuzu-0a55eb588b55a10ca8c864bbc82423a40245283d.tar.bz2 yuzu-0a55eb588b55a10ca8c864bbc82423a40245283d.tar.lz yuzu-0a55eb588b55a10ca8c864bbc82423a40245283d.tar.xz yuzu-0a55eb588b55a10ca8c864bbc82423a40245283d.tar.zst yuzu-0a55eb588b55a10ca8c864bbc82423a40245283d.zip |
Diffstat (limited to 'src/core/hle')
-rw-r--r-- | src/core/hle/service/audio/audren_u.cpp | 41 | ||||
-rw-r--r-- | src/core/hle/service/audio/audren_u.h | 1 |
2 files changed, 36 insertions, 6 deletions
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 01f8ba4bb..c8d8ba748 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include "common/logging/log.h" +#include "core/core_timing.h" #include "core/hle/ipc_helpers.h" #include "core/hle/kernel/event.h" #include "core/hle/kernel/hle_ipc.h" @@ -11,6 +12,9 @@ namespace Service { namespace Audio { +/// TODO(bunnei): Find a proper value for the audio_ticks +constexpr u64 audio_ticks{static_cast<u64>(BASE_CLOCK_RATE / 200)}; + class IAudioRenderer final : public ServiceFramework<IAudioRenderer> { public: IAudioRenderer() : ServiceFramework("IAudioRenderer") { @@ -30,10 +34,24 @@ public: system_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "IAudioRenderer:SystemEvent"); + + // Register event callback to update the Audio Buffer + audio_event = CoreTiming::RegisterEvent( + "IAudioRenderer::UpdateAudioCallback", [this](u64 userdata, int cycles_late) { + UpdateAudioCallback(); + CoreTiming::ScheduleEvent(audio_ticks - cycles_late, audio_event); + }); + + // Start the audio event + CoreTiming::ScheduleEvent(audio_ticks, audio_event); } ~IAudioRenderer() = default; private: + void UpdateAudioCallback() { + system_event->Signal(); + } + void RequestUpdateAudioRenderer(Kernel::HLERequestContext& ctx) { AudioRendererResponseData response_data = {0}; @@ -126,15 +144,18 @@ private: static_assert(sizeof(AudioRendererResponseData) == 0x20e0, "AudioRendererResponseData has wrong size"); + /// This is used to trigger the audio event callback. + CoreTiming::EventType* audio_event; + Kernel::SharedPtr<Kernel::Event> system_event; }; AudRenU::AudRenU() : ServiceFramework("audren:u") { static const FunctionInfo functions[] = { - {0x00000000, &AudRenU::OpenAudioRenderer, "OpenAudioRenderer"}, - {0x00000001, &AudRenU::GetAudioRendererWorkBufferSize, "GetAudioRendererWorkBufferSize"}, - {0x00000002, nullptr, "GetAudioRenderersProcessMasterVolume"}, - {0x00000003, nullptr, "SetAudioRenderersProcessMasterVolume"}, + {0, &AudRenU::OpenAudioRenderer, "OpenAudioRenderer"}, + {1, &AudRenU::GetAudioRendererWorkBufferSize, "GetAudioRendererWorkBufferSize"}, + {2, &AudRenU::GetAudioRenderersProcessMasterVolume, "GetAudioRenderersProcessMasterVolume"}, + {3, nullptr, "SetAudioRenderersProcessMasterVolume"}, }; RegisterHandlers(functions); } @@ -152,9 +173,17 @@ void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 4}; rb.Push(RESULT_SUCCESS); - rb.Push<u64>(0x1000); + rb.Push<u64>(0x400); + + LOG_WARNING(Service_Audio, "(STUBBED) called"); +} + +void AudRenU::GetAudioRenderersProcessMasterVolume(Kernel::HLERequestContext& ctx) { + IPC::ResponseBuilder rb{ctx, 2}; + + rb.Push(RESULT_SUCCESS); - LOG_WARNING(Service_Audio, "called"); + LOG_WARNING(Service_Audio, "(STUBBED) called"); } } // namespace Audio diff --git a/src/core/hle/service/audio/audren_u.h b/src/core/hle/service/audio/audren_u.h index e97543742..939d353a9 100644 --- a/src/core/hle/service/audio/audren_u.h +++ b/src/core/hle/service/audio/audren_u.h @@ -21,6 +21,7 @@ public: private: void OpenAudioRenderer(Kernel::HLERequestContext& ctx); void GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx); + void GetAudioRenderersProcessMasterVolume(Kernel::HLERequestContext& ctx); }; } // namespace Audio |