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 java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
import android.util.Log;
|
||||
|
||||
public class BastpUtil {
|
||||
private RGLruCache rgCache;
|
||||
@ -35,7 +34,7 @@ public class BastpUtil {
|
||||
*/
|
||||
public float[] getReplayGainValues(String path) {
|
||||
float[] cached = rgCache.get(path);
|
||||
Log.d("VanillaMusic", "LRU cache("+rgCache.size()+"): "+path+" -> "+cached);
|
||||
|
||||
if(cached == null) {
|
||||
cached = getReplayGainValuesFromFile(path);
|
||||
rgCache.put(path, cached);
|
||||
|
@ -643,8 +643,11 @@ public final class PlaybackService extends Service
|
||||
}
|
||||
|
||||
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);
|
||||
Log.d("VanillaMusic", "rg="+rg_result+", adj="+adjust+", pth="+path);
|
||||
}
|
||||
|
||||
public float[] getReplayGainValues(String path) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user