1
0
Fork 0
forked from len0rd/rockbox

Listen to and follow external Android volume changes. (Based on FS#11914 by Maurus Cuelenaere)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29586 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2011-03-14 12:25:48 +00:00
parent 606bed035e
commit e50cc0e3d7
8 changed files with 95 additions and 3 deletions

View file

@ -179,3 +179,28 @@ void pcm_set_mixer_volume(int volume)
(*env_ptr)->CallVoidMethod(env_ptr, RockboxPCM_instance, set_volume_method, volume);
}
/* Due to limitations of default_event_handler(), parameters gets swallowed when
* being posted with queue_broadcast(), so workaround this by caching the last
* value.
*/
static int lastPostedVolume = -1;
int hosted_get_volume(void)
{
return lastPostedVolume;
}
JNIEXPORT void JNICALL
Java_org_rockbox_RockboxPCM_postVolumeChangedEvent(JNIEnv *env,
jobject this,
jint volume)
{
(void) env;
(void) this;
if (volume != lastPostedVolume)
{
lastPostedVolume = volume;
queue_broadcast(SYS_VOLUME_CHANGED, 0);
}
}