diff options
| -rw-r--r-- | src/core/hle/service/audio/audin_u.cpp | 79 | ||||
| -rw-r--r-- | src/core/hle/service/audio/audin_u.h | 14 |
2 files changed, 67 insertions, 26 deletions
diff --git a/src/core/hle/service/audio/audin_u.cpp b/src/core/hle/service/audio/audin_u.cpp index 3e7fd6024..570525019 100644 --- a/src/core/hle/service/audio/audin_u.cpp +++ b/src/core/hle/service/audio/audin_u.cpp | |||
| @@ -3,38 +3,65 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/logging/log.h" | 5 | #include "common/logging/log.h" |
| 6 | #include "core/core.h" | ||
| 6 | #include "core/hle/ipc_helpers.h" | 7 | #include "core/hle/ipc_helpers.h" |
| 7 | #include "core/hle/kernel/hle_ipc.h" | 8 | #include "core/hle/kernel/hle_ipc.h" |
| 9 | #include "core/hle/kernel/k_event.h" | ||
| 8 | #include "core/hle/service/audio/audin_u.h" | 10 | #include "core/hle/service/audio/audin_u.h" |
| 9 | 11 | ||
| 10 | namespace Service::Audio { | 12 | namespace Service::Audio { |
| 11 | 13 | ||
| 12 | class IAudioIn final : public ServiceFramework<IAudioIn> { | 14 | IAudioIn::IAudioIn(Core::System& system_) |
| 13 | public: | 15 | : ServiceFramework{system_, "IAudioIn"}, buffer_event{system_.Kernel()} { |
| 14 | explicit IAudioIn(Core::System& system_) : ServiceFramework{system_, "IAudioIn"} { | 16 | // clang-format off |
| 15 | // clang-format off | 17 | static const FunctionInfo functions[] = { |
| 16 | static const FunctionInfo functions[] = { | 18 | {0, nullptr, "GetAudioInState"}, |
| 17 | {0, nullptr, "GetAudioInState"}, | 19 | {1, &IAudioIn::Start, "Start"}, |
| 18 | {1, nullptr, "Start"}, | 20 | {2, nullptr, "Stop"}, |
| 19 | {2, nullptr, "Stop"}, | 21 | {3, nullptr, "AppendAudioInBuffer"}, |
| 20 | {3, nullptr, "AppendAudioInBuffer"}, | 22 | {4, &IAudioIn::RegisterBufferEvent, "RegisterBufferEvent"}, |
| 21 | {4, nullptr, "RegisterBufferEvent"}, | 23 | {5, nullptr, "GetReleasedAudioInBuffer"}, |
| 22 | {5, nullptr, "GetReleasedAudioInBuffer"}, | 24 | {6, nullptr, "ContainsAudioInBuffer"}, |
| 23 | {6, nullptr, "ContainsAudioInBuffer"}, | 25 | {7, nullptr, "AppendUacInBuffer"}, |
| 24 | {7, nullptr, "AppendUacInBuffer"}, | 26 | {8, &IAudioIn::AppendAudioInBufferAuto, "AppendAudioInBufferAuto"}, |
| 25 | {8, nullptr, "AppendAudioInBufferAuto"}, | 27 | {9, nullptr, "GetReleasedAudioInBuffersAuto"}, |
| 26 | {9, nullptr, "GetReleasedAudioInBuffersAuto"}, | 28 | {10, nullptr, "AppendUacInBufferAuto"}, |
| 27 | {10, nullptr, "AppendUacInBufferAuto"}, | 29 | {11, nullptr, "GetAudioInBufferCount"}, |
| 28 | {11, nullptr, "GetAudioInBufferCount"}, | 30 | {12, nullptr, "SetDeviceGain"}, |
| 29 | {12, nullptr, "SetDeviceGain"}, | 31 | {13, nullptr, "GetDeviceGain"}, |
| 30 | {13, nullptr, "GetDeviceGain"}, | 32 | {14, nullptr, "FlushAudioInBuffers"}, |
| 31 | {14, nullptr, "FlushAudioInBuffers"}, | 33 | }; |
| 32 | }; | 34 | // clang-format on |
| 33 | // clang-format on | 35 | |
| 34 | 36 | RegisterHandlers(functions); | |
| 35 | RegisterHandlers(functions); | 37 | |
| 36 | } | 38 | Kernel::KAutoObject::Create(std::addressof(buffer_event)); |
| 37 | }; | 39 | buffer_event.Initialize("IAudioIn:BufferEvent"); |
| 40 | } | ||
| 41 | |||
| 42 | IAudioIn::~IAudioIn() = default; | ||
| 43 | |||
| 44 | void IAudioIn::Start(Kernel::HLERequestContext& ctx) { | ||
| 45 | LOG_WARNING(Service_Audio, "(STUBBED) called"); | ||
| 46 | |||
| 47 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 48 | rb.Push(ResultSuccess); | ||
| 49 | } | ||
| 50 | |||
| 51 | void IAudioIn::RegisterBufferEvent(Kernel::HLERequestContext& ctx) { | ||
| 52 | LOG_WARNING(Service_Audio, "(STUBBED) called"); | ||
| 53 | |||
| 54 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 55 | rb.Push(ResultSuccess); | ||
| 56 | rb.PushCopyObjects(buffer_event.GetReadableEvent()); | ||
| 57 | } | ||
| 58 | |||
| 59 | void IAudioIn::AppendAudioInBufferAuto(Kernel::HLERequestContext& ctx) { | ||
| 60 | LOG_WARNING(Service_Audio, "(STUBBED) called"); | ||
| 61 | |||
| 62 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 63 | rb.Push(ResultSuccess); | ||
| 64 | } | ||
| 38 | 65 | ||
| 39 | AudInU::AudInU(Core::System& system_) : ServiceFramework{system_, "audin:u"} { | 66 | AudInU::AudInU(Core::System& system_) : ServiceFramework{system_, "audin:u"} { |
| 40 | // clang-format off | 67 | // clang-format off |
diff --git a/src/core/hle/service/audio/audin_u.h b/src/core/hle/service/audio/audin_u.h index 0d75ae5ac..f2f7f9932 100644 --- a/src/core/hle/service/audio/audin_u.h +++ b/src/core/hle/service/audio/audin_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 { |
| @@ -16,6 +17,19 @@ class HLERequestContext; | |||
| 16 | 17 | ||
| 17 | namespace Service::Audio { | 18 | namespace Service::Audio { |
| 18 | 19 | ||
| 20 | class IAudioIn final : public ServiceFramework<IAudioIn> { | ||
| 21 | public: | ||
| 22 | explicit IAudioIn(Core::System& system_); | ||
| 23 | ~IAudioIn() override; | ||
| 24 | |||
| 25 | private: | ||
| 26 | void Start(Kernel::HLERequestContext& ctx); | ||
| 27 | void RegisterBufferEvent(Kernel::HLERequestContext& ctx); | ||
| 28 | void AppendAudioInBufferAuto(Kernel::HLERequestContext& ctx); | ||
| 29 | |||
| 30 | Kernel::KEvent buffer_event; | ||
| 31 | }; | ||
| 32 | |||
| 19 | class AudInU final : public ServiceFramework<AudInU> { | 33 | class AudInU final : public ServiceFramework<AudInU> { |
| 20 | public: | 34 | public: |
| 21 | explicit AudInU(Core::System& system_); | 35 | explicit AudInU(Core::System& system_); |