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)
This commit is contained in:
Mary 2020-08-18 21:03:55 +02:00 committed by GitHub
parent 698ed6c622
commit 2c17f709d2
11 changed files with 302 additions and 30 deletions

View file

@ -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);