I’m trying to build the latest Develop version of Monogame, and there appears to be issues with building against any version prior to 4.2.
In specyfic in OpenALSoundController.cs i get 5 error regarding Android.Media.AudioManager…
It looks like you are targeting a lower version of Android. You need to target Android 4.2 API 17 JellyBean. Change this in your Project Options, under Build -> General -> Target Framework
You can then set under Build -> Android Application -> Minimum Android Version to be Android 4.0 API Level 14. (You may be able to set it to Android 2.3 API 10 but I’m having problems with OpenAL not loading there, but I don’t know if it’s my emulator since I don’t have access to a 2.3 device.) So to be safe, use minimum version 4.0
Yes, this was exactly my question,doesn’t sound really sane to cut out almost 50% of android devices, so i guess this wasn’t a choice but is actually a Monogame bug of the development branch.
https://developer.android.com/about/dashboards/index.html?utm_source=ausdroid.net
PS. Building against 4.0 or 4.1 doesn’t work either for the above problems.
Sorry, just reread your question. Yes, you have to build using 4.2, but you can set the minimum target to 4.0. So really you’re just leaving out 2.3 and 3.0 devices.
Even then 2.3 works for me (just not OpenAL)
So is it possible to build opting out openal and target 2.3? Do i have to do it with build precompilation codes or manually with protobuild?
I don’t know… This is the commit that changed how audio works on Android.
You could try to reverse those changes for 2.3? I’m seriously considering it because the lag on devices below 4.2 is very, very noticeable.
Then again, no one will play my shitty games so maybe it’s too much trouble for nothing.
Yeah, i think it might require a compilation symbol since you get compilation errors on pre 4.2.
I just tried your branch and it totally works. I really need an actual 2.3 device to properly test things out though.
One thing. Is there a way to only include the libopenal32.so files when OPENAL constant is defined? As in, only add this item group…
EDIT: Ok, found out how to do it by modifying the .csproj directly but not the protobuild definition, so I’ll keep checking. but if add this condition to the item group:
<ItemGroup Condition="$(DefineConstants.Contains('OPENAL'))">
<EmbeddedNativeLibrary Include="..\ThirdParty\Dependencies\openal-soft\libs\armeabi-v7a\libopenal32.so">
<Platforms>Android,Ouya</Platforms>
<Link>libs\armeabi-v7a\libopenal32.so</Link>
</EmbeddedNativeLibrary>
<EmbeddedNativeLibrary Include="..\ThirdParty\Dependencies\openal-soft\libs\armeabi\libopenal32.so">
<Platforms>Android,Ouya</Platforms>
<Link>libs\armeabi\libopenal32.so</Link>
</EmbeddedNativeLibrary>
<EmbeddedNativeLibrary Include="..\ThirdParty\Dependencies\openal-soft\libs\x86\libopenal32.so">
<Platforms>Android,Ouya</Platforms>
<Link>libs\x86\libopenal32.so</Link>
</EmbeddedNativeLibrary>
</ItemGroup>
It won’t add those 3 libs to the MonoGame.Framework.dll saving you like 600 KB.
Latest develop has working sound on Android 2.3 - 4.4. I load .wav files, not processed by content builder. OGG format is no more supported since OpenAL was implemented.
@andrey_timofeev did you test sound on 2.3 on an emulator or device? I haven’t been able to load OpenAL on emulator.
It works on my 2.3.6 device.
This is the test project that demonstrates loading and looped playing of .WAV sound file (built with MonoGame 9ae3fe3bf09daabf65c3e458b9dac850a9ef243e 20.08.2014).
Thank you for taking the time to test this.
I tried your project using Genymotion emulator set to 2.3.7 and it doesn’t work (OpenAL exception as usual), so now I’m sure the problem is with the x86 emulator and not MonoGame.
Thanks again!