I am currently assigned with the task of porting a gaming application from iOS to Android and am having quite a bit of a problem with the fmod system within google’s environment.
The API seems to be integrated fine but my problem reside in the sound creation. We are basically using the same application code on both iOS and Android and everything works marvelly on Apple devices and even when compiled on windows, but on Android the Fmod system isn’t able to locate the sounds I am trying to load and create. The function called goes like this:
result = FMOD_System_CreateSound(/Application Sound Engine/, /Sound file relative path/, FMOD_HARDWARE | FMOD_2D | FMOD_CREATESTREAM | FMOD_LOWMEM, 0, &mSound);[/b:288yq04s]
Everytime the [b:288yq04s]FMOD_RESULT[/b:288yq04s]’s returned value is [b:288yq04s]FMOD_ERR_FILE_NOTFOUND[/b:288yq04s] and results in an application crash with the way our engine handles an empty sound further down the line. Looking at the examples provided with the android fmod API, I have seen that most of the times (if not all the times) the sounds are separatly loaded on the SD card, which is something I would really like to avoid dealing with. Our sounds are in ogg format and embedded directly into the apk package inside a directory containing the visual assets and the numerous sounds required for the project. I have tried messing with the build.xml and adding the line [b:288yq04s]<nocompress extension="ogg"/>[/b:288yq04s] which doesn’t seem to change a thing. I know the file path sent is correct, and have even tried to send the engine numerous other paths surrounding the desired file just to be sure, but everytime I got the same result.
So I guess my question is: Is there any way to play sound files directly from the application package and what am I missing in order to be able to do so? Otherwise what would be the best way for me to deal with this problem?
Thank you! 😀
- bbbreimmm asked 5 years ago
As far as I am aware you cannot place loose files inside the APK, they are automatically packed into a resource file. There are APIs available that give you access to the resource files and the data inside, if you wanted to go down that route you could pass the audio data as a pointer and length into FMOD or override the FMOD file callbacks and service them yourself.
If you want to use loose files, I believe the only way is via the SD card, which is why the examples are done in that manner.
Please login first to submit.