diff options
Diffstat (limited to 'src/audio_core')
-rw-r--r-- | src/audio_core/opus/decoder.cpp | 6 | ||||
-rw-r--r-- | src/audio_core/opus/decoder.h | 6 | ||||
-rw-r--r-- | src/audio_core/opus/decoder_manager.cpp | 18 | ||||
-rw-r--r-- | src/audio_core/opus/decoder_manager.h | 16 | ||||
-rw-r--r-- | src/audio_core/opus/hardware_opus.cpp | 13 | ||||
-rw-r--r-- | src/audio_core/opus/hardware_opus.h | 6 |
6 files changed, 34 insertions, 31 deletions
diff --git a/src/audio_core/opus/decoder.cpp b/src/audio_core/opus/decoder.cpp index b7fed5304..0c110cbeb 100644 --- a/src/audio_core/opus/decoder.cpp +++ b/src/audio_core/opus/decoder.cpp @@ -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; diff --git a/src/audio_core/opus/decoder.h b/src/audio_core/opus/decoder.h index fd728958a..1b8c257d4 100644 --- a/src/audio_core/opus/decoder.h +++ b/src/audio_core/opus/decoder.h @@ -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); diff --git a/src/audio_core/opus/decoder_manager.cpp b/src/audio_core/opus/decoder_manager.cpp index 1464880a1..89eec1298 100644 --- a/src/audio_core/opus/decoder_manager.cpp +++ b/src/audio_core/opus/decoder_manager.cpp @@ -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, diff --git a/src/audio_core/opus/decoder_manager.h b/src/audio_core/opus/decoder_manager.h index 70ebc4bab..8f6876d5c 100644 --- a/src/audio_core/opus/decoder_manager.h +++ b/src/audio_core/opus/decoder_manager.h @@ -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 diff --git a/src/audio_core/opus/hardware_opus.cpp b/src/audio_core/opus/hardware_opus.cpp index 5ff71ab2d..30805f4a3 100644 --- a/src/audio_core/opus/hardware_opus.cpp +++ b/src/audio_core/opus/hardware_opus.cpp @@ -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; diff --git a/src/audio_core/opus/hardware_opus.h b/src/audio_core/opus/hardware_opus.h index b10184baa..caa746840 100644 --- a/src/audio_core/opus/hardware_opus.h +++ b/src/audio_core/opus/hardware_opus.h @@ -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, |