summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/audio
diff options
context:
space:
mode:
authorFeng Chen <VonChenPlus@gmail.com>2022-09-20 05:56:43 +0200
committerGitHub <noreply@github.com>2022-09-20 05:56:43 +0200
commitc864cb57726e76e9dc4558036f3212168bec825d (patch)
treeca79c4397f40990488a7b5691e15c0fcfec507b6 /src/core/hle/service/audio
parentvideo_core: Generate mipmap texture by drawing (diff)
parentMerge pull request #8849 from Morph1984/parallel-astc (diff)
downloadyuzu-c864cb57726e76e9dc4558036f3212168bec825d.tar
yuzu-c864cb57726e76e9dc4558036f3212168bec825d.tar.gz
yuzu-c864cb57726e76e9dc4558036f3212168bec825d.tar.bz2
yuzu-c864cb57726e76e9dc4558036f3212168bec825d.tar.lz
yuzu-c864cb57726e76e9dc4558036f3212168bec825d.tar.xz
yuzu-c864cb57726e76e9dc4558036f3212168bec825d.tar.zst
yuzu-c864cb57726e76e9dc4558036f3212168bec825d.zip
Diffstat (limited to 'src/core/hle/service/audio')
-rw-r--r--src/core/hle/service/audio/audout_u.cpp3
-rw-r--r--src/core/hle/service/audio/audren_u.cpp4
-rw-r--r--src/core/hle/service/audio/hwopus.cpp28
-rw-r--r--src/core/hle/service/audio/hwopus.h11
4 files changed, 41 insertions, 5 deletions
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp
index a44dd842a..49c092301 100644
--- a/src/core/hle/service/audio/audout_u.cpp
+++ b/src/core/hle/service/audio/audout_u.cpp
@@ -246,9 +246,8 @@ void AudOutU::ListAudioOuts(Kernel::HLERequestContext& ctx) {
const auto write_count =
static_cast<u32>(ctx.GetWriteBufferSize() / sizeof(AudioDevice::AudioDeviceName));
std::vector<AudioDevice::AudioDeviceName> device_names{};
- std::string print_names{};
if (write_count > 0) {
- device_names.push_back(AudioDevice::AudioDeviceName("DeviceOut"));
+ device_names.emplace_back("DeviceOut");
LOG_DEBUG(Service_Audio, "called. \nName=DeviceOut");
} else {
LOG_DEBUG(Service_Audio, "called. Empty buffer passed in.");
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp
index bc69117c6..6fb07c37d 100644
--- a/src/core/hle/service/audio/audren_u.cpp
+++ b/src/core/hle/service/audio/audren_u.cpp
@@ -252,7 +252,7 @@ private:
std::vector<AudioDevice::AudioDeviceName> out_names{};
- u32 out_count = impl->ListAudioDeviceName(out_names, in_count);
+ const u32 out_count = impl->ListAudioDeviceName(out_names, in_count);
std::string out{};
for (u32 i = 0; i < out_count; i++) {
@@ -365,7 +365,7 @@ private:
std::vector<AudioDevice::AudioDeviceName> out_names{};
- u32 out_count = impl->ListAudioOutputDeviceName(out_names, in_count);
+ const u32 out_count = impl->ListAudioOutputDeviceName(out_names, in_count);
std::string out{};
for (u32 i = 0; i < out_count; i++) {
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(&param, 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);
}
diff --git a/src/core/hle/service/audio/hwopus.h b/src/core/hle/service/audio/hwopus.h
index 265dd0cc6..e6092e290 100644
--- a/src/core/hle/service/audio/hwopus.h
+++ b/src/core/hle/service/audio/hwopus.h
@@ -11,6 +11,16 @@ class System;
namespace Service::Audio {
+struct OpusMultiStreamParametersEx {
+ u32 sample_rate;
+ u32 channel_count;
+ u32 number_streams;
+ u32 number_stereo_streams;
+ u32 use_large_frame_size;
+ u32 padding;
+ std::array<u32, 64> channel_mappings;
+};
+
class HwOpus final : public ServiceFramework<HwOpus> {
public:
explicit HwOpus(Core::System& system_);
@@ -21,6 +31,7 @@ private:
void OpenHardwareOpusDecoderEx(Kernel::HLERequestContext& ctx);
void GetWorkBufferSize(Kernel::HLERequestContext& ctx);
void GetWorkBufferSizeEx(Kernel::HLERequestContext& ctx);
+ void GetWorkBufferSizeForMultiStreamEx(Kernel::HLERequestContext& ctx);
};
} // namespace Service::Audio