Android Hardware OpenAL Support + Possible Finalizer Bug

Hi,

Should all Android hardware be able to support OpenAL as implemented in MonoGame?

I ask because it’s not working on the GenyMotion emulator running 2.3.x, however it’s working fine in GenyMotion running 4.x. Both my Android devices work fine but they are relatively recent (HTC One X and Galaxy S4).

I know OpenAL can be a bit flaky on emulators - the iOS simulator for example works through the internal Mac hardware but no through my external audio interface.

I should also mention this, which I think counts as a bug. If you try and create an instance of SoundEffectInstance and there’s no OpenAL support an exception is (probably quite rightly) thrown. However, even if you trap this and exit cleanly when garbage collection occurs another exception seems to be thrown in the bowels of MG which can’t be trapped…

System.DllNotFoundException: openal32.dll
[mono]   at (wrapper managed-to-native) OpenTK.Audio.OpenAL.AL:IsBuffer (uint)
[mono]   at OpenTK.Audio.OpenAL.AL.IsBuffer (Int32 bid) [0x00004] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/163212a9/source/monodroid/src/OpenGLES/OpenTK/Audio/OpenAL/AL/AL.cs:1388 
[mono]   at Microsoft.Xna.Framework.Audio.OALSoundBuffer.Dispose (Boolean disposing) [0x00011] in /Volumes/Docs/development/Xamarin/MonoGame/MonoGame.Framework/Audio/OALSoundBuffer.cs:123 
[mono]   at Microsoft.Xna.Framework.Audio.OALSoundBuffer.Finalize () [0x00000] in /Volumes/Docs/development/Xamarin/MonoGame/MonoGame.Framework/Audio/OALSoundBuffer.cs:45 

You should probably post this as an issue on the monogame github. Thanks!

Hey @BitBull I’m having the same problem and don’t have a physical device to test.

If I try to load my game on a Genymotion emulator with 2.3.7 it says DllImport attempting to load: ‘openal32.dll’. but can’t find it, even though I check inside the .apk and it’s there. On devices running 4+ and emulators running 4+ I have no problems.

Did you find a workaround?

Hi There,

I never found a solution I’m afraid. Nor did I get to test on a 2.x device - please post here if you do…

That reminds me that I need to report that exception issue on GitHub too!

cheers

Well I’ve finally got a 2.3 device - Google Nexus One/HTC Passion running 2.3.6.

Pleased to say that audio seems to be working fine - both SoundEffect and Song.

cheers

1 Like

Well that’s really good to hear man, thanks for updating!