Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amadeus: Allow 5.1 sink output #4894

Merged
merged 2 commits into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Ryujinx.Audio/Renderer/Dsp/AudioProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ public void Start(IHardwareDeviceDriver deviceDriver, float volume)
OutputDevices = new IHardwareDevice[Constants.AudioRendererSessionCountMax];

// TODO: Before enabling this, we need up-mixing from stereo to 5.1.
marysaka marked this conversation as resolved.
Show resolved Hide resolved
// uint channelCount = GetHardwareChannelCount(deviceDriver);
uint channelCount = 2;
uint channelCount = GetHardwareChannelCount(deviceDriver);

for (int i = 0; i < OutputDevices.Length; i++)
{
Expand Down
16 changes: 14 additions & 2 deletions src/Ryujinx.Audio/Renderer/Dsp/Command/DeviceSinkCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,19 @@ public void Process(CommandList context)

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++)
{
Expand All @@ -79,7 +91,7 @@ public void Process(CommandList context)
}
}

device.AppendBuffer(outputBuffer, InputCount);
device.AppendBuffer(outputBuffer, inputCount);
}
else
{
Expand Down