Game Development Reference
In-Depth Information
/**
* Fires when a background song is stopped
*/
void jni_stop_music (const char * name)
{
/*
* 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;
}
(*g_VM)->AttachCurrentThread (g_VM, (void **) &env, NULL);
jmethodID mid = (*env)->GetStaticMethodID(env, jNativesCls
, CB_CLASS_STOPM_CB
, CB_CLASS_STOPM_SIG);
if (mid) {
(*env)->CallStaticVoidMethod(env, jNativesCls
, mid
, (*env)->NewStringUTF(env, name)
);
}
}
/**
* Set bg msic vol callback
*/
void jni_set_music_volume (int vol) {
JNIEnv *env;
if ( !g_VM) {
return;
}
(*g_VM)->AttachCurrentThread (g_VM, (void **) &env, NULL);
jmethodID mid = (*env)->GetStaticMethodID(env, jNativesCls
, CB_CLASS_SETMV_CB
, CB_CLASS_SETMV_SIG);
if (mid) {
(*env)->CallStaticVoidMethod(env, jNativesCls
, mid
, (jint) vol
);
}
}
Search WWH ::




Custom Search