never call setVolume with values > 1.0f
This commit is contained in:
parent
40d29f63fa
commit
adfd112a3f
@ -21,7 +21,6 @@ import android.util.LruCache;
|
|||||||
import ch.blinkenlights.bastp.Bastp;
|
import ch.blinkenlights.bastp.Bastp;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
public class BastpUtil {
|
public class BastpUtil {
|
||||||
private RGLruCache rgCache;
|
private RGLruCache rgCache;
|
||||||
@ -35,7 +34,7 @@ public class BastpUtil {
|
|||||||
*/
|
*/
|
||||||
public float[] getReplayGainValues(String path) {
|
public float[] getReplayGainValues(String path) {
|
||||||
float[] cached = rgCache.get(path);
|
float[] cached = rgCache.get(path);
|
||||||
Log.d("VanillaMusic", "LRU cache("+rgCache.size()+"): "+path+" -> "+cached);
|
|
||||||
if(cached == null) {
|
if(cached == null) {
|
||||||
cached = getReplayGainValuesFromFile(path);
|
cached = getReplayGainValuesFromFile(path);
|
||||||
rgCache.put(path, cached);
|
rgCache.put(path, cached);
|
||||||
|
@ -643,8 +643,11 @@ public final class PlaybackService extends Service
|
|||||||
}
|
}
|
||||||
|
|
||||||
float rg_result = (float)Math.pow(10, (adjust/20) );
|
float rg_result = (float)Math.pow(10, (adjust/20) );
|
||||||
|
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 */
|
||||||
|
}
|
||||||
|
|
||||||
mp.setVolume(rg_result, rg_result);
|
mp.setVolume(rg_result, rg_result);
|
||||||
Log.d("VanillaMusic", "rg="+rg_result+", adj="+adjust+", pth="+path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public float[] getReplayGainValues(String path) {
|
public float[] getReplayGainValues(String path) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user