aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Audio/Renderer/Dsp/Command/DeviceSinkCommand.cs
diff options
context:
space:
mode:
authorMary <mary@mary.zone>2023-05-12 00:19:19 +0200
committerGitHub <noreply@github.com>2023-05-12 00:19:19 +0200
commit5cbdfbc7a4b7413a4f633c77190a79bfc6520e98 (patch)
treeeb3cbaa24afd8f0c038b9c6110c20b88d0f8d8ad /src/Ryujinx.Audio/Renderer/Dsp/Command/DeviceSinkCommand.cs
parente0544dd9c74e86cca6ee37c4d521d2d07f9ccdcc (diff)
amadeus: Allow 5.1 sink output (#4894)1.1.788
* amadeus: Allow 5.1 sink output Also add a simple Stereo to 5.1 change for device sink. Tested against NES - Nintendo Switch Online that output stereo on the audio renderer. * Remove outdated comment
Diffstat (limited to 'src/Ryujinx.Audio/Renderer/Dsp/Command/DeviceSinkCommand.cs')
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/Command/DeviceSinkCommand.cs16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/Command/DeviceSinkCommand.cs b/src/Ryujinx.Audio/Renderer/Dsp/Command/DeviceSinkCommand.cs
index 9c88a4e7..27bb34bf 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/Command/DeviceSinkCommand.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/Command/DeviceSinkCommand.cs
@@ -67,7 +67,19 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
const int sampleCount = Constants.TargetSampleCount;
- short[] outputBuffer = new short[bufferCount * sampleCount];
+ uint inputCount;
+
+ // In case of upmixing to 5.1, we allocate the right amount.
+ if (bufferCount != channelCount && channelCount == 6)
+ {
+ inputCount = (uint)channelCount;
+ }
+ else
+ {
+ inputCount = bufferCount;
+ }
+
+ short[] outputBuffer = new short[inputCount * sampleCount];
for (int i = 0; i < bufferCount; i++)
{
@@ -79,7 +91,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
}
}
- device.AppendBuffer(outputBuffer, InputCount);
+ device.AppendBuffer(outputBuffer, inputCount);
}
else
{