1
0
Fork 0
forked from len0rd/rockbox

Android: Implement app shutdown and thus, sleep timer.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29602 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2011-03-16 15:17:24 +00:00
parent 046cec3aa7
commit 8c46ddf9d7
5 changed files with 48 additions and 14 deletions

View file

@ -36,6 +36,7 @@ static char *pcm_data_start;
static jmethodID play_pause_method;
static jmethodID stop_method;
static jmethodID set_volume_method;
static jclass RockboxPCM_class;
static jobject RockboxPCM_instance;
@ -159,7 +160,7 @@ void pcm_play_dma_init(void)
**/
JNIEnv e = *env_ptr;
/* get the class and its constructor */
jclass RockboxPCM_class = e->FindClass(env_ptr, "org/rockbox/RockboxPCM");
RockboxPCM_class = e->FindClass(env_ptr, "org/rockbox/RockboxPCM");
jmethodID constructor = e->GetMethodID(env_ptr, RockboxPCM_class, "<init>", "()V");
/* instance = new RockboxPCM() */
RockboxPCM_instance = e->NewObject(env_ptr, RockboxPCM_class, constructor);
@ -180,6 +181,15 @@ void pcm_set_mixer_volume(int volume)
(*env_ptr)->CallVoidMethod(env_ptr, RockboxPCM_instance, set_volume_method, volume);
}
/*
* release audio resources */
void pcm_shutdown(void)
{
JNIEnv e = *env_ptr;
jmethodID release = e->GetMethodID(env_ptr, RockboxPCM_class, "release", "()V");
e->CallVoidMethod(env_ptr, RockboxPCM_instance, release);
}
/* Due to limitations of default_event_handler(), parameters gets swallowed when
* being posted with queue_broadcast(), so workaround this by caching the last
* value.