aboutsummaryrefslogtreecommitdiff
path: root/src/github/daneren2005
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-05-05 06:31:45 -0700
committerScott Jackson <daneren2005@gmail.com>2014-05-05 06:31:45 -0700
commitc35a789d53c1274191749572d8c25965b0aeae6f (patch)
tree42d36768ca603d8a0bb58b90d0a8b23660a0f34b /src/github/daneren2005
parent447db0ee4bbac03b6adc19977d9a40e72b90fddc (diff)
parent6caa792b3545be0d020c4f54e76ef18ad8d9faf3 (diff)
downloaddsub-c35a789d53c1274191749572d8c25965b0aeae6f.tar.gz
dsub-c35a789d53c1274191749572d8c25965b0aeae6f.tar.bz2
dsub-c35a789d53c1274191749572d8c25965b0aeae6f.zip
Merge branch 'EQ' of https://github.com/daneren2005/Subsonic
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r--src/github/daneren2005/dsub/fragments/EqualizerFragment.java32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/github/daneren2005/dsub/fragments/EqualizerFragment.java b/src/github/daneren2005/dsub/fragments/EqualizerFragment.java
index 4bdb1716..de6b5e0a 100644
--- a/src/github/daneren2005/dsub/fragments/EqualizerFragment.java
+++ b/src/github/daneren2005/dsub/fragments/EqualizerFragment.java
@@ -146,7 +146,17 @@ public class EqualizerFragment extends SubsonicFragment {
@Override
public boolean onContextItemSelected(MenuItem menuItem) {
short preset = (short) menuItem.getItemId();
- equalizer.usePreset(preset);
+ for(int i = 0; i < 10; i++) {
+ try {
+ equalizer.usePreset(preset);
+ i = 10;
+ } catch (UnsupportedOperationException e) {
+ equalizerController.release();
+ equalizer = equalizerController.getEqualizer();
+ bass = equalizerController.getBassBoost();
+ loudnessEnhancer = equalizerController.getLoudnessEnhancerController();
+ }
+ }
updateBars(false);
return true;
}
@@ -156,8 +166,18 @@ public class EqualizerFragment extends SubsonicFragment {
SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean(Constants.PREFERENCES_EQUALIZER_ON, enabled);
editor.commit();
- equalizer.setEnabled(enabled);
- updateBars(true);
+ for(int i = 0; i < 10; i++) {
+ try {
+ equalizer.setEnabled(enabled);
+ updateBars(true);
+ i = 10;
+ } catch (UnsupportedOperationException e) {
+ equalizerController.release();
+ equalizer = equalizerController.getEqualizer();
+ bass = equalizerController.getBassBoost();
+ loudnessEnhancer = equalizerController.getLoudnessEnhancerController();
+ }
+ }
}
private void updateBars(boolean changedEnabled) {
@@ -186,11 +206,7 @@ public class EqualizerFragment extends SubsonicFragment {
} else if(setLevel > maxEQLevel) {
setLevel = maxEQLevel;
}
- try {
- equalizer.setBandLevel(band, setLevel);
- } catch(Exception e) {
- Log.w(TAG, "Failed to set band level");
- }
+ equalizer.setBandLevel(band, setLevel);
} else if(!isEnabled) {
bar.setProgress(-minEQLevel);
}