Have a look at the nativeMixData function - all JNI methods take an JNIEnv * as their first method, the second one is the object on which the function is called (for our purposes, this is mostly "any" object - I usually pass a pointer to the global object there, but any random pointer should work). The third parameter is a long that you can use to pass an application-specific pointer. The fourth is a pointer to the buffer which is filled with audio data, and the fifth is the length of that buffer. Would be great if you could submit your modules as pull request to apkenv on Github
typedef void (*angrybirds_mixdata_t)(JNIEnv *env, jobject obj, jlong paramLong, jbyteArray paramArrayOfByte, jint paramInt) SOFTFP;
/* Open the audio device */ SDL_AudioSpec *desired, *obtained; desired = malloc(sizeof(SDL_AudioSpec)); obtained = malloc(sizeof(SDL_AudioSpec)); desired->freq=44100; desired->format=AUDIO_S16SYS; desired->channels=2; desired->samples=8192; desired->callback=my_audio_callback; desired->userdata=p0; if( SDL_InitSubSystem(SDL_INIT_AUDIO) < 0 ) exit(-1); if ( SDL_OpenAudio(desired, obtained) < 0 ) exit(-1); free(desired); SDL_PauseAudio(0);
void my_audio_callback(void *ud, Uint8 *stream, int len) { printf("call mixdata (%i)\n",len); jlong tmplong = 0; jbyte* buffer = calloc(len,1); angrybirds_priv.native_mixdata(ENV(global), VM(global), (jlong)&tmplong, buffer, len); memcpy(stream,buffer,len); free(buffer); }