From 5c0ee5eba65b68a7fad8ee11303719cfd21c6395 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Thu, 14 Jul 2022 16:01:07 +0200 Subject: [PATCH] early-access version 2834 --- README.md | 2 +- .../renderer/command/command_generator.cpp | 4 ---- src/audio_core/sink/cubeb_sink.cpp | 20 ++++++++++++++++--- src/audio_core/sink/sdl2_sink.cpp | 20 ++++++++++++++++--- 4 files changed, 35 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c512f9d49..ca678bc37 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 2833. +This is the source code for early-access 2834. ## Legal Notice diff --git a/src/audio_core/renderer/command/command_generator.cpp b/src/audio_core/renderer/command/command_generator.cpp index f42d544f8..2ea50d128 100755 --- a/src/audio_core/renderer/command/command_generator.cpp +++ b/src/audio_core/renderer/command/command_generator.cpp @@ -774,10 +774,6 @@ void CommandGenerator::GenerateDeviceSinkCommand(const s16 buffer_offset, SinkIn if (render_context.channels == 2 && parameter.downmix_enabled) { command_buffer.GenerateDownMix6chTo2chCommand(InvalidNodeId, parameter.inputs, buffer_offset, parameter.downmix_coeff); - } else if (render_context.channels == 2 && parameter.input_count == 6) { - constexpr std::array default_coeffs{{1.0f, 0.707f, 0.251f, 0.707f}}; - command_buffer.GenerateDownMix6chTo2chCommand(InvalidNodeId, parameter.inputs, - buffer_offset, default_coeffs); } if (state.upsampler_info != nullptr) { diff --git a/src/audio_core/sink/cubeb_sink.cpp b/src/audio_core/sink/cubeb_sink.cpp index 1ac62b3b9..dadd5ea4a 100755 --- a/src/audio_core/sink/cubeb_sink.cpp +++ b/src/audio_core/sink/cubeb_sink.cpp @@ -235,10 +235,24 @@ public: for (u32 read_index = 0, write_index = 0; read_index < samples.size(); read_index += system_channels, write_index += device_channels) { - new_samples[write_index + static_cast(Channels::FrontLeft)] = - samples[read_index + static_cast(Channels::FrontLeft)]; + const auto left_sample{static_cast(std::clamp( + static_cast( + static_cast( + samples[read_index + static_cast(Channels::FrontLeft)]) * + volume), + min, max))}; + + new_samples[write_index + static_cast(Channels::FrontLeft)] = left_sample; + + const auto right_sample{static_cast(std::clamp( + static_cast( + static_cast( + samples[read_index + static_cast(Channels::FrontRight)]) * + volume), + min, max))}; + new_samples[write_index + static_cast(Channels::FrontRight)] = - samples[read_index + static_cast(Channels::FrontRight)]; + right_sample; } samples = std::move(new_samples); diff --git a/src/audio_core/sink/sdl2_sink.cpp b/src/audio_core/sink/sdl2_sink.cpp index cf86b2acb..d6c9ec90d 100755 --- a/src/audio_core/sink/sdl2_sink.cpp +++ b/src/audio_core/sink/sdl2_sink.cpp @@ -208,10 +208,24 @@ public: for (u32 read_index = 0, write_index = 0; read_index < samples.size(); read_index += system_channels, write_index += device_channels) { - new_samples[write_index + static_cast(Channels::FrontLeft)] = - samples[read_index + static_cast(Channels::FrontLeft)]; + const auto left_sample{static_cast(std::clamp( + static_cast( + static_cast( + samples[read_index + static_cast(Channels::FrontLeft)]) * + volume), + min, max))}; + + new_samples[write_index + static_cast(Channels::FrontLeft)] = left_sample; + + const auto right_sample{static_cast(std::clamp( + static_cast( + static_cast( + samples[read_index + static_cast(Channels::FrontRight)]) * + volume), + min, max))}; + new_samples[write_index + static_cast(Channels::FrontRight)] = - samples[read_index + static_cast(Channels::FrontRight)]; + right_sample; } samples = std::move(new_samples);