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

@ -30,7 +30,12 @@ namespace Ryujinx.Audio
public PlaybackState GetState(int trackId) => PlaybackState.Stopped;
public int OpenTrack(int sampleRate, int channels, ReleaseCallback callback)
public bool SupportsChannelCount(int channels)
{
return true;
}
public int OpenHardwareTrack(int sampleRate, int hardwareChannels, int virtualChannels, ReleaseCallback callback)
{
if (!_trackIds.TryDequeue(out int trackId))
{
@ -67,11 +72,11 @@ namespace Ryujinx.Audio
return bufferTags.ToArray();
}
public void AppendBuffer<T>(int trackID, long bufferTag, T[] buffer) where T : struct
public void AppendBuffer<T>(int trackId, long bufferTag, T[] buffer) where T : struct
{
_buffers.Enqueue(bufferTag);
if (_releaseCallbacks.TryGetValue(trackID, out var callback))
if (_releaseCallbacks.TryGetValue(trackId, out var callback))
{
callback?.Invoke();
}