Game Development Reference
In-Depth Information
jni_printf("BUG: Invalid JNI method method OnStartSound (I)V");
return ;
}
// Call Java method wolf.jni.OnStartSound(int idx)
(*env)->CallStaticVoidMethod(env, jNativesCls
, jStartSoundMethod
, (jint) idx);
}
void jni_start_music (int idx)
{
/*
* Attach to the curr thread otherwise we get JNI WARNING:
* threadid=3 using env from threadid=15 which aborts the VM
*/
JNIEnv *env;
if ( !g_VM) {
return;
}
if ( !jNativesCls ) {
printf("JNIStartMusic: No JNI interface\n");
return;
}
(*g_VM)->AttachCurrentThread (g_VM, (void **) &env, NULL);
jmethodID mid = (*env)->GetStaticMethodID(env, jNativesCls
, "OnStartMusic"
, "(I)V");
if (mid) {
(*env)->CallStaticVoidMethod(env, jNativesCls
, mid
, (jint) idx);
}
}
// In sd_null.c
extern void jni_start_sound (int idx);
extern void jni_start_music (int idx);
boolean SD_PlaySoundWL6(soundnamesWL6 sound)
{
// New code for Android
jni_start_sound (sound);
return true;
}
Search WWH ::




Custom Search