Decoding mp3 to PCM in Android?

Good day. Faced one problem when developing games.


Originally the game was developed for iOS, so the game engine in C++, OpenAL for sounds. IOS had no problems with the decoding of music. Under Android, everything is more difficult...


Just note:

1) No, you can't translate mp3 in wav, as it will take a lot of space.

2) No, I will not be able to play sounds through Java calling methods from C++, as there will be delays, etc.


As you know, in 16 version the API appeared MediaCodec. You can use it for new devices, but we need support and older (3.0+).


I tried to use JLayer. But decoding our files sound takes 30-50 seconds, which is unacceptable.


Still have mpg123 and Libmad. They might be faster.

Still, as far as I know, OpenSL supports decoding mp3 with 4.0.

So, two questions:

1) If someone worked with these libraries, can prompt, what to choose/what is faster?

2) All C++ libs to work with FILE handler, as you know, all the resources of the assets Packed in .apk, so read them only using AAssetManager. What these can do? In the case of .ogg Vorbis allows most methods to read a file to determine the AAssetManager was not. Similar to mpg123 and Libmad saw.
October 3rd 19 at 02:23
1 answer
October 3rd 19 at 02:25
maybe this is Your case: stackoverflow.com/questions/10770979/is-it-possible-to-get-a-byte-buffer-directly-from-an-audio-asset-in-opensl-es-f/18863797#18863797

I have a very OpenSL perfectly plays mp3, but there are problems with delays, which in my case is not critical.

Find more questions by tags Android