use of android.media.audiofx.Visualizer in project android_frameworks_base by ParanoidAndroid.
the class MediaVisualizerTest method getVisualizer.
private void getVisualizer(int session) {
if (mVisualizer == null || session != mSession) {
if (session != mSession && mVisualizer != null) {
mVisualizer.release();
mVisualizer = null;
}
try {
mVisualizer = new Visualizer(session);
mSession = session;
} catch (IllegalArgumentException e) {
Log.e(TAG, "getVisualizer() Visualizer not found exception: " + e);
} catch (UnsupportedOperationException e) {
Log.e(TAG, "getVisualizer() Effect library not loaded exception: " + e);
}
}
assertNotNull("could not create mVisualizer", mVisualizer);
}
use of android.media.audiofx.Visualizer in project android_frameworks_base by ParanoidAndroid.
the class MediaVisualizerTest method test0_0ConstructorAndRelease.
//-----------------------------------------------------------------
// VISUALIZER 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()";
Visualizer visualizer = null;
try {
visualizer = new Visualizer(0);
assertNotNull(msg + ": could not create Visualizer", visualizer);
result = true;
} catch (IllegalArgumentException e) {
msg = msg.concat(": Visualizer not found");
} catch (UnsupportedOperationException e) {
msg = msg.concat(": Effect library not loaded");
} finally {
if (visualizer != null) {
visualizer.release();
}
}
assertTrue(msg, result);
}
use of android.media.audiofx.Visualizer in project platform_frameworks_base by android.
the class VisualizerTest method getEffect.
private void getEffect(int session) {
synchronized (sInstances) {
if (sInstances.containsKey(session)) {
mVisualizer = sInstances.get(session);
} else {
try {
mVisualizer = new Visualizer(session);
} catch (UnsupportedOperationException e) {
Log.e(TAG, "Visualizer library not loaded");
throw (new RuntimeException("Cannot initialize effect"));
} catch (RuntimeException e) {
throw e;
}
sInstances.put(session, mVisualizer);
}
}
mReleaseButton.setEnabled(false);
mOnOffButton.setEnabled(false);
if (mVisualizer != null) {
mCaptureSize = mVisualizer.getCaptureSize();
mReleaseButton.setChecked(true);
mReleaseButton.setEnabled(true);
mEnabled = mVisualizer.getEnabled();
mOnOffButton.setChecked(mEnabled);
mOnOffButton.setEnabled(true);
mCallbackButton.setEnabled(!mEnabled);
}
}
use of android.media.audiofx.Visualizer in project platform_frameworks_base by android.
the class MediaVisualizerTest method getVisualizer.
private void getVisualizer(int session) {
if (mVisualizer == null || session != mSession) {
if (session != mSession && mVisualizer != null) {
mVisualizer.release();
mVisualizer = null;
}
try {
mVisualizer = new Visualizer(session);
mSession = session;
} catch (IllegalArgumentException e) {
Log.e(TAG, "getVisualizer() Visualizer not found exception: " + e);
} catch (UnsupportedOperationException e) {
Log.e(TAG, "getVisualizer() Effect library not loaded exception: " + e);
}
}
assertNotNull("could not create mVisualizer", mVisualizer);
}
use of android.media.audiofx.Visualizer in project android_frameworks_base by DirtyUnicorns.
the class MediaVisualizerTest method test0_0ConstructorAndRelease.
//-----------------------------------------------------------------
// VISUALIZER 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()";
Visualizer visualizer = null;
try {
visualizer = new Visualizer(0);
assertNotNull(msg + ": could not create Visualizer", visualizer);
result = true;
} catch (IllegalArgumentException e) {
msg = msg.concat(": Visualizer not found");
} catch (UnsupportedOperationException e) {
msg = msg.concat(": Effect library not loaded");
} finally {
if (visualizer != null) {
visualizer.release();
}
}
assertTrue(msg, result);
}
Aggregations