Methods Summary |
---|
private void | getEffect(int session)
synchronized (sInstances) {
if (sInstances.containsKey(session)) {
mPresetReverb = sInstances.get(session);
} else {
try{
mPresetReverb = new PresetReverb(0, session);
} catch (IllegalArgumentException e) {
Log.e(TAG,"PresetReverb effect not supported");
} catch (UnsupportedOperationException e) {
Log.e(TAG,"PresetReverb library not loaded");
} catch (RuntimeException e) {
Log.e(TAG,"PresetReverb effect not found");
}
sInstances.put(session, mPresetReverb);
}
}
mReleaseButton.setEnabled(false);
mOnOffButton.setEnabled(false);
if (mPresetReverb != null) {
if (mSettings != "") {
mPresetReverb.setProperties(new PresetReverb.Settings(mSettings));
}
mPresetReverb.setEnableStatusListener(mEffectListener);
mPresetReverb.setControlStatusListener(mEffectListener);
mPresetReverb.setParameterListener(mEffectListener);
mReleaseButton.setChecked(true);
mReleaseButton.setEnabled(true);
mOnOffButton.setChecked(mPresetReverb.getEnabled());
mOnOffButton.setEnabled(true);
}
|
public void | onCheckedChanged(android.widget.CompoundButton buttonView, boolean isChecked)
// OnCheckedChangeListener
if (buttonView.getId() == R.id.presetrvbOnOff) {
if (mPresetReverb != null) {
mPresetReverb.setEnabled(isChecked);
updateParams();
}
}
if (buttonView.getId() == R.id.presetrvbReleaseButton) {
if (isChecked) {
if (mPresetReverb == null) {
getEffect(sSession);
if (mPresetReverb != null) {
for (int i = 0 ; i < mParameters.length; i++) {
mParameters[i].setEffect(mPresetReverb);
mParameters[i].setEnabled(true);
mParameters[i].updateDisplay();
}
}
}
} else {
if (mPresetReverb != null) {
for (int i = 0 ; i < mParameters.length; i++) {
mParameters[i].setEnabled(false);
}
putEffect(sSession);
}
}
}
|
public void | onCreate(android.os.Bundle icicle)
super.onCreate(icicle);
setContentView(R.layout.presetreverbtest);
mSessionText = (EditText) findViewById(R.id.sessionEdit);
mSessionText.setOnKeyListener(mSessionKeyListener);
mSessionText.setText(Integer.toString(sSession));
mReleaseButton = (ToggleButton)findViewById(R.id.presetrvbReleaseButton);
mOnOffButton = (ToggleButton)findViewById(R.id.presetrvbOnOff);
getEffect(sSession);
if (mPresetReverb != null) {
mReleaseButton.setOnCheckedChangeListener(this);
mOnOffButton.setOnCheckedChangeListener(this);
// Presets
SeekBar seekBar = (SeekBar)findViewById(R.id.presetrvbParam1SeekBar);
TextView textView = (TextView)findViewById(R.id.presetrvbParam1Value);
mParameters[0] = new PresetParam(mPresetReverb, (short)0, (short)(sPresetNames.length - 1), seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[0]);
}
|
public void | onPause()
super.onPause();
|
public void | onResume()
super.onResume();
|
private void | putEffect(int session)
mOnOffButton.setChecked(false);
mOnOffButton.setEnabled(false);
synchronized (sInstances) {
if (mPresetReverb != null) {
mSettings = mPresetReverb.getProperties().toString();
mPresetReverb.release();
Log.d(TAG,"PresetReverb released");
mPresetReverb = null;
sInstances.remove(session);
}
}
|
protected void | updateParams()
for (int i = 0 ; i < mParameters.length; i++) {
mParameters[i].updateDisplay();
}
|