3
votes

I have been developing a music editing Android app. I have written a considerable amount of code so far. However, due to audio latency issues encountered on the Android platform, I now realize that it is necessary to optimize my code using C/C++ (Android NDK) in order to manipulate audio files (Wav & MP3), and thus, hopefully, boost the app performance. Unfortunately, I wasn't able to find concise resources dealing with the topic.

Could anybody post code examples on how to decode wav/mp3 files and mix them using C++? Any resource would be greatly appreciated.

1
Usually file-reading does not cause latency issues; rather processing does. what are you trying to accomplish, exactly?Bjorn Roche
I would like to mix audio files using c++.Ziki Kongawi
If you are having latency issues simply mixing two files you probably have a design/architecture issue. Switching to C++ might help, but if you have the same design, it might not.Bjorn Roche

1 Answers

3
votes

Here is a simple example for loading a wave file using C/C++. It will help you get the ideas :)

As far as playing it .. you would probably be best off using OpenSLES which is supported under the NDK on android.