use of android.media.audiofx.Equalizer in project platform_frameworks_base by android.
the class MediaEqualizerTest method test0_0ConstructorAndRelease.
//-----------------------------------------------------------------
// EQUALIZER TESTS:
//----------------------------------
//-----------------------------------------------------------------
// 0 - constructor
//----------------------------------
//Test case 0.0: test constructor and release
@LargeTest
public void test0_0ConstructorAndRelease() throws Exception {
boolean result = false;
String msg = "test1_0ConstructorAndRelease()";
Equalizer eq = null;
try {
eq = new Equalizer(0, 0);
assertNotNull(msg + ": could not create Equalizer", eq);
try {
assertTrue(msg + ": invalid effect ID", (eq.getId() != 0));
} catch (IllegalStateException e) {
msg = msg.concat(": Equalizer not initialized");
}
result = true;
} catch (IllegalArgumentException e) {
msg = msg.concat(": Equalizer not found");
} catch (UnsupportedOperationException e) {
msg = msg.concat(": Effect library not loaded");
} finally {
if (eq != null) {
eq.release();
}
}
assertTrue(msg, result);
}
use of android.media.audiofx.Equalizer in project android_frameworks_base by DirtyUnicorns.
the class MediaEqualizerTest method test0_0ConstructorAndRelease.
//-----------------------------------------------------------------
// EQUALIZER TESTS:
//----------------------------------
//-----------------------------------------------------------------
// 0 - constructor
//----------------------------------
//Test case 0.0: test constructor and release
@LargeTest
public void test0_0ConstructorAndRelease() throws Exception {
boolean result = false;
String msg = "test1_0ConstructorAndRelease()";
Equalizer eq = null;
try {
eq = new Equalizer(0, 0);
assertNotNull(msg + ": could not create Equalizer", eq);
try {
assertTrue(msg + ": invalid effect ID", (eq.getId() != 0));
} catch (IllegalStateException e) {
msg = msg.concat(": Equalizer not initialized");
}
result = true;
} catch (IllegalArgumentException e) {
msg = msg.concat(": Equalizer not found");
} catch (UnsupportedOperationException e) {
msg = msg.concat(": Effect library not loaded");
} finally {
if (eq != null) {
eq.release();
}
}
assertTrue(msg, result);
}
use of android.media.audiofx.Equalizer in project android_frameworks_base by DirtyUnicorns.
the class MediaEqualizerTest method getEqualizer.
//-----------------------------------------------------------------
// private methods
//----------------------------------
private void getEqualizer(int session) {
if (mEqualizer == null || session != mSession) {
if (session != mSession && mEqualizer != null) {
mEqualizer.release();
mEqualizer = null;
}
try {
mEqualizer = new Equalizer(0, session);
mSession = session;
} catch (IllegalArgumentException e) {
Log.e(TAG, "getEqualizer() Equalizer not found exception: " + e);
} catch (UnsupportedOperationException e) {
Log.e(TAG, "getEqualizer() Effect library not loaded exception: " + e);
}
}
assertNotNull("could not create mEqualizer", mEqualizer);
}
use of android.media.audiofx.Equalizer in project android_frameworks_base by AOSPA.
the class EqualizerTest method getEffect.
private void getEffect(int session) {
synchronized (sInstances) {
if (sInstances.containsKey(session)) {
mEqualizer = sInstances.get(session);
} else {
try {
mEqualizer = new Equalizer(0, session);
} catch (IllegalArgumentException e) {
Log.e(TAG, "Equalizer effect not supported");
} catch (UnsupportedOperationException e) {
Log.e(TAG, "Equalizer library not loaded");
} catch (IllegalStateException e) {
Log.e(TAG, "Equalizer cannot get presets");
} catch (RuntimeException e) {
Log.e(TAG, "Equalizer effect not found");
}
sInstances.put(session, mEqualizer);
}
}
mReleaseButton.setEnabled(false);
mOnOffButton.setEnabled(false);
if (mEqualizer != null) {
if (mSettings != "") {
Log.d(TAG, "Equalizer settings: " + mSettings);
mEqualizer.setProperties(new Equalizer.Settings(mSettings));
}
mEqualizer.setEnableStatusListener(mEffectListener);
mEqualizer.setControlStatusListener(mEffectListener);
mEqualizer.setParameterListener(mEffectListener);
mReleaseButton.setChecked(true);
mReleaseButton.setEnabled(true);
mOnOffButton.setChecked(mEqualizer.getEnabled());
mOnOffButton.setEnabled(true);
}
}
use of android.media.audiofx.Equalizer in project android_frameworks_base by AOSPA.
the class MediaEqualizerTest method getEqualizer.
//-----------------------------------------------------------------
// private methods
//----------------------------------
private void getEqualizer(int session) {
if (mEqualizer == null || session != mSession) {
if (session != mSession && mEqualizer != null) {
mEqualizer.release();
mEqualizer = null;
}
try {
mEqualizer = new Equalizer(0, session);
mSession = session;
} catch (IllegalArgumentException e) {
Log.e(TAG, "getEqualizer() Equalizer not found exception: " + e);
} catch (UnsupportedOperationException e) {
Log.e(TAG, "getEqualizer() Effect library not loaded exception: " + e);
}
}
assertNotNull("could not create mEqualizer", mEqualizer);
}
Aggregations