summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2024-02-21 02:42:28 +0100
committerLiam <byteslice@airmail.cc>2024-02-21 04:15:38 +0100
commitea4703cb3111a21bc65588e3e01712b006f4d367 (patch)
tree3684c170810c59e9ba747802499d0a5605677f5d /src/core
parentaudio: rewrite IAudioRenderer (diff)
downloadyuzu-ea4703cb3111a21bc65588e3e01712b006f4d367.tar
yuzu-ea4703cb3111a21bc65588e3e01712b006f4d367.tar.gz
yuzu-ea4703cb3111a21bc65588e3e01712b006f4d367.tar.bz2
yuzu-ea4703cb3111a21bc65588e3e01712b006f4d367.tar.lz
yuzu-ea4703cb3111a21bc65588e3e01712b006f4d367.tar.xz
yuzu-ea4703cb3111a21bc65588e3e01712b006f4d367.tar.zst
yuzu-ea4703cb3111a21bc65588e3e01712b006f4d367.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/audio/audio_controller.cpp24
-rw-r--r--src/core/hle/service/audio/audio_in.cpp30
-rw-r--r--src/core/hle/service/audio/audio_in_manager.cpp12
-rw-r--r--src/core/hle/service/audio/audio_out.cpp28
-rw-r--r--src/core/hle/service/audio/audio_out_manager.cpp8
-rw-r--r--src/core/hle/service/audio/audio_renderer.cpp26
-rw-r--r--src/core/hle/service/audio/audio_renderer_manager.cpp8
-rw-r--r--src/core/hle/service/audio/hardware_opus_decoder.cpp4
-rw-r--r--src/core/hle/service/audio/hardware_opus_decoder.h4
-rw-r--r--src/core/hle/service/audio/hardware_opus_decoder_manager.cpp273
-rw-r--r--src/core/hle/service/audio/hardware_opus_decoder_manager.h45
11 files changed, 196 insertions, 266 deletions
diff --git a/src/core/hle/service/audio/audio_controller.cpp b/src/core/hle/service/audio/audio_controller.cpp
index a6da66d0f..d51c89118 100644
--- a/src/core/hle/service/audio/audio_controller.cpp
+++ b/src/core/hle/service/audio/audio_controller.cpp
@@ -16,23 +16,23 @@ IAudioController::IAudioController(Core::System& system_)
static const FunctionInfo functions[] = {
{0, nullptr, "GetTargetVolume"},
{1, nullptr, "SetTargetVolume"},
- {2, C<&IAudioController::GetTargetVolumeMin>, "GetTargetVolumeMin"},
- {3, C<&IAudioController::GetTargetVolumeMax>, "GetTargetVolumeMax"},
+ {2, D<&IAudioController::GetTargetVolumeMin>, "GetTargetVolumeMin"},
+ {3, D<&IAudioController::GetTargetVolumeMax>, "GetTargetVolumeMax"},
{4, nullptr, "IsTargetMute"},
{5, nullptr, "SetTargetMute"},
{6, nullptr, "IsTargetConnected"},
{7, nullptr, "SetDefaultTarget"},
{8, nullptr, "GetDefaultTarget"},
- {9, C<&IAudioController::GetAudioOutputMode>, "GetAudioOutputMode"},
- {10, C<&IAudioController::SetAudioOutputMode>, "SetAudioOutputMode"},
+ {9, D<&IAudioController::GetAudioOutputMode>, "GetAudioOutputMode"},
+ {10, D<&IAudioController::SetAudioOutputMode>, "SetAudioOutputMode"},
{11, nullptr, "SetForceMutePolicy"},
- {12, C<&IAudioController::GetForceMutePolicy>, "GetForceMutePolicy"},
- {13, C<&IAudioController::GetOutputModeSetting>, "GetOutputModeSetting"},
- {14, C<&IAudioController::SetOutputModeSetting>, "SetOutputModeSetting"},
+ {12, D<&IAudioController::GetForceMutePolicy>, "GetForceMutePolicy"},
+ {13, D<&IAudioController::GetOutputModeSetting>, "GetOutputModeSetting"},
+ {14, D<&IAudioController::SetOutputModeSetting>, "SetOutputModeSetting"},
{15, nullptr, "SetOutputTarget"},
{16, nullptr, "SetInputTargetForceEnabled"},
- {17, C<&IAudioController::SetHeadphoneOutputLevelMode>, "SetHeadphoneOutputLevelMode"},
- {18, C<&IAudioController::GetHeadphoneOutputLevelMode>, "GetHeadphoneOutputLevelMode"},
+ {17, D<&IAudioController::SetHeadphoneOutputLevelMode>, "SetHeadphoneOutputLevelMode"},
+ {18, D<&IAudioController::GetHeadphoneOutputLevelMode>, "GetHeadphoneOutputLevelMode"},
{19, nullptr, "AcquireAudioVolumeUpdateEventForPlayReport"},
{20, nullptr, "AcquireAudioOutputDeviceUpdateEventForPlayReport"},
{21, nullptr, "GetAudioOutputTargetForPlayReport"},
@@ -44,11 +44,11 @@ IAudioController::IAudioController(Core::System& system_)
{27, nullptr, "SetVolumeMappingTableForDev"},
{28, nullptr, "GetAudioOutputChannelCountForPlayReport"},
{29, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"},
- {30, C<&IAudioController::SetSpeakerAutoMuteEnabled>, "SetSpeakerAutoMuteEnabled"},
- {31, C<&IAudioController::IsSpeakerAutoMuteEnabled>, "IsSpeakerAutoMuteEnabled"},
+ {30, D<&IAudioController::SetSpeakerAutoMuteEnabled>, "SetSpeakerAutoMuteEnabled"},
+ {31, D<&IAudioController::IsSpeakerAutoMuteEnabled>, "IsSpeakerAutoMuteEnabled"},
{32, nullptr, "GetActiveOutputTarget"},
{33, nullptr, "GetTargetDeviceInfo"},
- {34, C<&IAudioController::AcquireTargetNotification>, "AcquireTargetNotification"},
+ {34, D<&IAudioController::AcquireTargetNotification>, "AcquireTargetNotification"},
{35, nullptr, "SetHearingProtectionSafeguardTimerRemainingTimeForDebug"},
{36, nullptr, "GetHearingProtectionSafeguardTimerRemainingTimeForDebug"},
{37, nullptr, "SetHearingProtectionSafeguardEnabled"},
diff --git a/src/core/hle/service/audio/audio_in.cpp b/src/core/hle/service/audio/audio_in.cpp
index 31d136077..9240cc336 100644
--- a/src/core/hle/service/audio/audio_in.cpp
+++ b/src/core/hle/service/audio/audio_in.cpp
@@ -16,21 +16,21 @@ IAudioIn::IAudioIn(Core::System& system_, Manager& manager, size_t session_id,
impl{std::make_shared<In>(system_, manager, event, session_id)} {
// clang-format off
static const FunctionInfo functions[] = {
- {0, C<&IAudioIn::GetAudioInState>, "GetAudioInState"},
- {1, C<&IAudioIn::Start>, "Start"},
- {2, C<&IAudioIn::Stop>, "Stop"},
- {3, C<&IAudioIn::AppendAudioInBuffer>, "AppendAudioInBuffer"},
- {4, C<&IAudioIn::RegisterBufferEvent>, "RegisterBufferEvent"},
- {5, C<&IAudioIn::GetReleasedAudioInBuffers>, "GetReleasedAudioInBuffers"},
- {6, C<&IAudioIn::ContainsAudioInBuffer>, "ContainsAudioInBuffer"},
- {7, C<&IAudioIn::AppendAudioInBuffer>, "AppendUacInBuffer"},
- {8, C<&IAudioIn::AppendAudioInBufferAuto>, "AppendAudioInBufferAuto"},
- {9, C<&IAudioIn::GetReleasedAudioInBuffersAuto>, "GetReleasedAudioInBuffersAuto"},
- {10, C<&IAudioIn::AppendAudioInBufferAuto>, "AppendUacInBufferAuto"},
- {11, C<&IAudioIn::GetAudioInBufferCount>, "GetAudioInBufferCount"},
- {12, C<&IAudioIn::SetDeviceGain>, "SetDeviceGain"},
- {13, C<&IAudioIn::GetDeviceGain>, "GetDeviceGain"},
- {14, C<&IAudioIn::FlushAudioInBuffers>, "FlushAudioInBuffers"},
+ {0, D<&IAudioIn::GetAudioInState>, "GetAudioInState"},
+ {1, D<&IAudioIn::Start>, "Start"},
+ {2, D<&IAudioIn::Stop>, "Stop"},
+ {3, D<&IAudioIn::AppendAudioInBuffer>, "AppendAudioInBuffer"},
+ {4, D<&IAudioIn::RegisterBufferEvent>, "RegisterBufferEvent"},
+ {5, D<&IAudioIn::GetReleasedAudioInBuffers>, "GetReleasedAudioInBuffers"},
+ {6, D<&IAudioIn::ContainsAudioInBuffer>, "ContainsAudioInBuffer"},
+ {7, D<&IAudioIn::AppendAudioInBuffer>, "AppendUacInBuffer"},
+ {8, D<&IAudioIn::AppendAudioInBufferAuto>, "AppendAudioInBufferAuto"},
+ {9, D<&IAudioIn::GetReleasedAudioInBuffersAuto>, "GetReleasedAudioInBuffersAuto"},
+ {10, D<&IAudioIn::AppendAudioInBufferAuto>, "AppendUacInBufferAuto"},
+ {11, D<&IAudioIn::GetAudioInBufferCount>, "GetAudioInBufferCount"},
+ {12, D<&IAudioIn::SetDeviceGain>, "SetDeviceGain"},
+ {13, D<&IAudioIn::GetDeviceGain>, "GetDeviceGain"},
+ {14, D<&IAudioIn::FlushAudioInBuffers>, "FlushAudioInBuffers"},
};
// clang-format on
diff --git a/src/core/hle/service/audio/audio_in_manager.cpp b/src/core/hle/service/audio/audio_in_manager.cpp
index 0379a2f68..9b67af367 100644
--- a/src/core/hle/service/audio/audio_in_manager.cpp
+++ b/src/core/hle/service/audio/audio_in_manager.cpp
@@ -14,12 +14,12 @@ IAudioInManager::IAudioInManager(Core::System& system_)
impl{std::make_unique<AudioCore::AudioIn::Manager>(system_)} {
// clang-format off
static const FunctionInfo functions[] = {
- {0, C<&IAudioInManager::ListAudioIns>, "ListAudioIns"},
- {1, C<&IAudioInManager::OpenAudioIn>, "OpenAudioIn"},
- {2, C<&IAudioInManager::ListAudioIns>, "ListAudioInsAuto"},
- {3, C<&IAudioInManager::OpenAudioIn>, "OpenAudioInAuto"},
- {4, C<&IAudioInManager::ListAudioInsAutoFiltered>, "ListAudioInsAutoFiltered"},
- {5, C<&IAudioInManager::OpenAudioInProtocolSpecified>, "OpenAudioInProtocolSpecified"},
+ {0, D<&IAudioInManager::ListAudioIns>, "ListAudioIns"},
+ {1, D<&IAudioInManager::OpenAudioIn>, "OpenAudioIn"},
+ {2, D<&IAudioInManager::ListAudioIns>, "ListAudioInsAuto"},
+ {3, D<&IAudioInManager::OpenAudioIn>, "OpenAudioInAuto"},
+ {4, D<&IAudioInManager::ListAudioInsAutoFiltered>, "ListAudioInsAutoFiltered"},
+ {5, D<&IAudioInManager::OpenAudioInProtocolSpecified>, "OpenAudioInProtocolSpecified"},
};
// clang-format on
diff --git a/src/core/hle/service/audio/audio_out.cpp b/src/core/hle/service/audio/audio_out.cpp
index cd2dc1f6f..53009d5d7 100644
--- a/src/core/hle/service/audio/audio_out.cpp
+++ b/src/core/hle/service/audio/audio_out.cpp
@@ -21,20 +21,20 @@ IAudioOut::IAudioOut(Core::System& system_, Manager& manager, size_t session_id,
// clang-format off
static const FunctionInfo functions[] = {
- {0, C<&IAudioOut::GetAudioOutState>, "GetAudioOutState"},
- {1, C<&IAudioOut::Start>, "Start"},
- {2, C<&IAudioOut::Stop>, "Stop"},
- {3, C<&IAudioOut::AppendAudioOutBuffer>, "AppendAudioOutBuffer"},
- {4, C<&IAudioOut::RegisterBufferEvent>, "RegisterBufferEvent"},
- {5, C<&IAudioOut::GetReleasedAudioOutBuffers>, "GetReleasedAudioOutBuffers"},
- {6, C<&IAudioOut::ContainsAudioOutBuffer>, "ContainsAudioOutBuffer"},
- {7, C<&IAudioOut::AppendAudioOutBufferAuto>, "AppendAudioOutBufferAuto"},
- {8, C<&IAudioOut::GetReleasedAudioOutBuffersAuto>, "GetReleasedAudioOutBuffersAuto"},
- {9, C<&IAudioOut::GetAudioOutBufferCount>, "GetAudioOutBufferCount"},
- {10, C<&IAudioOut::GetAudioOutPlayedSampleCount>, "GetAudioOutPlayedSampleCount"},
- {11, C<&IAudioOut::FlushAudioOutBuffers>, "FlushAudioOutBuffers"},
- {12, C<&IAudioOut::SetAudioOutVolume>, "SetAudioOutVolume"},
- {13, C<&IAudioOut::GetAudioOutVolume>, "GetAudioOutVolume"},
+ {0, D<&IAudioOut::GetAudioOutState>, "GetAudioOutState"},
+ {1, D<&IAudioOut::Start>, "Start"},
+ {2, D<&IAudioOut::Stop>, "Stop"},
+ {3, D<&IAudioOut::AppendAudioOutBuffer>, "AppendAudioOutBuffer"},
+ {4, D<&IAudioOut::RegisterBufferEvent>, "RegisterBufferEvent"},
+ {5, D<&IAudioOut::GetReleasedAudioOutBuffers>, "GetReleasedAudioOutBuffers"},
+ {6, D<&IAudioOut::ContainsAudioOutBuffer>, "ContainsAudioOutBuffer"},
+ {7, D<&IAudioOut::AppendAudioOutBufferAuto>, "AppendAudioOutBufferAuto"},
+ {8, D<&IAudioOut::GetReleasedAudioOutBuffersAuto>, "GetReleasedAudioOutBuffersAuto"},
+ {9, D<&IAudioOut::GetAudioOutBufferCount>, "GetAudioOutBufferCount"},
+ {10, D<&IAudioOut::GetAudioOutPlayedSampleCount>, "GetAudioOutPlayedSampleCount"},
+ {11, D<&IAudioOut::FlushAudioOutBuffers>, "FlushAudioOutBuffers"},
+ {12, D<&IAudioOut::SetAudioOutVolume>, "SetAudioOutVolume"},
+ {13, D<&IAudioOut::GetAudioOutVolume>, "GetAudioOutVolume"},
};
// clang-format on
RegisterHandlers(functions);
diff --git a/src/core/hle/service/audio/audio_out_manager.cpp b/src/core/hle/service/audio/audio_out_manager.cpp
index 89cd6df94..780e1dcda 100644
--- a/src/core/hle/service/audio/audio_out_manager.cpp
+++ b/src/core/hle/service/audio/audio_out_manager.cpp
@@ -14,10 +14,10 @@ IAudioOutManager::IAudioOutManager(Core::System& system_)
: ServiceFramework{system_, "audout:u"}, impl{std::make_unique<Manager>(system_)} {
// clang-format off
static const FunctionInfo functions[] = {
- {0, C<&IAudioOutManager::ListAudioOuts>, "ListAudioOuts"},
- {1, C<&IAudioOutManager::OpenAudioOut>, "OpenAudioOut"},
- {2, C<&IAudioOutManager::ListAudioOutsAuto>, "ListAudioOutsAuto"},
- {3, C<&IAudioOutManager::OpenAudioOutAuto>, "OpenAudioOutAuto"},
+ {0, D<&IAudioOutManager::ListAudioOuts>, "ListAudioOuts"},
+ {1, D<&IAudioOutManager::OpenAudioOut>, "OpenAudioOut"},
+ {2, D<&IAudioOutManager::ListAudioOutsAuto>, "ListAudioOutsAuto"},
+ {3, D<&IAudioOutManager::OpenAudioOutAuto>, "OpenAudioOutAuto"},
};
// clang-format on
diff --git a/src/core/hle/service/audio/audio_renderer.cpp b/src/core/hle/service/audio/audio_renderer.cpp
index fc20054b4..b78660cea 100644
--- a/src/core/hle/service/audio/audio_renderer.cpp
+++ b/src/core/hle/service/audio/audio_renderer.cpp
@@ -18,20 +18,20 @@ IAudioRenderer::IAudioRenderer(Core::System& system_, Manager& manager_,
process_handle{process_handle_} {
// clang-format off
static const FunctionInfo functions[] = {
- {0, C<&IAudioRenderer::GetSampleRate>, "GetSampleRate"},
- {1, C<&IAudioRenderer::GetSampleCount>, "GetSampleCount"},
- {2, C<&IAudioRenderer::GetMixBufferCount>, "GetMixBufferCount"},
- {3, C<&IAudioRenderer::GetState>, "GetState"},
- {4, C<&IAudioRenderer::RequestUpdate>, "RequestUpdate"},
- {5, C<&IAudioRenderer::Start>, "Start"},
- {6, C<&IAudioRenderer::Stop>, "Stop"},
- {7, C<&IAudioRenderer::QuerySystemEvent>, "QuerySystemEvent"},
- {8, C<&IAudioRenderer::SetRenderingTimeLimit>, "SetRenderingTimeLimit"},
- {9, C<&IAudioRenderer::GetRenderingTimeLimit>, "GetRenderingTimeLimit"},
- {10, C<&IAudioRenderer::RequestUpdateAuto>, "RequestUpdateAuto"},
+ {0, D<&IAudioRenderer::GetSampleRate>, "GetSampleRate"},
+ {1, D<&IAudioRenderer::GetSampleCount>, "GetSampleCount"},
+ {2, D<&IAudioRenderer::GetMixBufferCount>, "GetMixBufferCount"},
+ {3, D<&IAudioRenderer::GetState>, "GetState"},
+ {4, D<&IAudioRenderer::RequestUpdate>, "RequestUpdate"},
+ {5, D<&IAudioRenderer::Start>, "Start"},
+ {6, D<&IAudioRenderer::Stop>, "Stop"},
+ {7, D<&IAudioRenderer::QuerySystemEvent>, "QuerySystemEvent"},
+ {8, D<&IAudioRenderer::SetRenderingTimeLimit>, "SetRenderingTimeLimit"},
+ {9, D<&IAudioRenderer::GetRenderingTimeLimit>, "GetRenderingTimeLimit"},
+ {10, D<&IAudioRenderer::RequestUpdateAuto>, "RequestUpdateAuto"},
{11, nullptr, "ExecuteAudioRendererRendering"},
- {12, C<&IAudioRenderer::SetVoiceDropParameter>, "SetVoiceDropParameter"},
- {13, C<&IAudioRenderer::GetVoiceDropParameter>, "GetVoiceDropParameter"},
+ {12, D<&IAudioRenderer::SetVoiceDropParameter>, "SetVoiceDropParameter"},
+ {13, D<&IAudioRenderer::GetVoiceDropParameter>, "GetVoiceDropParameter"},
};
// clang-format on
RegisterHandlers(functions);
diff --git a/src/core/hle/service/audio/audio_renderer_manager.cpp b/src/core/hle/service/audio/audio_renderer_manager.cpp
index 3129169a4..6a1345c07 100644
--- a/src/core/hle/service/audio/audio_renderer_manager.cpp
+++ b/src/core/hle/service/audio/audio_renderer_manager.cpp
@@ -18,11 +18,11 @@ IAudioRendererManager::IAudioRendererManager(Core::System& system_)
: ServiceFramework{system_, "audren:u"}, impl{std::make_unique<Manager>(system_)} {
// clang-format off
static const FunctionInfo functions[] = {
- {0, C<&IAudioRendererManager::OpenAudioRenderer>, "OpenAudioRenderer"},
- {1, C<&IAudioRendererManager::GetWorkBufferSize>, "GetWorkBufferSize"},
- {2, C<&IAudioRendererManager::GetAudioDeviceService>, "GetAudioDeviceService"},
+ {0, D<&IAudioRendererManager::OpenAudioRenderer>, "OpenAudioRenderer"},
+ {1, D<&IAudioRendererManager::GetWorkBufferSize>, "GetWorkBufferSize"},
+ {2, D<&IAudioRendererManager::GetAudioDeviceService>, "GetAudioDeviceService"},
{3, nullptr, "OpenAudioRendererForManualExecution"},
- {4, C<&IAudioRendererManager::GetAudioDeviceServiceWithRevisionInfo>, "GetAudioDeviceServiceWithRevisionInfo"},
+ {4, D<&IAudioRendererManager::GetAudioDeviceServiceWithRevisionInfo>, "GetAudioDeviceServiceWithRevisionInfo"},
};
// clang-format on
diff --git a/src/core/hle/service/audio/hardware_opus_decoder.cpp b/src/core/hle/service/audio/hardware_opus_decoder.cpp
index 876bfe334..e398511a6 100644
--- a/src/core/hle/service/audio/hardware_opus_decoder.cpp
+++ b/src/core/hle/service/audio/hardware_opus_decoder.cpp
@@ -31,13 +31,13 @@ IHardwareOpusDecoder::IHardwareOpusDecoder(Core::System& system_, HardwareOpus&
IHardwareOpusDecoder::~IHardwareOpusDecoder() = default;
-Result IHardwareOpusDecoder::Initialize(OpusParametersEx& params,
+Result IHardwareOpusDecoder::Initialize(const OpusParametersEx& params,
Kernel::KTransferMemory* transfer_memory,
u64 transfer_memory_size) {
return impl->Initialize(params, transfer_memory, transfer_memory_size);
}
-Result IHardwareOpusDecoder::Initialize(OpusMultiStreamParametersEx& params,
+Result IHardwareOpusDecoder::Initialize(const OpusMultiStreamParametersEx& params,
Kernel::KTransferMemory* transfer_memory,
u64 transfer_memory_size) {
return impl->Initialize(params, transfer_memory, transfer_memory_size);
diff --git a/src/core/hle/service/audio/hardware_opus_decoder.h b/src/core/hle/service/audio/hardware_opus_decoder.h
index fe6636ce6..121858a6f 100644
--- a/src/core/hle/service/audio/hardware_opus_decoder.h
+++ b/src/core/hle/service/audio/hardware_opus_decoder.h
@@ -14,9 +14,9 @@ public:
AudioCore::OpusDecoder::HardwareOpus& hardware_opus);
~IHardwareOpusDecoder() override;
- Result Initialize(AudioCore::OpusDecoder::OpusParametersEx& params,
+ Result Initialize(const AudioCore::OpusDecoder::OpusParametersEx& params,
Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size);
- Result Initialize(AudioCore::OpusDecoder::OpusMultiStreamParametersEx& params,
+ Result Initialize(const AudioCore::OpusDecoder::OpusMultiStreamParametersEx& params,
Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size);
private:
diff --git a/src/core/hle/service/audio/hardware_opus_decoder_manager.cpp b/src/core/hle/service/audio/hardware_opus_decoder_manager.cpp
index 6d7205cd2..9de72e30f 100644
--- a/src/core/hle/service/audio/hardware_opus_decoder_manager.cpp
+++ b/src/core/hle/service/audio/hardware_opus_decoder_manager.cpp
@@ -3,241 +3,154 @@
#include "core/hle/service/audio/hardware_opus_decoder.h"
#include "core/hle/service/audio/hardware_opus_decoder_manager.h"
-#include "core/hle/service/ipc_helpers.h"
+#include "core/hle/service/cmif_serialization.h"
namespace Service::Audio {
using namespace AudioCore::OpusDecoder;
-void IHardwareOpusDecoderManager::OpenHardwareOpusDecoder(HLERequestContext& ctx) {
- IPC::RequestParser rp{ctx};
+IHardwareOpusDecoderManager::IHardwareOpusDecoderManager(Core::System& system_)
+ : ServiceFramework{system_, "hwopus"}, system{system_}, impl{system} {
+ // clang-format off
+ static const FunctionInfo functions[] = {
+ {0, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoder>, "OpenHardwareOpusDecoder"},
+ {1, D<&IHardwareOpusDecoderManager::GetWorkBufferSize>, "GetWorkBufferSize"},
+ {2, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoderForMultiStream>, "OpenOpusDecoderForMultiStream"},
+ {3, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStream>, "GetWorkBufferSizeForMultiStream"},
+ {4, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoderEx>, "OpenHardwareOpusDecoderEx"},
+ {5, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeEx>, "GetWorkBufferSizeEx"},
+ {6, D<&IHardwareOpusDecoderManager::OpenHardwareOpusDecoderForMultiStreamEx>, "OpenHardwareOpusDecoderForMultiStreamEx"},
+ {7, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStreamEx>, "GetWorkBufferSizeForMultiStreamEx"},
+ {8, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeExEx>, "GetWorkBufferSizeExEx"},
+ {9, D<&IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStreamExEx>, "GetWorkBufferSizeForMultiStreamExEx"},
+ };
+ // clang-format on
+ RegisterHandlers(functions);
+}
- auto params = rp.PopRaw<OpusParameters>();
- auto transfer_memory_size{rp.Pop<u32>()};
- auto transfer_memory_handle{ctx.GetCopyHandle(0)};
- auto transfer_memory{ctx.GetObjectFromHandle<Kernel::KTransferMemory>(transfer_memory_handle)};
+IHardwareOpusDecoderManager::~IHardwareOpusDecoderManager() = default;
- LOG_DEBUG(Service_Audio, "sample_rate {} channel_count {} transfer_memory_size 0x{:X}",
- params.sample_rate, params.channel_count, transfer_memory_size);
+Result IHardwareOpusDecoderManager::OpenHardwareOpusDecoder(
+ Out<SharedPointer<IHardwareOpusDecoder>> out_decoder, OpusParameters params, u32 tmem_size,
+ InCopyHandle<Kernel::KTransferMemory> tmem_handle) {
+ LOG_DEBUG(Service_Audio, "sample_rate {} channel_count {} transfer_memory_size {:#x}",
+ params.sample_rate, params.channel_count, tmem_size);
auto decoder{std::make_shared<IHardwareOpusDecoder>(system, impl.GetHardwareOpus())};
-
OpusParametersEx ex{
.sample_rate = params.sample_rate,
.channel_count = params.channel_count,
.use_large_frame_size = false,
};
- auto result = decoder->Initialize(ex, transfer_memory.GetPointerUnsafe(), transfer_memory_size);
+ R_TRY(decoder->Initialize(ex, tmem_handle.Get(), tmem_size));
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(result);
- rb.PushIpcInterface(decoder);
+ *out_decoder = decoder;
+ R_SUCCEED();
}
-void IHardwareOpusDecoderManager::GetWorkBufferSize(HLERequestContext& ctx) {
- IPC::RequestParser rp{ctx};
- auto params = rp.PopRaw<OpusParameters>();
-
- u64 size{};
- auto result = impl.GetWorkBufferSize(params, size);
-
- LOG_DEBUG(Service_Audio, "sample_rate {} channel_count {} -- returned size 0x{:X}",
- params.sample_rate, params.channel_count, size);
-
- IPC::ResponseBuilder rb{ctx, 4};
- rb.Push(result);
- rb.Push(size);
+Result IHardwareOpusDecoderManager::GetWorkBufferSize(Out<u32> out_size, OpusParameters params) {
+ R_TRY(impl.GetWorkBufferSize(params, *out_size));
+ LOG_DEBUG(Service_Audio, "sample_rate {} channel_count {} -- returned size {:#x}",
+ params.sample_rate, params.channel_count, *out_size);
+ R_SUCCEED();
}
-void IHardwareOpusDecoderManager::OpenHardwareOpusDecoderForMultiStream(HLERequestContext& ctx) {
- IPC::RequestParser rp{ctx};
-
- auto input{ctx.ReadBuffer()};
- OpusMultiStreamParameters params;
- std::memcpy(&params, input.data(), sizeof(OpusMultiStreamParameters));
-
- auto transfer_memory_size{rp.Pop<u32>()};
- auto transfer_memory_handle{ctx.GetCopyHandle(0)};
- auto transfer_memory{ctx.GetObjectFromHandle<Kernel::KTransferMemory>(transfer_memory_handle)};
-
+Result IHardwareOpusDecoderManager::OpenHardwareOpusDecoderForMultiStream(
+ Out<SharedPointer<IHardwareOpusDecoder>> out_decoder,
+ InLargeData<OpusMultiStreamParameters, BufferAttr_HipcPointer> params, u32 tmem_size,
+ InCopyHandle<Kernel::KTransferMemory> tmem_handle) {
LOG_DEBUG(Service_Audio,
"sample_rate {} channel_count {} total_stream_count {} stereo_stream_count {} "
- "transfer_memory_size 0x{:X}",
- params.sample_rate, params.channel_count, params.total_stream_count,
- params.stereo_stream_count, transfer_memory_size);
+ "transfer_memory_size {:#x}",
+ params->sample_rate, params->channel_count, params->total_stream_count,
+ params->stereo_stream_count, tmem_size);
auto decoder{std::make_shared<IHardwareOpusDecoder>(system, impl.GetHardwareOpus())};
OpusMultiStreamParametersEx ex{
- .sample_rate = params.sample_rate,
- .channel_count = params.channel_count,
- .total_stream_count = params.total_stream_count,
- .stereo_stream_count = params.stereo_stream_count,
+ .sample_rate = params->sample_rate,
+ .channel_count = params->channel_count,
+ .total_stream_count = params->total_stream_count,
+ .stereo_stream_count = params->stereo_stream_count,
.use_large_frame_size = false,
.mappings{},
};
- std::memcpy(ex.mappings.data(), params.mappings.data(), sizeof(params.mappings));
- auto result = decoder->Initialize(ex, transfer_memory.GetPointerUnsafe(), transfer_memory_size);
+ std::memcpy(ex.mappings.data(), params->mappings.data(), sizeof(params->mappings));
+ R_TRY(decoder->Initialize(ex, tmem_handle.Get(), tmem_size));
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(result);
- rb.PushIpcInterface(decoder);
+ *out_decoder = decoder;
+ R_SUCCEED();
}
-void IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStream(HLERequestContext& ctx) {
- IPC::RequestParser rp{ctx};
-
- auto input{ctx.ReadBuffer()};
- OpusMultiStreamParameters params;
- std::memcpy(&params, input.data(), sizeof(OpusMultiStreamParameters));
-
- u64 size{};
- auto result = impl.GetWorkBufferSizeForMultiStream(params, size);
-
- LOG_DEBUG(Service_Audio, "size 0x{:X}", size);
-
- IPC::ResponseBuilder rb{ctx, 4};
- rb.Push(result);
- rb.Push(size);
+Result IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStream(
+ Out<u32> out_size, InLargeData<OpusMultiStreamParameters, BufferAttr_HipcPointer> params) {
+ R_TRY(impl.GetWorkBufferSizeForMultiStream(*params, *out_size));
+ LOG_DEBUG(Service_Audio, "size {:#x}", *out_size);
+ R_SUCCEED();
}
-void IHardwareOpusDecoderManager::OpenHardwareOpusDecoderEx(HLERequestContext& ctx) {
- IPC::RequestParser rp{ctx};
-
- auto params = rp.PopRaw<OpusParametersEx>();
- auto transfer_memory_size{rp.Pop<u32>()};
- auto transfer_memory_handle{ctx.GetCopyHandle(0)};
- auto transfer_memory{ctx.GetObjectFromHandle<Kernel::KTransferMemory>(transfer_memory_handle)};
-
- LOG_DEBUG(Service_Audio, "sample_rate {} channel_count {} transfer_memory_size 0x{:X}",
- params.sample_rate, params.channel_count, transfer_memory_size);
+Result IHardwareOpusDecoderManager::OpenHardwareOpusDecoderEx(
+ Out<SharedPointer<IHardwareOpusDecoder>> out_decoder, OpusParametersEx params, u32 tmem_size,
+ InCopyHandle<Kernel::KTransferMemory> tmem_handle) {
+ LOG_DEBUG(Service_Audio, "sample_rate {} channel_count {} transfer_memory_size {:#x}",
+ params.sample_rate, params.channel_count, tmem_size);
auto decoder{std::make_shared<IHardwareOpusDecoder>(system, impl.GetHardwareOpus())};
+ R_TRY(decoder->Initialize(params, tmem_handle.Get(), tmem_size));
- auto result =
- decoder->Initialize(params, transfer_memory.GetPointerUnsafe(), transfer_memory_size);
-
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(result);
- rb.PushIpcInterface(decoder);
+ *out_decoder = decoder;
+ R_SUCCEED();
}
-void IHardwareOpusDecoderManager::GetWorkBufferSizeEx(HLERequestContext& ctx) {
- IPC::RequestParser rp{ctx};
- auto params = rp.PopRaw<OpusParametersEx>();
-
- u64 size{};
- auto result = impl.GetWorkBufferSizeEx(params, size);
-
- LOG_DEBUG(Service_Audio, "size 0x{:X}", size);
-
- IPC::ResponseBuilder rb{ctx, 4};
- rb.Push(result);
- rb.Push(size);
+Result IHardwareOpusDecoderManager::GetWorkBufferSizeEx(Out<u32> out_size,
+ OpusParametersEx params) {
+ R_TRY(impl.GetWorkBufferSizeEx(params, *out_size));
+ LOG_DEBUG(Service_Audio, "size {:#x}", *out_size);
+ R_SUCCEED();
}
-void IHardwareOpusDecoderManager::OpenHardwareOpusDecoderForMultiStreamEx(HLERequestContext& ctx) {
- IPC::RequestParser rp{ctx};
-
- auto input{ctx.ReadBuffer()};
- OpusMultiStreamParametersEx params;
- std::memcpy(&params, input.data(), sizeof(OpusMultiStreamParametersEx));
-
- auto transfer_memory_size{rp.Pop<u32>()};
- auto transfer_memory_handle{ctx.GetCopyHandle(0)};
- auto transfer_memory{ctx.GetObjectFromHandle<Kernel::KTransferMemory>(transfer_memory_handle)};
-
+Result IHardwareOpusDecoderManager::OpenHardwareOpusDecoderForMultiStreamEx(
+ Out<SharedPointer<IHardwareOpusDecoder>> out_decoder,
+ InLargeData<OpusMultiStreamParametersEx, BufferAttr_HipcPointer> params, u32 tmem_size,
+ InCopyHandle<Kernel::KTransferMemory> tmem_handle) {
LOG_DEBUG(Service_Audio,
"sample_rate {} channel_count {} total_stream_count {} stereo_stream_count {} "
"use_large_frame_size {}"
- "transfer_memory_size 0x{:X}",
- params.sample_rate, params.channel_count, params.total_stream_count,
- params.stereo_stream_count, params.use_large_frame_size, transfer_memory_size);
+ "transfer_memory_size {:#x}",
+ params->sample_rate, params->channel_count, params->total_stream_count,
+ params->stereo_stream_count, params->use_large_frame_size, tmem_size);
auto decoder{std::make_shared<IHardwareOpusDecoder>(system, impl.GetHardwareOpus())};
- auto result =
- decoder->Initialize(params, transfer_memory.GetPointerUnsafe(), transfer_memory_size);
+ R_TRY(decoder->Initialize(*params, tmem_handle.Get(), tmem_size));
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(result);
- rb.PushIpcInterface(decoder);
+ *out_decoder = decoder;
+ R_SUCCEED();
}
-void IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStreamEx(HLERequestContext& ctx) {
- IPC::RequestParser rp{ctx};
-
- auto input{ctx.ReadBuffer()};
- OpusMultiStreamParametersEx params;
- std::memcpy(&params, input.data(), sizeof(OpusMultiStreamParametersEx));
-
- u64 size{};
- auto result = impl.GetWorkBufferSizeForMultiStreamEx(params, size);
-
+Result IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStreamEx(
+ Out<u32> out_size, InLargeData<OpusMultiStreamParametersEx, BufferAttr_HipcPointer> params) {
+ R_TRY(impl.GetWorkBufferSizeForMultiStreamEx(*params, *out_size));
LOG_DEBUG(Service_Audio,
"sample_rate {} channel_count {} total_stream_count {} stereo_stream_count {} "
- "use_large_frame_size {} -- returned size 0x{:X}",
- params.sample_rate, params.channel_count, params.total_stream_count,
- params.stereo_stream_count, params.use_large_frame_size, size);
-
- IPC::ResponseBuilder rb{ctx, 4};
- rb.Push(result);
- rb.Push(size);
-}
-
-void IHardwareOpusDecoderManager::GetWorkBufferSizeExEx(HLERequestContext& ctx) {
- IPC::RequestParser rp{ctx};
- auto params = rp.PopRaw<OpusParametersEx>();
-
- u64 size{};
- auto result = impl.GetWorkBufferSizeExEx(params, size);
-
- LOG_DEBUG(Service_Audio, "size 0x{:X}", size);
-
- IPC::ResponseBuilder rb{ctx, 4};
- rb.Push(result);
- rb.Push(size);
+ "use_large_frame_size {} -- returned size {:#x}",
+ params->sample_rate, params->channel_count, params->total_stream_count,
+ params->stereo_stream_count, params->use_large_frame_size, *out_size);
+ R_SUCCEED();
}
-void IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStreamExEx(HLERequestContext& ctx) {
- IPC::RequestParser rp{ctx};
-
- auto input{ctx.ReadBuffer()};
- OpusMultiStreamParametersEx params;
- std::memcpy(&params, input.data(), sizeof(OpusMultiStreamParametersEx));
-
- u64 size{};
- auto result = impl.GetWorkBufferSizeForMultiStreamExEx(params, size);
-
- LOG_DEBUG(Service_Audio, "size 0x{:X}", size);
-
- IPC::ResponseBuilder rb{ctx, 4};
- rb.Push(result);
- rb.Push(size);
+Result IHardwareOpusDecoderManager::GetWorkBufferSizeExEx(Out<u32> out_size,
+ OpusParametersEx params) {
+ R_TRY(impl.GetWorkBufferSizeExEx(params, *out_size));
+ LOG_DEBUG(Service_Audio, "size {:#x}", *out_size);
+ R_SUCCEED();
}
-IHardwareOpusDecoderManager::IHardwareOpusDecoderManager(Core::System& system_)
- : ServiceFramework{system_, "hwopus"}, system{system_}, impl{system} {
- static const FunctionInfo functions[] = {
- {0, &IHardwareOpusDecoderManager::OpenHardwareOpusDecoder, "OpenHardwareOpusDecoder"},
- {1, &IHardwareOpusDecoderManager::GetWorkBufferSize, "GetWorkBufferSize"},
- {2, &IHardwareOpusDecoderManager::OpenHardwareOpusDecoderForMultiStream,
- "OpenOpusDecoderForMultiStream"},
- {3, &IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStream,
- "GetWorkBufferSizeForMultiStream"},
- {4, &IHardwareOpusDecoderManager::OpenHardwareOpusDecoderEx, "OpenHardwareOpusDecoderEx"},
- {5, &IHardwareOpusDecoderManager::GetWorkBufferSizeEx, "GetWorkBufferSizeEx"},
- {6, &IHardwareOpusDecoderManager::OpenHardwareOpusDecoderForMultiStreamEx,
- "OpenHardwareOpusDecoderForMultiStreamEx"},
- {7, &IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStreamEx,
- "GetWorkBufferSizeForMultiStreamEx"},
- {8, &IHardwareOpusDecoderManager::GetWorkBufferSizeExEx, "GetWorkBufferSizeExEx"},
- {9, &IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStreamExEx,
- "GetWorkBufferSizeForMultiStreamExEx"},
- };
- RegisterHandlers(functions);
+Result IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStreamExEx(
+ Out<u32> out_size, InLargeData<OpusMultiStreamParametersEx, BufferAttr_HipcPointer> params) {
+ R_TRY(impl.GetWorkBufferSizeForMultiStreamExEx(*params, *out_size));
+ LOG_DEBUG(Service_Audio, "size {:#x}", *out_size);
+ R_SUCCEED();
}
-IHardwareOpusDecoderManager::~IHardwareOpusDecoderManager() = default;
-
} // namespace Service::Audio
diff --git a/src/core/hle/service/audio/hardware_opus_decoder_manager.h b/src/core/hle/service/audio/hardware_opus_decoder_manager.h
index 29b1f16f5..4f869c517 100644
--- a/src/core/hle/service/audio/hardware_opus_decoder_manager.h
+++ b/src/core/hle/service/audio/hardware_opus_decoder_manager.h
@@ -4,30 +4,47 @@
#pragma once
#include "audio_core/opus/decoder_manager.h"
+#include "core/hle/service/cmif_types.h"
#include "core/hle/service/service.h"
-namespace Core {
-class System;
-}
-
namespace Service::Audio {
+class IHardwareOpusDecoder;
+
+using AudioCore::OpusDecoder::OpusMultiStreamParameters;
+using AudioCore::OpusDecoder::OpusMultiStreamParametersEx;
+using AudioCore::OpusDecoder::OpusParameters;
+using AudioCore::OpusDecoder::OpusParametersEx;
+
class IHardwareOpusDecoderManager final : public ServiceFramework<IHardwareOpusDecoderManager> {
public:
explicit IHardwareOpusDecoderManager(Core::System& system_);
~IHardwareOpusDecoderManager() override;
private:
- void OpenHardwareOpusDecoder(HLERequestContext& ctx);
- void GetWorkBufferSize(HLERequestContext& ctx);
- void OpenHardwareOpusDecoderForMultiStream(HLERequestContext& ctx);
- void GetWorkBufferSizeForMultiStream(HLERequestContext& ctx);
- void OpenHardwareOpusDecoderEx(HLERequestContext& ctx);
- void GetWorkBufferSizeEx(HLERequestContext& ctx);
- void OpenHardwareOpusDecoderForMultiStreamEx(HLERequestContext& ctx);
- void GetWorkBufferSizeForMultiStreamEx(HLERequestContext& ctx);
- void GetWorkBufferSizeExEx(HLERequestContext& ctx);
- void GetWorkBufferSizeForMultiStreamExEx(HLERequestContext& ctx);
+ Result OpenHardwareOpusDecoder(Out<SharedPointer<IHardwareOpusDecoder>> out_decoder,
+ OpusParameters params, u32 tmem_size,
+ InCopyHandle<Kernel::KTransferMemory> tmem_handle);
+ Result GetWorkBufferSize(Out<u32> out_size, OpusParameters params);
+ Result OpenHardwareOpusDecoderForMultiStream(
+ Out<SharedPointer<IHardwareOpusDecoder>> out_decoder,
+ InLargeData<OpusMultiStreamParameters, BufferAttr_HipcPointer> params, u32 tmem_size,
+ InCopyHandle<Kernel::KTransferMemory> tmem_handle);
+ Result GetWorkBufferSizeForMultiStream(
+ Out<u32> out_size, InLargeData<OpusMultiStreamParameters, BufferAttr_HipcPointer> params);
+ Result OpenHardwareOpusDecoderEx(Out<SharedPointer<IHardwareOpusDecoder>> out_decoder,
+ OpusParametersEx params, u32 tmem_size,
+ InCopyHandle<Kernel::KTransferMemory> tmem_handle);
+ Result GetWorkBufferSizeEx(Out<u32> out_size, OpusParametersEx params);
+ Result OpenHardwareOpusDecoderForMultiStreamEx(
+ Out<SharedPointer<IHardwareOpusDecoder>> out_decoder,
+ InLargeData<OpusMultiStreamParametersEx, BufferAttr_HipcPointer> params, u32 tmem_size,
+ InCopyHandle<Kernel::KTransferMemory> tmem_handle);
+ Result GetWorkBufferSizeForMultiStreamEx(
+ Out<u32> out_size, InLargeData<OpusMultiStreamParametersEx, BufferAttr_HipcPointer> params);
+ Result GetWorkBufferSizeExEx(Out<u32> out_size, OpusParametersEx params);
+ Result GetWorkBufferSizeForMultiStreamExEx(
+ Out<u32> out_size, InLargeData<OpusMultiStreamParametersEx, BufferAttr_HipcPointer> params);
Core::System& system;
AudioCore::OpusDecoder::OpusDecoderManager impl;