summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2011-03-31 07:04:44 +0000
committerBjörn Stenberg <bjorn@haxx.se>2011-03-31 07:04:44 +0000
commitce755dd9c59dd16783bc9e94a4475a283c3e6996 (patch)
treee4637804ad7ecd1cfbe68e903c6128f45da6b494 /android
parent277b8fba7149f0825e61d3112acbaac1b3a04bce (diff)
Only set volume on SYS_VOLUME_CHANGED the first time. Workaround for FS#12034.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29663 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'android')
-rw-r--r--android/src/org/rockbox/RockboxPCM.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/android/src/org/rockbox/RockboxPCM.java b/android/src/org/rockbox/RockboxPCM.java
index 7d01da6150..47bc42f976 100644
--- a/android/src/org/rockbox/RockboxPCM.java
+++ b/android/src/org/rockbox/RockboxPCM.java
@@ -85,9 +85,19 @@ public class RockboxPCM extends AudioTrack
pcmrange = getMaxVolume() - minpcmvolume;
setupVolumeHandler();
+ postVolume(audiomanager.getStreamVolume(streamtype));
}
private native void postVolumeChangedEvent(int volume);
+
+ private void postVolume(int volume)
+ {
+ int rbvolume = ((maxstreamvolume - volume) * -99) /
+ maxstreamvolume;
+ LOG("java:postVolumeChangedEvent, avol "+volume+" rbvol "+rbvolume);
+ postVolumeChangedEvent(rbvolume);
+ }
+
private void setupVolumeHandler()
{
BroadcastReceiver broadcastReceiver = new BroadcastReceiver()
@@ -105,9 +115,7 @@ public class RockboxPCM extends AudioTrack
volume != setstreamvolume &&
rbservice.isRockboxRunning())
{
- int rbvolume = ((maxstreamvolume - volume) * -99) /
- maxstreamvolume;
- postVolumeChangedEvent(rbvolume);
+ postVolume(volume);
}
}
};
@@ -190,6 +198,7 @@ public class RockboxPCM extends AudioTrack
private void set_volume(int volume)
{
+ LOG("java:set_volume("+volume+")");
/* Rockbox 'volume' is 0..-990 deci-dB attenuation.
Android streams have rather low resolution volume control,
typically 8 or 15 steps.
@@ -209,6 +218,7 @@ public class RockboxPCM extends AudioTrack
int oldstreamvolume = audiomanager.getStreamVolume(streamtype);
if (streamvolume != oldstreamvolume) {
+ LOG("java:setStreamVolume("+streamvolume+")");
setstreamvolume = streamvolume;
audiomanager.setStreamVolume(streamtype, streamvolume, 0);
}