diff options
Diffstat (limited to 'firmware/target/hosted/android/pcm-android.c')
-rw-r--r-- | firmware/target/hosted/android/pcm-android.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/firmware/target/hosted/android/pcm-android.c b/firmware/target/hosted/android/pcm-android.c index f4ed4b1b33..4b6df7f878 100644 --- a/firmware/target/hosted/android/pcm-android.c +++ b/firmware/target/hosted/android/pcm-android.c | |||
@@ -25,8 +25,6 @@ | |||
25 | #include "debug.h" | 25 | #include "debug.h" |
26 | #include "pcm.h" | 26 | #include "pcm.h" |
27 | 27 | ||
28 | extern JNIEnv *env_ptr; | ||
29 | |||
30 | /* infos about our pcm chunks */ | 28 | /* infos about our pcm chunks */ |
31 | static size_t pcm_data_size; | 29 | static size_t pcm_data_size; |
32 | static char *pcm_data_start; | 30 | static char *pcm_data_start; |
@@ -117,6 +115,8 @@ void pcm_play_dma_start(const void *addr, size_t size) | |||
117 | 115 | ||
118 | void pcm_play_dma_stop(void) | 116 | void pcm_play_dma_stop(void) |
119 | { | 117 | { |
118 | JNIEnv *env_ptr = getJavaEnvironment(); | ||
119 | |||
120 | (*env_ptr)->CallVoidMethod(env_ptr, | 120 | (*env_ptr)->CallVoidMethod(env_ptr, |
121 | RockboxPCM_instance, | 121 | RockboxPCM_instance, |
122 | stop_method); | 122 | stop_method); |
@@ -124,6 +124,8 @@ void pcm_play_dma_stop(void) | |||
124 | 124 | ||
125 | void pcm_play_dma_pause(bool pause) | 125 | void pcm_play_dma_pause(bool pause) |
126 | { | 126 | { |
127 | JNIEnv *env_ptr = getJavaEnvironment(); | ||
128 | |||
127 | (*env_ptr)->CallVoidMethod(env_ptr, | 129 | (*env_ptr)->CallVoidMethod(env_ptr, |
128 | RockboxPCM_instance, | 130 | RockboxPCM_instance, |
129 | play_pause_method, | 131 | play_pause_method, |
@@ -152,6 +154,7 @@ void pcm_play_dma_init(void) | |||
152 | * Luckily we only reference the PCM object from here, so it's safe (and | 154 | * Luckily we only reference the PCM object from here, so it's safe (and |
153 | * clean) to allocate it here | 155 | * clean) to allocate it here |
154 | **/ | 156 | **/ |
157 | JNIEnv *env_ptr = getJavaEnvironment(); | ||
155 | JNIEnv e = *env_ptr; | 158 | JNIEnv e = *env_ptr; |
156 | /* get the class and its constructor */ | 159 | /* get the class and its constructor */ |
157 | jclass RockboxPCM_class = e->FindClass(env_ptr, "org/rockbox/RockboxPCM"); | 160 | jclass RockboxPCM_class = e->FindClass(env_ptr, "org/rockbox/RockboxPCM"); |
@@ -169,6 +172,8 @@ void pcm_play_dma_init(void) | |||
169 | 172 | ||
170 | void pcm_deinit(void) | 173 | void pcm_deinit(void) |
171 | { | 174 | { |
175 | JNIEnv *env_ptr = getJavaEnvironment(); | ||
176 | |||
172 | (*env_ptr)->DeleteGlobalRef(env_ptr, RockboxPCM_instance); | 177 | (*env_ptr)->DeleteGlobalRef(env_ptr, RockboxPCM_instance); |
173 | } | 178 | } |
174 | 179 | ||
@@ -178,5 +183,7 @@ void pcm_postinit(void) | |||
178 | 183 | ||
179 | void pcm_set_mixer_volume(int volume) | 184 | void pcm_set_mixer_volume(int volume) |
180 | { | 185 | { |
186 | JNIEnv *env_ptr = getJavaEnvironment(); | ||
187 | |||
181 | (*env_ptr)->CallVoidMethod(env_ptr, RockboxPCM_instance, set_volume_method, volume); | 188 | (*env_ptr)->CallVoidMethod(env_ptr, RockboxPCM_instance, set_volume_method, volume); |
182 | } | 189 | } |