dotnet / Silk.NET

The high-speed OpenGL, OpenCL, OpenAL, OpenXR, GLFW, SDL, Vulkan, Assimp, WebGPU, and DirectX bindings library your mother warned you about.
https://dotnet.github.io/Silk.NET
MIT License
3.89k stars 378 forks source link

Add OpenAL Soft library for Android #617

Open roeyskoe opened 2 years ago

roeyskoe commented 2 years ago

Summary of feature

Currently OpenAL Soft library is not compiled for Android, and trying to use it throws an FileNotFoundException.

Does this have a proposal?

No

Perksey commented 2 years ago

Will only be adding this for .NET 6 as backporting to Xamarin would be a lot of maintenance burden.

Perksey commented 2 years ago

Low priority, won't make it into 2.9.

Pyrdacor commented 2 years ago

Any news on that? Currently Silk.net 2.13.0 throws a NullReferenceException when calling AL.GetApi(true) or AL.GetApi(false):

   at Silk.NET.Core.Loader.DefaultPathResolver.GetAllRuntimeIds(String currentRid, DependencyContext ctx)
   at Silk.NET.Core.Loader.DefaultPathResolver.TryLocateNativeAssetInRuntimesFolder(String name, String baseFolder, String& result)
   at Silk.NET.Core.Loader.DefaultPathResolver.CoreEnumeratePossibleLibraryLoadTargets(String name, Boolean noLinuxTraverse)+MoveNext()
   at Silk.NET.Core.Loader.LibraryLoader.LoadWithResolver(String name, PathResolver pathResolver)
   at Silk.NET.Core.Loader.LibraryLoader.TryLoadNativeLibrary(String[] names, PathResolver pathResolver, IntPtr& result)
   at Silk.NET.Core.Loader.LibraryLoader.TryLoadNativeLibrary(String name, PathResolver pathResolver, IntPtr& result)
   at Silk.NET.Core.Loader.LibraryLoader.LoadNativeLibrary(String name, PathResolver pathResolver)
   at Silk.NET.Core.Loader.UnmanagedLibrary..ctor(String name, LibraryLoader loader, PathResolver pathResolver)
   at Silk.NET.Core.Loader.UnmanagedLibrary..ctor(String name)
   at Silk.NET.Core.Contexts.DefaultNativeContext..ctor(String name)
   at Silk.NET.OpenAL.AL.CreateDefaultContext(String n)
   at Silk.NET.OpenAL.AL.GetApi(Boolean soft)
   at Ambermoon.Audio.OpenAL.AudioOutput..ctor(Int32 channels, Int32 sampleRate)
Pyrdacor commented 2 years ago

Ok with a valid RID in the csproj, the exception is gone. It just won't find the .so file now. :)

Perksey commented 2 years ago

Current progress:

We have the SilkDroid gradle project to go off, but beyond that this is a large task full of a lot of figuring out.

The Silk.NET team at this time don't have any real priority on this issue due to low demand and time constraints thus it is a community issue (help wanted!)

Pyrdacor commented 2 years ago

Ok thanks for the heads-up. Maybe this will help: https://github.com/sgothel/openal-soft/blob/master/Android.md

Can't tell if I will have the time for it either.

roeyskoe commented 2 years ago

I already have gotten OpenAL to build for Android, but have not yet have time to research how the required(?) aar could be done.

I could actually open a pr for the OpenAL native builds, even without Android support.

Pyrdacor commented 2 years ago

Nevermind I just used the AudioTrack class for Android which works quite well. :)

alexrp commented 2 months ago

Once #2049 is merged, we'll be using CMake toolchain files for cross-compilation. That should make it a lot easier to use the Android NDK to cross-compile OpenAL Soft libraries for Android if anyone is still interested in this. I probably won't do it myself, but can offer assistance to anyone willing to drive the effort.