OpenAL on Android: Is this a threading issue?
![Post Post](./styles/pm3/imageset/icon_post_target.gif)
Hello,
I've taken upon a rather ambitious game dev project using Edgelib as middleware. I've stumbled through all of my other concerns (rather valiantly lol
but this one I'm rather stumped on.
The game project required OGG Vorbis for the background audio, and obviously as Hekkus offered no such functionality and we are still seeking cross-platform portability, I had decided to implement OpenAL Soft for such uses, with the tremolo library for very quick ogg vorbis file decoding. After a bit I got OpenAL Soft to run as it should ~ sound effects work as they should, etc. I've finally gotten the music to start streaming, too, but then the issue arises.
Depending on the size of the buffers, the music will play for some bit of time (note that I set the initial buffers in the ESound_LoadMusic function) ~ somewhere between the load function and the play function, however, the file it seems is either seemingly deleted (*sometimes* you see a GC_CONCURRENT notice in the Android log saying that it has released an amount of memory equal to the size of the ogg file that had been loaded via a package) or otherwise un-accessible when a buffer needs to be updated with more decoded data.
I may very well just be reaching, here, but I was wondering if this is a threading issue - it loads the file in a separate thread, so the play/decode functions don't have the same access to this data (if it isn't, in fact, already purged from memory). What led me to think this is that when I move all of the initializing functions (setting the ogg_file, etc) to the ESound_PlayMusic function, it immediately crashes as soon as it gets to trying to decode any data supposedly stored in a SOUND_MUSIC struct.
Just trying to figure out how to handle that situation, as I'm wellllll into (further) murky waters when it comes to threading ~ I've very little hands-on experience in that realm of development... I guess this'd be a great way to be introduced ha.
Any help would be more than appreciated ~ any further details, I'm happy to provide.
Bests,
Cory
Coreman2200
I've taken upon a rather ambitious game dev project using Edgelib as middleware. I've stumbled through all of my other concerns (rather valiantly lol
![Smile :)](./images/smilies/icon_smile.gif)
The game project required OGG Vorbis for the background audio, and obviously as Hekkus offered no such functionality and we are still seeking cross-platform portability, I had decided to implement OpenAL Soft for such uses, with the tremolo library for very quick ogg vorbis file decoding. After a bit I got OpenAL Soft to run as it should ~ sound effects work as they should, etc. I've finally gotten the music to start streaming, too, but then the issue arises.
Depending on the size of the buffers, the music will play for some bit of time (note that I set the initial buffers in the ESound_LoadMusic function) ~ somewhere between the load function and the play function, however, the file it seems is either seemingly deleted (*sometimes* you see a GC_CONCURRENT notice in the Android log saying that it has released an amount of memory equal to the size of the ogg file that had been loaded via a package) or otherwise un-accessible when a buffer needs to be updated with more decoded data.
I may very well just be reaching, here, but I was wondering if this is a threading issue - it loads the file in a separate thread, so the play/decode functions don't have the same access to this data (if it isn't, in fact, already purged from memory). What led me to think this is that when I move all of the initializing functions (setting the ogg_file, etc) to the ESound_PlayMusic function, it immediately crashes as soon as it gets to trying to decode any data supposedly stored in a SOUND_MUSIC struct.
Just trying to figure out how to handle that situation, as I'm wellllll into (further) murky waters when it comes to threading ~ I've very little hands-on experience in that realm of development... I guess this'd be a great way to be introduced ha.
Any help would be more than appreciated ~ any further details, I'm happy to provide.
Bests,
Cory
Coreman2200