summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/android/pcm-android.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/hosted/android/pcm-android.c')
-rw-r--r--firmware/target/hosted/android/pcm-android.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/firmware/target/hosted/android/pcm-android.c b/firmware/target/hosted/android/pcm-android.c
index c8bc410a54..f4ed4b1b33 100644
--- a/firmware/target/hosted/android/pcm-android.c
+++ b/firmware/target/hosted/android/pcm-android.c
@@ -35,7 +35,6 @@ static char *pcm_data_start;
35static jmethodID play_pause_method; 35static jmethodID play_pause_method;
36static jmethodID stop_method; 36static jmethodID stop_method;
37static jmethodID set_volume_method; 37static jmethodID set_volume_method;
38static jclass RockboxPCM_class;
39static jobject RockboxPCM_instance; 38static jobject RockboxPCM_instance;
40 39
41 40
@@ -155,10 +154,11 @@ void pcm_play_dma_init(void)
155 **/ 154 **/
156 JNIEnv e = *env_ptr; 155 JNIEnv e = *env_ptr;
157 /* get the class and its constructor */ 156 /* get the class and its constructor */
158 RockboxPCM_class = e->FindClass(env_ptr, "org/rockbox/RockboxPCM"); 157 jclass RockboxPCM_class = e->FindClass(env_ptr, "org/rockbox/RockboxPCM");
159 jmethodID constructor = e->GetMethodID(env_ptr, RockboxPCM_class, "<init>", "()V"); 158 jmethodID constructor = e->GetMethodID(env_ptr, RockboxPCM_class, "<init>", "()V");
160 /* instance = new RockboxPCM() */ 159 /* instance = new RockboxPCM() */
161 RockboxPCM_instance = e->NewObject(env_ptr, RockboxPCM_class, constructor); 160 jobject PCM_instance = e->NewObject(env_ptr, RockboxPCM_class, constructor);
161 RockboxPCM_instance = e->NewGlobalRef(env_ptr, PCM_instance);
162 /* cache needed methods */ 162 /* cache needed methods */
163 play_pause_method = e->GetMethodID(env_ptr, RockboxPCM_class, "play_pause", "(Z)V"); 163 play_pause_method = e->GetMethodID(env_ptr, RockboxPCM_class, "play_pause", "(Z)V");
164 set_volume_method = e->GetMethodID(env_ptr, RockboxPCM_class, "set_volume", "(I)V"); 164 set_volume_method = e->GetMethodID(env_ptr, RockboxPCM_class, "set_volume", "(I)V");
@@ -167,6 +167,11 @@ void pcm_play_dma_init(void)
167 pcm_play_get_more_callback((void*)&pcm_data_start, &pcm_data_size); 167 pcm_play_get_more_callback((void*)&pcm_data_start, &pcm_data_size);
168} 168}
169 169
170void pcm_deinit(void)
171{
172 (*env_ptr)->DeleteGlobalRef(env_ptr, RockboxPCM_instance);
173}
174
170void pcm_postinit(void) 175void pcm_postinit(void)
171{ 176{
172} 177}