aboutsummaryrefslogtreecommitdiff
path: root/src/audio_core/sink_context.cpp
diff options
context:
space:
mode:
authorKelebek1 <eeeedddccc@hotmail.co.uk>2021-07-07 14:56:23 +0100
committerKelebek1 <eeeedddccc@hotmail.co.uk>2021-07-08 17:07:23 +0100
commit7636fefb715492960545f5b921b0714ae261f2f6 (patch)
tree823c07fef75b9cda6ce54f54cd26bebf21e669cd /src/audio_core/sink_context.cpp
parent2eb018c80fd2a83686ee11a80c7427a98ea44354 (diff)
audio_core: Preserve front channel volume after 6 to 2 downmix
Many games report 6 channel output while only providing data for 2. We only output 2-channel audio regardless, and in the downmixing, front left/right only provide 36% of their volume. This is done assuming all of the other channels also contain valid data, but in many games they don't. This PR alters the downmixing to preserve front left/right, so volume is not lost. This improves volume in Link's Awakening, New Super Mario Bros U, Disgaea 6, Super Kirby Clash.
Diffstat (limited to 'src/audio_core/sink_context.cpp')
-rw-r--r--src/audio_core/sink_context.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/audio_core/sink_context.cpp b/src/audio_core/sink_context.cpp
index a69543696..cc55b290c 100644
--- a/src/audio_core/sink_context.cpp
+++ b/src/audio_core/sink_context.cpp
@@ -15,10 +15,17 @@ std::size_t SinkContext::GetCount() const {
void SinkContext::UpdateMainSink(const SinkInfo::InParams& in) {
ASSERT(in.type == SinkTypes::Device);
- has_downmix_coefs = in.device.down_matrix_enabled;
- if (has_downmix_coefs) {
+ if (in.device.down_matrix_enabled) {
downmix_coefficients = in.device.down_matrix_coef;
+ } else {
+ downmix_coefficients = {
+ 1.0f, // front
+ 0.707f, // center
+ 0.0f, // lfe
+ 0.707f, // back
+ };
}
+
in_use = in.in_use;
use_count = in.device.input_count;
buffers = in.device.input;
@@ -34,10 +41,6 @@ std::vector<u8> SinkContext::OutputBuffers() const {
return buffer_ret;
}
-bool SinkContext::HasDownMixingCoefficients() const {
- return has_downmix_coefs;
-}
-
const DownmixCoefficients& SinkContext::GetDownmixCoefficients() const {
return downmix_coefficients;
}