Methods Summary |
---|
private void | getEffect(int session)
synchronized (sInstances) {
if (sInstances.containsKey(session)) {
mBassBoost = sInstances.get(session);
} else {
try{
mBassBoost = new BassBoost(0, session);
} catch (IllegalArgumentException e) {
Log.e(TAG,"BassBoost effect not supported");
} catch (IllegalStateException e) {
Log.e(TAG,"BassBoost cannot get strength supported");
} catch (UnsupportedOperationException e) {
Log.e(TAG,"BassBoost library not loaded");
} catch (RuntimeException e) {
Log.e(TAG,"BassBoost effect not found");
}
sInstances.put(session, mBassBoost);
}
mReleaseButton.setEnabled(false);
mOnOffButton.setEnabled(false);
if (mBassBoost != null) {
if (mSettings != "") {
mBassBoost.setProperties(new BassBoost.Settings(mSettings));
}
mBassBoost.setEnableStatusListener(mEffectListener);
mBassBoost.setControlStatusListener(mEffectListener);
mBassBoost.setParameterListener(mEffectListener);
mReleaseButton.setChecked(true);
mReleaseButton.setEnabled(true);
mOnOffButton.setChecked(mBassBoost.getEnabled());
mOnOffButton.setEnabled(true);
}
}
|
public void | onCheckedChanged(android.widget.CompoundButton buttonView, boolean isChecked)
// OnCheckedChangeListener
if (buttonView.getId() == R.id.bassboostOnOff) {
if (mBassBoost != null) {
mBassBoost.setEnabled(isChecked);
mStrength.updateDisplay();
}
}
if (buttonView.getId() == R.id.bbReleaseButton) {
if (isChecked) {
if (mBassBoost == null) {
getEffect(sSession);
if (mBassBoost != null) {
mStrength.setEffect(mBassBoost);
mStrength.setEnabled(mBassBoost.getStrengthSupported());
}
}
} else {
if (mBassBoost != null) {
mStrength.setEnabled(false);
putEffect(sSession);
}
}
}
|
public void | onCreate(android.os.Bundle icicle)
super.onCreate(icicle);
SeekBar seekBar;
TextView textView;
setContentView(R.layout.bassboosttest);
mSessionText = (EditText) findViewById(R.id.sessionEdit);
mSessionText.setOnKeyListener(mSessionKeyListener);
mSessionText.setText(Integer.toString(sSession));
mReleaseButton = (ToggleButton)findViewById(R.id.bbReleaseButton);
mOnOffButton = (ToggleButton)findViewById(R.id.bassboostOnOff);
getEffect(sSession);
if (mBassBoost != null) {
mReleaseButton.setOnCheckedChangeListener(this);
mOnOffButton.setOnCheckedChangeListener(this);
textView = (TextView)findViewById(R.id.bbStrengthMin);
textView.setText("0");
textView = (TextView)findViewById(R.id.bbStrengthMax);
textView.setText("1000");
seekBar = (SeekBar)findViewById(R.id.bbStrengthSeekBar);
textView = (TextView)findViewById(R.id.bbStrengthValue);
mStrength = new BassBoostParam(mBassBoost, 0, 1000, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mStrength);
mStrength.setEnabled(mBassBoost.getStrengthSupported());
}
|
public void | onPause()
super.onPause();
|
public void | onResume()
super.onResume();
|
private void | putEffect(int session)
mOnOffButton.setChecked(false);
mOnOffButton.setEnabled(false);
synchronized (sInstances) {
if (mBassBoost != null) {
mSettings = mBassBoost.getProperties().toString();
mBassBoost.release();
Log.d(TAG,"BassBoost released");
mBassBoost = null;
sInstances.remove(session);
}
}
|