As it stands, I have a C++ app that has a unsigned char* buffer containing PCM audio data. I need to call the Android API method AudioTrack.write() on an instance of AudioTrack over JNI (from C++ to Java) with this data, and I would like to avoid making an extra copy in doing so. Can I do this?
AudioTrack accepts as one of its arguments a Java byte[], the argument that should correspond to my PCM data (unsigned char*).
Sorry if this is a duplicate... it's hard to effectively search for this kind of thing.
GetPrimitiveArrayCritical()andReleasePrimitiveArrayCritical(), but I wouldn't recommend it. A better idea: Ask the Android team to support NIO buffers instead of (or in addition to) arrays...