aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceSession.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-12-27 18:25:21 -0300
committerGitHub <noreply@github.com>2021-12-27 18:25:21 -0300
commitf65d01b5d35b2339d2b5afaa0f85cdcf832b4636 (patch)
treebd020cfebd1a5d52a9db16ec611d489ec8f32bbc /Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceSession.cs
parentac57dd5d75bd59b73471685c1f76c61f5ad5eae8 (diff)
Use minimum stream sample count on SDL2 audio backend (#2948)
Diffstat (limited to 'Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceSession.cs')
-rw-r--r--Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceSession.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceSession.cs b/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceSession.cs
index 33e1632d..b39f196a 100644
--- a/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceSession.cs
+++ b/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceSession.cs
@@ -42,11 +42,13 @@ namespace Ryujinx.Audio.Backends.SDL2
private void EnsureAudioStreamSetup(AudioBuffer buffer)
{
- bool needAudioSetup = _outputStream == 0 || ((uint)GetSampleCount(buffer) % _sampleCount) != 0;
+ uint bufferSampleCount = (uint)GetSampleCount(buffer);
+ bool needAudioSetup = _outputStream == 0 ||
+ (bufferSampleCount >= Constants.TargetSampleCount && bufferSampleCount < _sampleCount);
if (needAudioSetup)
{
- _sampleCount = Math.Max(Constants.TargetSampleCount, (uint)GetSampleCount(buffer));
+ _sampleCount = Math.Max(Constants.TargetSampleCount, bufferSampleCount);
uint newOutputStream = SDL2HardwareDeviceDriver.OpenStream(RequestedSampleFormat, RequestedSampleRate, RequestedChannelCount, _sampleCount, _callbackDelegate);