use of android.media.audiofx.PresetReverb in project android_frameworks_base by AOSPA.
the class MediaPresetReverbTest method getReverb.
//-----------------------------------------------------------------
// private methods
//----------------------------------
private void getReverb(int session) {
if (mReverb == null || session != mSession) {
if (session != mSession && mReverb != null) {
mReverb.release();
mReverb = null;
}
try {
mReverb = new PresetReverb(0, session);
mSession = session;
} catch (IllegalArgumentException e) {
Log.e(TAG, "getReverb() PresetReverb not found exception: " + e);
} catch (UnsupportedOperationException e) {
Log.e(TAG, "getReverb() Effect library not loaded exception: " + e);
}
}
assertNotNull("could not create mReverb", mReverb);
}
use of android.media.audiofx.PresetReverb in project android_frameworks_base by AOSPA.
the class PresetReverbTest method getEffect.
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);
}
}
use of android.media.audiofx.PresetReverb in project android_frameworks_base by crdroidandroid.
the class PresetReverbTest method getEffect.
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);
}
}
use of android.media.audiofx.PresetReverb in project android_frameworks_base by crdroidandroid.
the class MediaPresetReverbTest method getReverb.
//-----------------------------------------------------------------
// private methods
//----------------------------------
private void getReverb(int session) {
if (mReverb == null || session != mSession) {
if (session != mSession && mReverb != null) {
mReverb.release();
mReverb = null;
}
try {
mReverb = new PresetReverb(0, session);
mSession = session;
} catch (IllegalArgumentException e) {
Log.e(TAG, "getReverb() PresetReverb not found exception: " + e);
} catch (UnsupportedOperationException e) {
Log.e(TAG, "getReverb() Effect library not loaded exception: " + e);
}
}
assertNotNull("could not create mReverb", mReverb);
}
use of android.media.audiofx.PresetReverb in project MusicDNA by harjot-oberai.
the class PlayerFragment method setupVisualizerFxAndUI.
public void setupVisualizerFxAndUI() {
try {
mVisualizer = new Visualizer(mMediaPlayer.getAudioSessionId());
mEqualizer = new Equalizer(0, mMediaPlayer.getAudioSessionId());
mEqualizer.setEnabled(true);
try {
bassBoost = new BassBoost(0, mMediaPlayer.getAudioSessionId());
bassBoost.setEnabled(false);
BassBoost.Settings bassBoostSettingTemp = bassBoost.getProperties();
BassBoost.Settings bassBoostSetting = new BassBoost.Settings(bassBoostSettingTemp.toString());
bassBoostSetting.strength = (1000 / 19);
bassBoost.setProperties(bassBoostSetting);
mMediaPlayer.setAuxEffectSendLevel(1.0f);
presetReverb = new PresetReverb(0, mMediaPlayer.getAudioSessionId());
presetReverb.setPreset(PresetReverb.PRESET_NONE);
presetReverb.setEnabled(false);
mMediaPlayer.setAuxEffectSendLevel(1.0f);
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
if (homeActivity.isEqualizerEnabled) {
try {
bassBoost.setEnabled(true);
BassBoost.Settings bassBoostSettingTemp = bassBoost.getProperties();
BassBoost.Settings bassBoostSetting = new BassBoost.Settings(bassBoostSettingTemp.toString());
if (homeActivity.bassStrength == -1) {
bassBoostSetting.strength = (1000 / 19);
} else {
bassBoostSetting.strength = homeActivity.bassStrength;
}
bassBoost.setProperties(bassBoostSetting);
mMediaPlayer.setAuxEffectSendLevel(1.0f);
if (homeActivity.reverbPreset == -1) {
presetReverb.setPreset(PresetReverb.PRESET_NONE);
} else {
presetReverb.setPreset(homeActivity.reverbPreset);
}
presetReverb.setEnabled(true);
mMediaPlayer.setAuxEffectSendLevel(1.0f);
} catch (Exception e) {
e.printStackTrace();
}
}
if (homeActivity.isEqualizerEnabled && homeActivity.isEqualizerReloaded) {
try {
homeActivity.isEqualizerEnabled = true;
int pos = homeActivity.presetPos;
if (pos != 0) {
mEqualizer.usePreset((short) (pos - 1));
} else {
for (short i = 0; i < 5; i++) {
mEqualizer.setBandLevel(i, (short) homeActivity.seekbarpos[i]);
}
}
if (homeActivity.bassStrength != -1 && homeActivity.reverbPreset != -1) {
bassBoost.setEnabled(true);
bassBoost.setStrength(homeActivity.bassStrength);
presetReverb.setEnabled(true);
presetReverb.setPreset(homeActivity.reverbPreset);
}
mMediaPlayer.setAuxEffectSendLevel(1.0f);
} catch (Exception e) {
e.printStackTrace();
}
}
try {
mVisualizer.setCaptureSize(Visualizer.getCaptureSizeRange()[1]);
mVisualizer.setDataCaptureListener(new Visualizer.OnDataCaptureListener() {
public void onWaveFormDataCapture(Visualizer visualizer, byte[] bytes, int samplingRate) {
}
public void onFftDataCapture(Visualizer visualizer, byte[] bytes, int samplingRate) {
homeActivity.updateVisualizer(bytes);
}
}, Visualizer.getMaxCaptureRate() / 2, false, true);
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations