Are there any methods to play audio files using c/c++ NOT JAVA CODE?
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
http://code.google.com/p/android/issues/detail?id=3434
Star the issue if you want to be notified whether Google ever takes
notice. At the moment it doesn't even have an owner, and so I assume no
one at Google cares. :(
This is a symptom of a pretty major problem: Many issues in issue
tracker seem to be neglected or (apparently) ignored, not just for days
or weeks, but many months. This issue, for example, doesn't have any
apparent attention from Google since Sept of 2009, despite being a
rather crucial missing feature for Android. Developers would appreciate
a bit more transparency, so we'd know that someone at Google is at least
AWARE that this critical issue has been sitting around for over a year,
though what we'd really like, of course, is a complete API so Android
can actually support interactive music apps, which it currently can't.
Tim
The best solution currently available is to write a c++ wrapper that mimics the Java AudioTrack class. In the constructor, cache the method IDs in private variables, and in each method, just do the JNI work to convert to Java, and call the Java methods. This is an instance of the Adapter design pattern. You can even alter the interface to keep track of more information, like a timestamp for when play was called, so that you can always get at the current position of the actual playback head (getPlaybackHeadPosition just gives you the amount of data you've written) with a little math ((current time - play time) * samples per second), and hope that it has maintained realtime. You can add some more helper functions to simplify the C++ interface.
Then you end up with a nice class that you can call from c++ code, without having to scatter all that JNI throughout your code. Still not the greatest solution, but the best available.
I found it.
http://repo.or.cz/w/openal-soft/android.git/blob/HEAD:/Alc/android.c
It is a part of OpenAL software implementation for Android.
http://repo.or.cz/w/openal-soft/android.git
sakamoto
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
javaVM->GetEnv((void**)&env, JNI_VERSION_1_2);
Note, I haven't tried this, but that's the convention.