summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-08-14 13:38:10 +0000
committerThomas Martitz <kugel@rockbox.org>2011-08-14 13:38:10 +0000
commitdbdbc242acf09a73fb48483993fb290a595acc57 (patch)
tree660e7359ee1b5806dc5ca202af2de9c7aa50a184
parent2d0e63e1366c1f75899171d2123b9dd4600b1f59 (diff)
downloadrockbox-dbdbc242acf09a73fb48483993fb290a595acc57.tar.gz
rockbox-dbdbc242acf09a73fb48483993fb290a595acc57.zip
Remove hosted_get_volume(), as event data is available in button_get_data().
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30300 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/misc.c4
-rw-r--r--firmware/export/system.h4
-rw-r--r--firmware/target/hosted/android/pcm-android.c19
3 files changed, 6 insertions, 21 deletions
diff --git a/apps/misc.c b/apps/misc.c
index 83e42cf3e0..b57e84efb3 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -622,7 +622,9 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame
622 case SYS_VOLUME_CHANGED: 622 case SYS_VOLUME_CHANGED:
623 { 623 {
624 static bool firstvolume = true; 624 static bool firstvolume = true;
625 int volume = hosted_get_volume(); 625 /* kludge: since this events go to the button_queue,
626 * event data is available in the last button data */
627 int volume = button_get_data();
626 DEBUGF("SYS_VOLUME_CHANGED: %d\n", volume); 628 DEBUGF("SYS_VOLUME_CHANGED: %d\n", volume);
627 if (global_settings.volume != volume) { 629 if (global_settings.volume != volume) {
628 global_settings.volume = volume; 630 global_settings.volume = volume;
diff --git a/firmware/export/system.h b/firmware/export/system.h
index 0f709cdae6..5128801725 100644
--- a/firmware/export/system.h
+++ b/firmware/export/system.h
@@ -143,10 +143,6 @@ int get_cpu_boost_counter(void);
143#undef swap32 143#undef swap32
144#endif 144#endif
145 145
146#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(PLATFORM_HAS_VOLUME_CHANGE)
147int hosted_get_volume(void);
148#endif
149
150/* Get the byte offset of a type's member */ 146/* Get the byte offset of a type's member */
151#define OFFSETOF(type, membername) ((off_t)&((type *)0)->membername) 147#define OFFSETOF(type, membername) ((off_t)&((type *)0)->membername)
152 148
diff --git a/firmware/target/hosted/android/pcm-android.c b/firmware/target/hosted/android/pcm-android.c
index cbd6cb3228..3143bc90ec 100644
--- a/firmware/target/hosted/android/pcm-android.c
+++ b/firmware/target/hosted/android/pcm-android.c
@@ -224,16 +224,6 @@ void pcm_shutdown(void)
224 e->CallVoidMethod(env_ptr, RockboxPCM_instance, release); 224 e->CallVoidMethod(env_ptr, RockboxPCM_instance, release);
225 pthread_mutex_destroy(&audio_lock_mutex); 225 pthread_mutex_destroy(&audio_lock_mutex);
226} 226}
227
228/* Due to limitations of default_event_handler(), parameters gets swallowed when
229 * being posted with queue_broadcast(), so workaround this by caching the last
230 * value.
231 */
232static int lastPostedVolume = -1;
233int hosted_get_volume(void)
234{
235 return lastPostedVolume;
236}
237 227
238JNIEXPORT void JNICALL 228JNIEXPORT void JNICALL
239Java_org_rockbox_RockboxPCM_postVolumeChangedEvent(JNIEnv *env, 229Java_org_rockbox_RockboxPCM_postVolumeChangedEvent(JNIEnv *env,
@@ -242,10 +232,7 @@ Java_org_rockbox_RockboxPCM_postVolumeChangedEvent(JNIEnv *env,
242{ 232{
243 (void) env; 233 (void) env;
244 (void) this; 234 (void) this;
245 235 /* for the main queue, the volume will be available through
246 if (volume != lastPostedVolume) 236 * button_get_data() */
247 { 237 queue_broadcast(SYS_VOLUME_CHANGED, volume);
248 lastPostedVolume = volume;
249 queue_broadcast(SYS_VOLUME_CHANGED, 0);
250 }
251} 238}