diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-09-22 15:55:08 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-09-22 15:55:08 -0700 |
commit | 2b68dad21ad76cafdb51b1f8d50793735a54260a (patch) | |
tree | 2f453266d710480f55bdfbf615bd0aaede41480a /src/github | |
parent | 13587d80273b19125e5bd8c7a6ccbb9dcd7e2d93 (diff) | |
download | dsub-2b68dad21ad76cafdb51b1f8d50793735a54260a.tar.gz dsub-2b68dad21ad76cafdb51b1f8d50793735a54260a.tar.bz2 dsub-2b68dad21ad76cafdb51b1f8d50793735a54260a.zip |
Keep track of volume set by setVolume, multiply replay gain value by it
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/service/DownloadService.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java index c3eb3ef7..ab302729 100644 --- a/src/github/daneren2005/dsub/service/DownloadService.java +++ b/src/github/daneren2005/dsub/service/DownloadService.java @@ -136,6 +136,7 @@ public class DownloadService extends Service { private boolean keepScreenOn; private int cachedPosition = 0; private boolean downloadOngoing = false; + private float volume = 1.0f; private AudioEffectsController effectsController; private RemoteControlState remoteState = RemoteControlState.LOCAL; @@ -1599,7 +1600,8 @@ public class DownloadService extends Service { public void setVolume(float volume) { if(mediaPlayer != null && (playerState == STARTED || playerState == PAUSED || playerState == STOPPED)) { try { - mediaPlayer.setVolume(volume, volume); + this.volume = volume; + applyReplayGain(mediaPlayer, currentPlaying); } catch(Exception e) { Log.w(TAG, "Failed to set volume"); } @@ -1958,7 +1960,7 @@ public class DownloadService extends Service { // Feature is disabled: Make sure that we are going to 100% volume adjust = 0f; }*/ - float rg_result = ((float) Math.pow(10, (adjust / 20)))/* * mFadeOut*/; + float rg_result = ((float) Math.pow(10, (adjust / 20))) * volume; if (rg_result > 1.0f) { rg_result = 1.0f; /* android would IGNORE the change if this is > 1 and we would end up with the wrong volume */ } else if (rg_result < 0.0f) { |