diff options
author | Mary <me@thog.eu> | 2020-08-18 21:03:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-18 21:03:55 +0200 |
commit | 5b26e4ef94afca8450f07c42393180e3c97f9c00 (patch) | |
tree | 5c698591bd557711a487430ba06921b10ce53761 /Ryujinx.HLE/HOS/Services | |
parent | a389dd59bd881cf2cff09a1f67f5c30de61123e6 (diff) |
Misc audio fixes (#1348)
Changes:
Implement software surround downmixing (fix #796).
Fix a crash when no audio renderer were created when stopping emulation.
NOTE: This PR also disable support of 5.1 surround on the OpenAL backend as we cannot detect if the hardware directly support it. (the downmixing applied by OpenAL on Windows is terribly slow)
Diffstat (limited to 'Ryujinx.HLE/HOS/Services')
-rw-r--r-- | Ryujinx.HLE/HOS/Services/Audio/AudioOutManager/IAudioOut.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Audio/AudioOutManager/IAudioOut.cs b/Ryujinx.HLE/HOS/Services/Audio/AudioOutManager/IAudioOut.cs index e6b7cb3d..d75fecf2 100644 --- a/Ryujinx.HLE/HOS/Services/Audio/AudioOutManager/IAudioOut.cs +++ b/Ryujinx.HLE/HOS/Services/Audio/AudioOutManager/IAudioOut.cs @@ -4,6 +4,7 @@ using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.HOS.Kernel.Common; using Ryujinx.HLE.HOS.Kernel.Threading; using System; +using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Audio.AudioOutManager { @@ -106,9 +107,10 @@ namespace Ryujinx.HLE.HOS.Services.Audio.AudioOutManager context.Memory, position); - byte[] buffer = new byte[data.SampleBufferSize]; + // NOTE: Assume PCM16 all the time, change if new format are found. + short[] buffer = new short[data.SampleBufferSize / sizeof(short)]; - context.Memory.Read((ulong)data.SampleBufferPtr, buffer); + context.Memory.Read((ulong)data.SampleBufferPtr, MemoryMarshal.Cast<short, byte>(buffer)); _audioOut.AppendBuffer(_track, tag, buffer); |