audio: Implement a SDL2 backend (#2258)

* audio: Implement a SDL2 backend

This adds support to SDL2 as an audio backend.
It has the same compatibility level as OpenAL without its issues.

I also took the liberty of restructuring the SDL2 code to have one
shared project between audio and input.

The configuration version was also incremented.

* Address gdkchan's comments

* Fix update logic

* Add an heuristic to pick the correct target sample count wanted by the game

* Address gdkchan's comments

* Address Ac_k's comments

* Fix audren output

* Address gdkchan's comments
This commit is contained in:
Mary 2021-05-05 23:37:09 +02:00 committed by GitHub
parent 106512229e
commit eb056218a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 511 additions and 14 deletions

View file

@ -5,6 +5,7 @@ using LibHac.Common;
using LibHac.Ns;
using Ryujinx.Audio.Backends.Dummy;
using Ryujinx.Audio.Backends.OpenAL;
using Ryujinx.Audio.Backends.SDL2;
using Ryujinx.Audio.Backends.SoundIo;
using Ryujinx.Audio.Integration;
using Ryujinx.Common.Configuration;
@ -327,7 +328,18 @@ namespace Ryujinx.Ui
IHardwareDeviceDriver deviceDriver = new DummyHardwareDeviceDriver();
if (ConfigurationState.Instance.System.AudioBackend.Value == AudioBackend.SoundIo)
if (ConfigurationState.Instance.System.AudioBackend.Value == AudioBackend.SDL2)
{
if (SDL2HardwareDeviceDriver.IsSupported)
{
deviceDriver = new SDL2HardwareDeviceDriver();
}
else
{
Logger.Warning?.Print(LogClass.Audio, "SDL2 audio is not supported, falling back to dummy audio out.");
}
}
else if (ConfigurationState.Instance.System.AudioBackend.Value == AudioBackend.SoundIo)
{
if (SoundIoHardwareDeviceDriver.IsSupported)
{