I'm confused as to how to set pitch natively on Android. I tried altering the native-sound sample from the NDK which uses OpenSL ES, but I get a SL_RESULT_FEATURE_UNSUPPORTED for pretty much anything related to pitch upon requesting the interface. Interfaces tried: SL_IID_PITCH, SL_IID_RATEPITCH, SL_3DDOPPLER
// create audio player
const SLInterfaceID ids[3] = { SL_IID_BUFFERQUEUE, SL_IID_PITCH, SL_IID_VOLUME};
const SLboolean req[3] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE};
result = (*engineEngine)->CreateAudioPlayer(engineEngine, &bqPlayerObject, &audioSrc, &audioSnk,
3, ids, req);
assert(SL_RESULT_SUCCESS == result);
result is always SL_RESULT_UNSUPPORTED
My target is android-19. I tried many others as well to no avail. Am I doing something wrong? Is there an alternative that doesn't require using Java?
Thanks!
Android has a minimal implementation of OpenSL, and none of those interfaces are supported. You can find a description of what is supported (and what has been added) in the NDK docs, or here - the link is the exact same as the documentation from the NDK.
Unfortunately, there is no easy alternative besides writing your own algorithm to alter the PCM data.