diff options
author | FengChen <vonchenplus@gmail.com> | 2022-09-16 18:28:56 +0200 |
---|---|---|
committer | FengChen <vonchenplus@gmail.com> | 2022-09-16 18:28:56 +0200 |
commit | 672e61d8022aaa178b66bd92f2038d260dc3d104 (patch) | |
tree | 2fb441a61d7bab020ba9c71eccb3f5547ea33193 /src/core/hle/service/audio/hwopus.cpp | |
parent | Merge pull request #8863 from german77/triggers (diff) | |
download | yuzu-672e61d8022aaa178b66bd92f2038d260dc3d104.tar yuzu-672e61d8022aaa178b66bd92f2038d260dc3d104.tar.gz yuzu-672e61d8022aaa178b66bd92f2038d260dc3d104.tar.bz2 yuzu-672e61d8022aaa178b66bd92f2038d260dc3d104.tar.lz yuzu-672e61d8022aaa178b66bd92f2038d260dc3d104.tar.xz yuzu-672e61d8022aaa178b66bd92f2038d260dc3d104.tar.zst yuzu-672e61d8022aaa178b66bd92f2038d260dc3d104.zip |
Diffstat (limited to 'src/core/hle/service/audio/hwopus.cpp')
-rw-r--r-- | src/core/hle/service/audio/hwopus.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp index 4f2ed2d52..8bafc3a98 100644 --- a/src/core/hle/service/audio/hwopus.cpp +++ b/src/core/hle/service/audio/hwopus.cpp @@ -255,6 +255,32 @@ void HwOpus::GetWorkBufferSizeEx(Kernel::HLERequestContext& ctx) { GetWorkBufferSize(ctx); } +void HwOpus::GetWorkBufferSizeForMultiStreamEx(Kernel::HLERequestContext& ctx) { + OpusMultiStreamParametersEx param; + std::memcpy(¶m, ctx.ReadBuffer().data(), ctx.GetReadBufferSize()); + + const auto sample_rate = param.sample_rate; + const auto channel_count = param.channel_count; + const auto number_streams = param.number_streams; + const auto number_stereo_streams = param.number_stereo_streams; + + LOG_DEBUG( + Audio, + "called with sample_rate={}, channel_count={}, number_streams={}, number_stereo_streams={}", + sample_rate, channel_count, number_streams, number_stereo_streams); + + ASSERT_MSG(sample_rate == 48000 || sample_rate == 24000 || sample_rate == 16000 || + sample_rate == 12000 || sample_rate == 8000, + "Invalid sample rate"); + + const u32 worker_buffer_sz = + static_cast<u32>(opus_multistream_decoder_get_size(number_streams, number_stereo_streams)); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push<u32>(worker_buffer_sz); +} + void HwOpus::OpenHardwareOpusDecoder(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto sample_rate = rp.Pop<u32>(); @@ -335,7 +361,7 @@ HwOpus::HwOpus(Core::System& system_) : ServiceFramework{system_, "hwopus"} { {4, &HwOpus::OpenHardwareOpusDecoderEx, "OpenHardwareOpusDecoderEx"}, {5, &HwOpus::GetWorkBufferSizeEx, "GetWorkBufferSizeEx"}, {6, nullptr, "OpenHardwareOpusDecoderForMultiStreamEx"}, - {7, nullptr, "GetWorkBufferSizeForMultiStreamEx"}, + {7, &HwOpus::GetWorkBufferSizeForMultiStreamEx, "GetWorkBufferSizeForMultiStreamEx"}, }; RegisterHandlers(functions); } |