use of android.media.audiofx.AudioEffect in project android_frameworks_base by ParanoidAndroid.
the class MediaAudioEffectTest method test3_5SetParameterIntArrayShortArray.
//Test case 3.5: test setParameter(int[], short[])
@LargeTest
public void test3_5SetParameterIntArrayShortArray() throws Exception {
boolean result = false;
String msg = "test3_5SetParameterIntArrayShortArray()";
AudioEffect effect = null;
try {
effect = new AudioEffect(AudioEffect.EFFECT_TYPE_EQUALIZER, AudioEffect.EFFECT_TYPE_NULL, 0, 0);
assertNotNull(msg + ": could not create AudioEffect", effect);
int[] param = new int[1];
short[] value = new short[1];
param[0] = Equalizer.PARAM_CURRENT_PRESET;
value[0] = (short) 0;
if (effect.setParameter(param, value) == AudioEffect.SUCCESS) {
result = true;
}
} catch (IllegalArgumentException e) {
msg = msg.concat(": Bad parameter value");
loge(msg, "Bad parameter value");
} catch (UnsupportedOperationException e) {
msg = msg.concat(": setParameter() rejected");
loge(msg, "setParameter() rejected");
} catch (IllegalStateException e) {
msg = msg.concat("setParameter() called in wrong state");
loge(msg, "setParameter() called in wrong state");
} finally {
if (effect != null) {
effect.release();
}
}
assertTrue(msg, result);
}
use of android.media.audiofx.AudioEffect in project android_frameworks_base by ParanoidAndroid.
the class MediaAudioEffectTest method test1_2ConstructorUnknownType.
//Test case 1.2: test constructor failure from unknown type
@LargeTest
public void test1_2ConstructorUnknownType() throws Exception {
boolean result = false;
String msg = "test1_2ConstructorUnknownType()";
try {
AudioEffect effect = new AudioEffect(UUID.randomUUID(), AudioEffect.EFFECT_TYPE_NULL, 0, 0);
msg = msg.concat(": could create random AudioEffect");
if (effect != null) {
effect.release();
}
} catch (IllegalArgumentException e) {
result = true;
} catch (UnsupportedOperationException e) {
msg = msg.concat(": Effect library not loaded");
}
assertTrue(msg, result);
}
use of android.media.audiofx.AudioEffect in project android_frameworks_base by ParanoidAndroid.
the class MediaAudioEffectTest method test3_1SetParameterIntInt.
//Test case 3.1: test setParameter(int, int)
@LargeTest
public void test3_1SetParameterIntInt() throws Exception {
boolean result = false;
String msg = "test3_1SetParameterIntInt()";
AudioEffect effect = null;
try {
effect = new AudioEffect(AudioEffect.EFFECT_TYPE_ENV_REVERB, AudioEffect.EFFECT_TYPE_NULL, 0, 0);
assertNotNull(msg + ": could not create AudioEffect", effect);
if (effect.setParameter(EnvironmentalReverb.PARAM_DECAY_TIME, 0) == AudioEffect.SUCCESS) {
result = true;
}
} catch (IllegalArgumentException e) {
msg = msg.concat(": Bad parameter value");
loge(msg, "Bad parameter value");
} catch (UnsupportedOperationException e) {
msg = msg.concat(": setParameter() rejected");
loge(msg, "setParameter() rejected");
} catch (IllegalStateException e) {
msg = msg.concat("setParameter() called in wrong state");
loge(msg, "setParameter() called in wrong state");
} finally {
if (effect != null) {
effect.release();
}
}
assertTrue(msg, result);
}
use of android.media.audiofx.AudioEffect in project android_frameworks_base by ParanoidAndroid.
the class MediaAudioEffectTest method test4_3GetParameterIntByteArray.
//Test case 4.3: test getParameter(int, byte[])
@LargeTest
public void test4_3GetParameterIntByteArray() throws Exception {
boolean result = false;
String msg = "test4_3GetParameterIntByteArray()";
AudioEffect effect = null;
try {
effect = new AudioEffect(AudioEffect.EFFECT_TYPE_EQUALIZER, AudioEffect.EFFECT_TYPE_NULL, 0, 0);
assertNotNull(msg + ": could not create AudioEffect", effect);
byte[] value = new byte[2];
if (!AudioEffect.isError(effect.getParameter(Equalizer.PARAM_CURRENT_PRESET, value))) {
result = true;
}
} catch (IllegalArgumentException e) {
msg = msg.concat(": Bad parameter value");
loge(msg, "Bad parameter value");
} catch (UnsupportedOperationException e) {
msg = msg.concat(": getParameter() rejected");
loge(msg, "getParameter() rejected");
} catch (IllegalStateException e) {
msg = msg.concat("getParameter() called in wrong state");
loge(msg, "getParameter() called in wrong state");
} finally {
if (effect != null) {
effect.release();
}
}
assertTrue(msg, result);
}
use of android.media.audiofx.AudioEffect in project android_frameworks_base by ParanoidAndroid.
the class MediaAudioEffectTest method test4_6GetParameterIntArrayByteArray.
//Test case 4.6: test getParameter(int[], byte[])
@LargeTest
public void test4_6GetParameterIntArrayByteArray() throws Exception {
boolean result = false;
String msg = "test4_6GetParameterIntArrayByteArray()";
AudioEffect effect = null;
try {
effect = new AudioEffect(AudioEffect.EFFECT_TYPE_EQUALIZER, AudioEffect.EFFECT_TYPE_NULL, 0, 0);
assertNotNull(msg + ": could not create AudioEffect", effect);
int[] param = new int[1];
byte[] value = new byte[2];
param[0] = Equalizer.PARAM_CURRENT_PRESET;
if (!AudioEffect.isError(effect.getParameter(param, value))) {
result = true;
}
} catch (IllegalArgumentException e) {
msg = msg.concat(": Bad parameter value");
loge(msg, "Bad parameter value");
} catch (UnsupportedOperationException e) {
msg = msg.concat(": getParameter() rejected");
loge(msg, "getParameter() rejected");
} catch (IllegalStateException e) {
msg = msg.concat("getParameter() called in wrong state");
loge(msg, "getParameter() called in wrong state");
} finally {
if (effect != null) {
effect.release();
}
}
assertTrue(msg, result);
}
Aggregations