add sdl audio backend as default audio

This commit is contained in:
Emmanuel Hansen 2023-06-27 15:58:35 +00:00
parent 9bb70e5ac2
commit a57cad5d5e
3 changed files with 17 additions and 3 deletions

View File

@ -10,5 +10,6 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="OpenTK" /> <PackageReference Include="OpenTK" />
<PackageReference Include="Ryujinx.SDL2-CS" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -13,11 +13,14 @@ using Ryujinx.Audio.Backends.Dummy;
using Ryujinx.HLE.HOS.SystemState; using Ryujinx.HLE.HOS.SystemState;
using Ryujinx.Ui.Common.Configuration; using Ryujinx.Ui.Common.Configuration;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using Ryujinx.Audio.Integration;
using Ryujinx.Audio.Backends.SDL2;
namespace LibRyujinx namespace LibRyujinx
{ {
public static partial class LibRyujinx public static partial class LibRyujinx
{ {
internal static IHardwareDeviceDriver AudioDriver { get; set; } = new DummyHardwareDeviceDriver();
public static SwitchDevice? SwitchDevice { get; set; } public static SwitchDevice? SwitchDevice { get; set; }
[UnmanagedCallersOnly(EntryPoint = "initialize")] [UnmanagedCallersOnly(EntryPoint = "initialize")]
@ -25,7 +28,11 @@ namespace LibRyujinx
{ {
var path = Marshal.PtrToStringAnsi(basePathPtr); var path = Marshal.PtrToStringAnsi(basePathPtr);
return Initialize(path); var res = Initialize(path);
InitializeAudio();
return res;
} }
public static bool Initialize(string? basePath) public static bool Initialize(string? basePath)
@ -60,6 +67,11 @@ namespace LibRyujinx
return true; return true;
} }
public static void InitializeAudio()
{
AudioDriver = new SDL2HardwareDeviceDriver();
}
} }
public class SwitchDevice : IDisposable public class SwitchDevice : IDisposable
@ -117,7 +129,7 @@ namespace LibRyujinx
AccountManager, AccountManager,
UserChannelPersistence, UserChannelPersistence,
renderer, renderer,
new DummyHardwareDeviceDriver(), //Audio LibRyujinx.AudioDriver, //Audio
MemoryConfiguration.MemoryConfiguration4GiB, MemoryConfiguration.MemoryConfiguration4GiB,
null, null,
SystemLanguage.AmericanEnglish, SystemLanguage.AmericanEnglish,
@ -133,7 +145,7 @@ namespace LibRyujinx
isHostMapped ? MemoryManagerMode.HostMappedUnsafe : MemoryManagerMode.SoftwarePageTable, isHostMapped ? MemoryManagerMode.HostMappedUnsafe : MemoryManagerMode.SoftwarePageTable,
false, false,
LibRyujinx.GraphicsConfiguration.AspectRatio, LibRyujinx.GraphicsConfiguration.AspectRatio,
0, 100,
true, true,
""); "");

View File

@ -14,6 +14,7 @@
<OptimizationPreference>Speed</OptimizationPreference> <OptimizationPreference>Speed</OptimizationPreference>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Ryujinx.Audio.Backends.SDL2\Ryujinx.Audio.Backends.SDL2.csproj" />
<ProjectReference Include="..\Ryujinx.Input\Ryujinx.Input.csproj" /> <ProjectReference Include="..\Ryujinx.Input\Ryujinx.Input.csproj" />
<ProjectReference Include="..\Ryujinx.Common\Ryujinx.Common.csproj" /> <ProjectReference Include="..\Ryujinx.Common\Ryujinx.Common.csproj" />
<ProjectReference Include="..\Ryujinx.HLE\Ryujinx.HLE.csproj" /> <ProjectReference Include="..\Ryujinx.HLE\Ryujinx.HLE.csproj" />