Methods Summary |
---|
private void | getEffect(int session)
synchronized (sInstances) {
if (sInstances.containsKey(session)) {
mVirtualizer = sInstances.get(session);
} else {
try{
mVirtualizer = new Virtualizer(0, session);
} catch (IllegalArgumentException e) {
Log.e(TAG,"Virtualizer effect not supported");
} catch (IllegalStateException e) {
Log.e(TAG,"Virtualizer cannot get strength supported");
} catch (UnsupportedOperationException e) {
Log.e(TAG,"Virtualizer library not loaded");
} catch (RuntimeException e) {
Log.e(TAG,"Virtualizer effect not found");
}
sInstances.put(session, mVirtualizer);
}
}
mReleaseButton.setEnabled(false);
mOnOffButton.setEnabled(false);
if (mVirtualizer != null) {
if (mSettings != "") {
mVirtualizer.setProperties(new Virtualizer.Settings(mSettings));
}
mVirtualizer.setEnableStatusListener(mEffectListener);
mVirtualizer.setControlStatusListener(mEffectListener);
mVirtualizer.setParameterListener(mEffectListener);
mReleaseButton.setChecked(true);
mReleaseButton.setEnabled(true);
mOnOffButton.setChecked(mVirtualizer.getEnabled());
mOnOffButton.setEnabled(true);
}
|
public void | onCheckedChanged(android.widget.CompoundButton buttonView, boolean isChecked)
// OnCheckedChangeListener
if (buttonView.getId() == R.id.virtualizerOnOff) {
if (mVirtualizer != null) {
mVirtualizer.setEnabled(isChecked);
mStrength.updateDisplay();
}
}
if (buttonView.getId() == R.id.virtReleaseButton) {
if (isChecked) {
if (mVirtualizer == null) {
getEffect(sSession);
if (mVirtualizer != null) {
mStrength.setEffect(mVirtualizer);
mStrength.setEnabled(mVirtualizer.getStrengthSupported());
}
}
} else {
if (mVirtualizer != null) {
mStrength.setEnabled(false);
putEffect(sSession);
}
}
}
|
public void | onCreate(android.os.Bundle icicle)
super.onCreate(icicle);
SeekBar seekBar;
TextView textView;
setContentView(R.layout.virtualizertest);
mSessionText = (EditText) findViewById(R.id.sessionEdit);
mSessionText.setOnKeyListener(mSessionKeyListener);
mSessionText.setText(Integer.toString(sSession));
mReleaseButton = (ToggleButton)findViewById(R.id.virtReleaseButton);
mOnOffButton = (ToggleButton)findViewById(R.id.virtualizerOnOff);
getEffect(sSession);
if (mVirtualizer != null) {
mReleaseButton.setOnCheckedChangeListener(this);
mOnOffButton.setOnCheckedChangeListener(this);
textView = (TextView)findViewById(R.id.virtStrengthMin);
textView.setText("0");
textView = (TextView)findViewById(R.id.virtStrengthMax);
textView.setText("1000");
seekBar = (SeekBar)findViewById(R.id.virtStrengthSeekBar);
textView = (TextView)findViewById(R.id.virtStrengthValue);
mStrength = new VirtualizerParam(mVirtualizer, 0, 1000, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mStrength);
mStrength.setEnabled(mVirtualizer.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 (mVirtualizer != null) {
mSettings = mVirtualizer.getProperties().toString();
mVirtualizer.release();
Log.d(TAG,"Virtualizer released");
mVirtualizer = null;
sInstances.remove(session);
}
}
|