2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

audin_u: Return a buffer event in RegisterBufferEvent

Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com>
This commit is contained in:
lat9nq 2021-09-15 16:27:05 -04:00
parent 17b0955f9a
commit 7bc07195c5
2 changed files with 12 additions and 2 deletions

View file

@ -3,13 +3,16 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/core.h"
#include "core/hle/ipc_helpers.h" #include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/hle_ipc.h" #include "core/hle/kernel/hle_ipc.h"
#include "core/hle/kernel/k_event.h"
#include "core/hle/service/audio/audin_u.h" #include "core/hle/service/audio/audin_u.h"
namespace Service::Audio { namespace Service::Audio {
IAudioIn::IAudioIn(Core::System& system_) : ServiceFramework{system_, "IAudioIn"} { IAudioIn::IAudioIn(Core::System& system_)
: ServiceFramework{system_, "IAudioIn"}, buffer_event{system_.Kernel()} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetAudioInState"}, {0, nullptr, "GetAudioInState"},
@ -31,6 +34,9 @@ IAudioIn::IAudioIn(Core::System& system_) : ServiceFramework{system_, "IAudioIn"
// clang-format on // clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
Kernel::KAutoObject::Create(std::addressof(buffer_event));
buffer_event.Initialize("IAudioIn:BufferEvent");
} }
IAudioIn::~IAudioIn() = default; IAudioIn::~IAudioIn() = default;
@ -45,8 +51,9 @@ void IAudioIn::Start(Kernel::HLERequestContext& ctx) {
void IAudioIn::RegisterBufferEvent(Kernel::HLERequestContext& ctx) { void IAudioIn::RegisterBufferEvent(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
rb.PushCopyObjects(buffer_event.GetReadableEvent());
} }
void IAudioIn::AppendAudioInBufferAuto(Kernel::HLERequestContext& ctx) { void IAudioIn::AppendAudioInBufferAuto(Kernel::HLERequestContext& ctx) {

View file

@ -4,6 +4,7 @@
#pragma once #pragma once
#include "core/hle/kernel/k_event.h"
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core { namespace Core {
@ -25,6 +26,8 @@ private:
void Start(Kernel::HLERequestContext& ctx); void Start(Kernel::HLERequestContext& ctx);
void RegisterBufferEvent(Kernel::HLERequestContext& ctx); void RegisterBufferEvent(Kernel::HLERequestContext& ctx);
void AppendAudioInBufferAuto(Kernel::HLERequestContext& ctx); void AppendAudioInBufferAuto(Kernel::HLERequestContext& ctx);
Kernel::KEvent buffer_event;
}; };
class AudInU final : public ServiceFramework<AudInU> { class AudInU final : public ServiceFramework<AudInU> {