mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
audio: rewrite IHardwareOpusDecoderManager
This commit is contained in:
parent
0471e54e5a
commit
ea4703cb31
|
@ -28,8 +28,8 @@ OpusDecoder::~OpusDecoder() {
|
|||
}
|
||||
}
|
||||
|
||||
Result OpusDecoder::Initialize(OpusParametersEx& params, Kernel::KTransferMemory* transfer_memory,
|
||||
u64 transfer_memory_size) {
|
||||
Result OpusDecoder::Initialize(const OpusParametersEx& params,
|
||||
Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size) {
|
||||
auto frame_size{params.use_large_frame_size ? 5760 : 1920};
|
||||
shared_buffer_size = transfer_memory_size;
|
||||
shared_buffer = std::make_unique<u8[]>(shared_buffer_size);
|
||||
|
@ -59,7 +59,7 @@ Result OpusDecoder::Initialize(OpusParametersEx& params, Kernel::KTransferMemory
|
|||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result OpusDecoder::Initialize(OpusMultiStreamParametersEx& params,
|
||||
Result OpusDecoder::Initialize(const OpusMultiStreamParametersEx& params,
|
||||
Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size) {
|
||||
auto frame_size{params.use_large_frame_size ? 5760 : 1920};
|
||||
shared_buffer_size = transfer_memory_size;
|
||||
|
|
|
@ -22,10 +22,10 @@ public:
|
|||
explicit OpusDecoder(Core::System& system, HardwareOpus& hardware_opus_);
|
||||
~OpusDecoder();
|
||||
|
||||
Result Initialize(OpusParametersEx& params, Kernel::KTransferMemory* transfer_memory,
|
||||
u64 transfer_memory_size);
|
||||
Result Initialize(OpusMultiStreamParametersEx& params, Kernel::KTransferMemory* transfer_memory,
|
||||
Result Initialize(const OpusParametersEx& params, Kernel::KTransferMemory* transfer_memory,
|
||||
u64 transfer_memory_size);
|
||||
Result Initialize(const OpusMultiStreamParametersEx& params,
|
||||
Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size);
|
||||
Result DecodeInterleaved(u32* out_data_size, u64* out_time_taken, u32* out_sample_count,
|
||||
std::span<const u8> input_data, std::span<u8> output_data, bool reset);
|
||||
Result SetContext([[maybe_unused]] std::span<const u8> context);
|
||||
|
|
|
@ -38,7 +38,7 @@ OpusDecoderManager::OpusDecoderManager(Core::System& system_)
|
|||
}
|
||||
}
|
||||
|
||||
Result OpusDecoderManager::GetWorkBufferSize(OpusParameters& params, u64& out_size) {
|
||||
Result OpusDecoderManager::GetWorkBufferSize(const OpusParameters& params, u32& out_size) {
|
||||
OpusParametersEx ex{
|
||||
.sample_rate = params.sample_rate,
|
||||
.channel_count = params.channel_count,
|
||||
|
@ -47,11 +47,11 @@ Result OpusDecoderManager::GetWorkBufferSize(OpusParameters& params, u64& out_si
|
|||
R_RETURN(GetWorkBufferSizeExEx(ex, out_size));
|
||||
}
|
||||
|
||||
Result OpusDecoderManager::GetWorkBufferSizeEx(OpusParametersEx& params, u64& out_size) {
|
||||
Result OpusDecoderManager::GetWorkBufferSizeEx(const OpusParametersEx& params, u32& out_size) {
|
||||
R_RETURN(GetWorkBufferSizeExEx(params, out_size));
|
||||
}
|
||||
|
||||
Result OpusDecoderManager::GetWorkBufferSizeExEx(OpusParametersEx& params, u64& out_size) {
|
||||
Result OpusDecoderManager::GetWorkBufferSizeExEx(const OpusParametersEx& params, u32& out_size) {
|
||||
R_UNLESS(IsValidChannelCount(params.channel_count), ResultInvalidOpusChannelCount);
|
||||
R_UNLESS(IsValidSampleRate(params.sample_rate), ResultInvalidOpusSampleRate);
|
||||
|
||||
|
@ -63,8 +63,8 @@ Result OpusDecoderManager::GetWorkBufferSizeExEx(OpusParametersEx& params, u64&
|
|||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result OpusDecoderManager::GetWorkBufferSizeForMultiStream(OpusMultiStreamParameters& params,
|
||||
u64& out_size) {
|
||||
Result OpusDecoderManager::GetWorkBufferSizeForMultiStream(const OpusMultiStreamParameters& params,
|
||||
u32& out_size) {
|
||||
OpusMultiStreamParametersEx ex{
|
||||
.sample_rate = params.sample_rate,
|
||||
.channel_count = params.channel_count,
|
||||
|
@ -76,13 +76,13 @@ Result OpusDecoderManager::GetWorkBufferSizeForMultiStream(OpusMultiStreamParame
|
|||
R_RETURN(GetWorkBufferSizeForMultiStreamExEx(ex, out_size));
|
||||
}
|
||||
|
||||
Result OpusDecoderManager::GetWorkBufferSizeForMultiStreamEx(OpusMultiStreamParametersEx& params,
|
||||
u64& out_size) {
|
||||
Result OpusDecoderManager::GetWorkBufferSizeForMultiStreamEx(
|
||||
const OpusMultiStreamParametersEx& params, u32& out_size) {
|
||||
R_RETURN(GetWorkBufferSizeForMultiStreamExEx(params, out_size));
|
||||
}
|
||||
|
||||
Result OpusDecoderManager::GetWorkBufferSizeForMultiStreamExEx(OpusMultiStreamParametersEx& params,
|
||||
u64& out_size) {
|
||||
Result OpusDecoderManager::GetWorkBufferSizeForMultiStreamExEx(
|
||||
const OpusMultiStreamParametersEx& params, u32& out_size) {
|
||||
R_UNLESS(IsValidMultiStreamChannelCount(params.channel_count), ResultInvalidOpusChannelCount);
|
||||
R_UNLESS(IsValidSampleRate(params.sample_rate), ResultInvalidOpusSampleRate);
|
||||
R_UNLESS(IsValidStreamCount(params.channel_count, params.total_stream_count,
|
||||
|
|
|
@ -22,17 +22,19 @@ public:
|
|||
return hardware_opus;
|
||||
}
|
||||
|
||||
Result GetWorkBufferSize(OpusParameters& params, u64& out_size);
|
||||
Result GetWorkBufferSizeEx(OpusParametersEx& params, u64& out_size);
|
||||
Result GetWorkBufferSizeExEx(OpusParametersEx& params, u64& out_size);
|
||||
Result GetWorkBufferSizeForMultiStream(OpusMultiStreamParameters& params, u64& out_size);
|
||||
Result GetWorkBufferSizeForMultiStreamEx(OpusMultiStreamParametersEx& params, u64& out_size);
|
||||
Result GetWorkBufferSizeForMultiStreamExEx(OpusMultiStreamParametersEx& params, u64& out_size);
|
||||
Result GetWorkBufferSize(const OpusParameters& params, u32& out_size);
|
||||
Result GetWorkBufferSizeEx(const OpusParametersEx& params, u32& out_size);
|
||||
Result GetWorkBufferSizeExEx(const OpusParametersEx& params, u32& out_size);
|
||||
Result GetWorkBufferSizeForMultiStream(const OpusMultiStreamParameters& params, u32& out_size);
|
||||
Result GetWorkBufferSizeForMultiStreamEx(const OpusMultiStreamParametersEx& params,
|
||||
u32& out_size);
|
||||
Result GetWorkBufferSizeForMultiStreamExEx(const OpusMultiStreamParametersEx& params,
|
||||
u32& out_size);
|
||||
|
||||
private:
|
||||
Core::System& system;
|
||||
HardwareOpus hardware_opus;
|
||||
std::array<u64, MaxChannels> required_workbuffer_sizes{};
|
||||
std::array<u32, MaxChannels> required_workbuffer_sizes{};
|
||||
};
|
||||
|
||||
} // namespace AudioCore::OpusDecoder
|
||||
|
|
|
@ -42,7 +42,7 @@ HardwareOpus::HardwareOpus(Core::System& system_)
|
|||
opus_decoder.SetSharedMemory(shared_memory);
|
||||
}
|
||||
|
||||
u64 HardwareOpus::GetWorkBufferSize(u32 channel) {
|
||||
u32 HardwareOpus::GetWorkBufferSize(u32 channel) {
|
||||
if (!opus_decoder.IsRunning()) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -55,10 +55,10 @@ u64 HardwareOpus::GetWorkBufferSize(u32 channel) {
|
|||
ADSP::OpusDecoder::Message::GetWorkBufferSizeOK, msg);
|
||||
return 0;
|
||||
}
|
||||
return shared_memory.dsp_return_data[0];
|
||||
return static_cast<u32>(shared_memory.dsp_return_data[0]);
|
||||
}
|
||||
|
||||
u64 HardwareOpus::GetWorkBufferSizeForMultiStream(u32 total_stream_count, u32 stereo_stream_count) {
|
||||
u32 HardwareOpus::GetWorkBufferSizeForMultiStream(u32 total_stream_count, u32 stereo_stream_count) {
|
||||
std::scoped_lock l{mutex};
|
||||
shared_memory.host_send_data[0] = total_stream_count;
|
||||
shared_memory.host_send_data[1] = stereo_stream_count;
|
||||
|
@ -70,7 +70,7 @@ u64 HardwareOpus::GetWorkBufferSizeForMultiStream(u32 total_stream_count, u32 st
|
|||
ADSP::OpusDecoder::Message::GetWorkBufferSizeForMultiStreamOK, msg);
|
||||
return 0;
|
||||
}
|
||||
return shared_memory.dsp_return_data[0];
|
||||
return static_cast<u32>(shared_memory.dsp_return_data[0]);
|
||||
}
|
||||
|
||||
Result HardwareOpus::InitializeDecodeObject(u32 sample_rate, u32 channel_count, void* buffer,
|
||||
|
@ -94,8 +94,9 @@ Result HardwareOpus::InitializeDecodeObject(u32 sample_rate, u32 channel_count,
|
|||
|
||||
Result HardwareOpus::InitializeMultiStreamDecodeObject(u32 sample_rate, u32 channel_count,
|
||||
u32 total_stream_count,
|
||||
u32 stereo_stream_count, void* mappings,
|
||||
void* buffer, u64 buffer_size) {
|
||||
u32 stereo_stream_count,
|
||||
const void* mappings, void* buffer,
|
||||
u64 buffer_size) {
|
||||
std::scoped_lock l{mutex};
|
||||
shared_memory.host_send_data[0] = (u64)buffer;
|
||||
shared_memory.host_send_data[1] = buffer_size;
|
||||
|
|
|
@ -16,14 +16,14 @@ class HardwareOpus {
|
|||
public:
|
||||
HardwareOpus(Core::System& system);
|
||||
|
||||
u64 GetWorkBufferSize(u32 channel);
|
||||
u64 GetWorkBufferSizeForMultiStream(u32 total_stream_count, u32 stereo_stream_count);
|
||||
u32 GetWorkBufferSize(u32 channel);
|
||||
u32 GetWorkBufferSizeForMultiStream(u32 total_stream_count, u32 stereo_stream_count);
|
||||
|
||||
Result InitializeDecodeObject(u32 sample_rate, u32 channel_count, void* buffer,
|
||||
u64 buffer_size);
|
||||
Result InitializeMultiStreamDecodeObject(u32 sample_rate, u32 channel_count,
|
||||
u32 totaL_stream_count, u32 stereo_stream_count,
|
||||
void* mappings, void* buffer, u64 buffer_size);
|
||||
const void* mappings, void* buffer, u64 buffer_size);
|
||||
Result ShutdownDecodeObject(void* buffer, u64 buffer_size);
|
||||
Result ShutdownMultiStreamDecodeObject(void* buffer, u64 buffer_size);
|
||||
Result DecodeInterleaved(u32& out_sample_count, void* output_data, u64 output_data_size,
|
||||
|
|
|
@ -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"},
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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};
|
||||
|
||||
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)};
|
||||
|
||||
LOG_DEBUG(Service_Audio, "sample_rate {} channel_count {} transfer_memory_size 0x{:X}",
|
||||
params.sample_rate, params.channel_count, transfer_memory_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);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(result);
|
||||
rb.PushIpcInterface(decoder);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void IHardwareOpusDecoderManager::OpenHardwareOpusDecoderForMultiStream(HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
|
||||
auto input{ctx.ReadBuffer()};
|
||||
OpusMultiStreamParameters params;
|
||||
std::memcpy(¶ms, 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)};
|
||||
|
||||
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);
|
||||
|
||||
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,
|
||||
.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);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(result);
|
||||
rb.PushIpcInterface(decoder);
|
||||
}
|
||||
|
||||
void IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStream(HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
|
||||
auto input{ctx.ReadBuffer()};
|
||||
OpusMultiStreamParameters params;
|
||||
std::memcpy(¶ms, 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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
auto decoder{std::make_shared<IHardwareOpusDecoder>(system, impl.GetHardwareOpus())};
|
||||
|
||||
auto result =
|
||||
decoder->Initialize(params, transfer_memory.GetPointerUnsafe(), transfer_memory_size);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(result);
|
||||
rb.PushIpcInterface(decoder);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void IHardwareOpusDecoderManager::OpenHardwareOpusDecoderForMultiStreamEx(HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
|
||||
auto input{ctx.ReadBuffer()};
|
||||
OpusMultiStreamParametersEx params;
|
||||
std::memcpy(¶ms, 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)};
|
||||
|
||||
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);
|
||||
|
||||
auto decoder{std::make_shared<IHardwareOpusDecoder>(system, impl.GetHardwareOpus())};
|
||||
|
||||
auto result =
|
||||
decoder->Initialize(params, transfer_memory.GetPointerUnsafe(), transfer_memory_size);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(result);
|
||||
rb.PushIpcInterface(decoder);
|
||||
}
|
||||
|
||||
void IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStreamEx(HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
|
||||
auto input{ctx.ReadBuffer()};
|
||||
OpusMultiStreamParametersEx params;
|
||||
std::memcpy(¶ms, input.data(), sizeof(OpusMultiStreamParametersEx));
|
||||
|
||||
u64 size{};
|
||||
auto result = impl.GetWorkBufferSizeForMultiStreamEx(params, 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);
|
||||
}
|
||||
|
||||
void IHardwareOpusDecoderManager::GetWorkBufferSizeForMultiStreamExEx(HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
|
||||
auto input{ctx.ReadBuffer()};
|
||||
OpusMultiStreamParametersEx params;
|
||||
std::memcpy(¶ms, 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);
|
||||
}
|
||||
|
||||
IHardwareOpusDecoderManager::IHardwareOpusDecoderManager(Core::System& system_)
|
||||
: ServiceFramework{system_, "hwopus"}, system{system_}, impl{system} {
|
||||
// clang-format off
|
||||
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"},
|
||||
{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);
|
||||
}
|
||||
|
||||
IHardwareOpusDecoderManager::~IHardwareOpusDecoderManager() = default;
|
||||
|
||||
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,
|
||||
};
|
||||
R_TRY(decoder->Initialize(ex, tmem_handle.Get(), tmem_size));
|
||||
|
||||
*out_decoder = decoder;
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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 {:#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,
|
||||
.use_large_frame_size = false,
|
||||
.mappings{},
|
||||
};
|
||||
std::memcpy(ex.mappings.data(), params->mappings.data(), sizeof(params->mappings));
|
||||
R_TRY(decoder->Initialize(ex, tmem_handle.Get(), tmem_size));
|
||||
|
||||
*out_decoder = decoder;
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
*out_decoder = decoder;
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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 {:#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())};
|
||||
|
||||
R_TRY(decoder->Initialize(*params, tmem_handle.Get(), tmem_size));
|
||||
|
||||
*out_decoder = decoder;
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
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 {:#x}",
|
||||
params->sample_rate, params->channel_count, params->total_stream_count,
|
||||
params->stereo_stream_count, params->use_large_frame_size, *out_size);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
} // namespace Service::Audio
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue