android.media.audiofx.PresetReverb Java Examples

The following examples show how to use android.media.audiofx.PresetReverb. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EqualizerFragment.java    From Bop with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRetainInstance(true);
    mEqualizer = new Equalizer(0, audioSesionId);
    bassBoost = new BassBoost(0, audioSesionId);
    bassBoost.setEnabled(true);
    BassBoost.Settings bassBoostSettingTemp = bassBoost.getProperties();
    BassBoost.Settings bassBoostSetting = new BassBoost.Settings(bassBoostSettingTemp.toString());
    bassBoostSetting.strength = (1000 / 19);
    bassBoost.setProperties(bassBoostSetting);

    presetReverb = new PresetReverb(0, audioSesionId);
    presetReverb.setPreset(PresetReverb.PRESET_NONE);
    presetReverb.setEnabled(true);
    Settings.equalizerModel = new EqualizerModel();
    mEqualizer.setEnabled(true);
    
    unbindSystemEqualizer(audioSesionId);
}
 
Example #2
Source File: EqualizerFragment.java    From AndroidEqualizer with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Settings.isEditing = true;

    if (getArguments() != null && getArguments().containsKey(ARG_AUDIO_SESSIOIN_ID)){
        audioSesionId = getArguments().getInt(ARG_AUDIO_SESSIOIN_ID);
    }

    if (Settings.equalizerModel == null){
        Settings.equalizerModel = new EqualizerModel();
        Settings.equalizerModel.setReverbPreset(PresetReverb.PRESET_NONE);
        Settings.equalizerModel.setBassStrength((short) (1000 / 19));
    }

    mEqualizer = new Equalizer(0, audioSesionId);

    bassBoost = new BassBoost(0, audioSesionId);
    bassBoost.setEnabled(Settings.isEqualizerEnabled);
    BassBoost.Settings bassBoostSettingTemp = bassBoost.getProperties();
    BassBoost.Settings bassBoostSetting = new BassBoost.Settings(bassBoostSettingTemp.toString());
    bassBoostSetting.strength = Settings.equalizerModel.getBassStrength();
    bassBoost.setProperties(bassBoostSetting);

    presetReverb = new PresetReverb(0, audioSesionId);
    presetReverb.setPreset(Settings.equalizerModel.getReverbPreset());
    presetReverb.setEnabled(Settings.isEqualizerEnabled);

    mEqualizer.setEnabled(Settings.isEqualizerEnabled);

    if (Settings.presetPos == 0){
        for (short bandIdx = 0; bandIdx < mEqualizer.getNumberOfBands(); bandIdx++) {
            mEqualizer.setBandLevel(bandIdx, (short) Settings.seekbarpos[bandIdx]);
        }
    }
    else {
        mEqualizer.usePreset((short) Settings.presetPos);
    }
}
 
Example #3
Source File: DialogEqualizerFragment.java    From AndroidEqualizer with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Settings.isEditing = true;

    if (getArguments() != null && getArguments().containsKey(ARG_AUDIO_SESSIOIN_ID)) {
        audioSesionId = getArguments().getInt(ARG_AUDIO_SESSIOIN_ID);
    }

    if (Settings.equalizerModel == null) {
        Settings.equalizerModel = new EqualizerModel();
        Settings.equalizerModel.setReverbPreset(PresetReverb.PRESET_NONE);
        Settings.equalizerModel.setBassStrength((short) (1000 / 19));
    }

    mEqualizer = new Equalizer(0, audioSesionId);

    bassBoost = new BassBoost(0, audioSesionId);
    bassBoost.setEnabled(true);
    BassBoost.Settings bassBoostSettingTemp = bassBoost.getProperties();
    BassBoost.Settings bassBoostSetting     = new BassBoost.Settings(bassBoostSettingTemp.toString());
    bassBoostSetting.strength = Settings.equalizerModel.getBassStrength();
    bassBoost.setProperties(bassBoostSetting);

    presetReverb = new PresetReverb(0, audioSesionId);
    presetReverb.setPreset(Settings.equalizerModel.getReverbPreset());
    presetReverb.setEnabled(true);

    mEqualizer.setEnabled(true);

    if (Settings.presetPos == 0) {
        for (short bandIdx = 0; bandIdx < mEqualizer.getNumberOfBands(); bandIdx++) {
            mEqualizer.setBandLevel(bandIdx, (short) Settings.seekbarpos[bandIdx]);
        }
    } else {
        mEqualizer.usePreset((short) Settings.presetPos);
    }
}
 
Example #4
Source File: EqualizerActivity.java    From Rey-MusicPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int index, long arg3) {
    PreferencesHelper.getInstance().put(PreferencesHelper.Key.LAST_PRESET_NAME, mReverbSpinner.getSelectedItem().toString());
    reverbSetting = index;

    if (mApp.isServiceRunning())
        if (index == 0) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_NONE);
            reverbSetting = 0;
        } else if (index == 1) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_LARGEHALL);
            reverbSetting = 1;
        } else if (index == 2) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_LARGEROOM);
            reverbSetting = 2;
        } else if (index == 3) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_MEDIUMHALL);
            reverbSetting = 3;
        } else if (index == 4) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_MEDIUMROOM);
            reverbSetting = 4;
        } else if (index == 5) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_SMALLROOM);
            reverbSetting = 5;
        } else if (index == 6) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_PLATE);
            reverbSetting = 6;
        } else
            reverbSetting = 0;
}
 
Example #5
Source File: EqualizerHelper.java    From Rey-MusicPlayer with Apache License 2.0 5 votes vote down vote up
public EqualizerHelper(int audioSessionId1, boolean equalizerEnabled) throws RuntimeException {

        mEqualizer = new Equalizer(0, audioSessionId1);
        mEqualizer.setEnabled(equalizerEnabled);

        mVirtualizer = new Virtualizer(0, audioSessionId1);
        mVirtualizer.setEnabled(equalizerEnabled);

        mBassBoost = new BassBoost(0, audioSessionId1);
        mBassBoost.setEnabled(equalizerEnabled);

        mPresetReverb = new PresetReverb(0, audioSessionId1);
        mPresetReverb.setEnabled(equalizerEnabled);
    }
 
Example #6
Source File: AudioEffectSettingsConverter.java    From android-openslmediaplayer with Apache License 2.0 5 votes vote down vote up
/**
 * IPresetReverb.Settings -&gt; PresetReverb.Settings
 *
 * @param settings IPresetReverb.Settings
 * @return PresetReverb.Settings
 */
public static PresetReverb.Settings convert(IPresetReverb.Settings settings) {
    PresetReverb.Settings settings2 = new PresetReverb.Settings();

    settings2.preset = settings.preset;

    return settings2;
}
 
Example #7
Source File: AudioEffectSettingsConverter.java    From android-openslmediaplayer with Apache License 2.0 5 votes vote down vote up
/**
 * PresetReverb.Settings -&gt; IPresetReverb.Settings
 *
 * @param settings PresetReverb.Settings
 * @return IPresetReverb.Settings
 */
public static IPresetReverb.Settings convert(PresetReverb.Settings settings) {
    IPresetReverb.Settings settings2 = new IPresetReverb.Settings();

    settings2.preset = settings.preset;

    return settings2;
}
 
Example #8
Source File: StandardPresetReverb.java    From android-openslmediaplayer with Apache License 2.0 5 votes vote down vote up
void onParameterChange(
        android.media.audiofx.PresetReverb effect,
        int status, int param, short value) {
    IPresetReverb.OnParameterChangeListener listener = null;

    listener = mUserOnParameterChangeListener;

    if (listener != null) {
        listener.onParameterChange(this, status, param, value);
    }
}
 
Example #9
Source File: EqualizerHelper.java    From Rey-MusicPlayer with Apache License 2.0 4 votes vote down vote up
public PresetReverb getPresetReverb() {
    return mPresetReverb;
}
 
Example #10
Source File: EqualizerHelper.java    From Rey-MusicPlayer with Apache License 2.0 4 votes vote down vote up
public void setPresetReverb(PresetReverb presetReverb) {
    mPresetReverb = presetReverb;
}
 
Example #11
Source File: EqualizerHelper.java    From Rey-MusicPlayer with Apache License 2.0 4 votes vote down vote up
public PresetReverb getReverb() {
    return mPresetReverb;
}
 
Example #12
Source File: StandardPresetReverb.java    From android-openslmediaplayer with Apache License 2.0 4 votes vote down vote up
@Override
public void onParameterChange(
        android.media.audiofx.PresetReverb effect, int status, int param, short value) {
    StandardPresetReverb.this.onParameterChange(effect, status, param, value);
}
 
Example #13
Source File: StandardPresetReverb.java    From android-openslmediaplayer with Apache License 2.0 4 votes vote down vote up
public StandardPresetReverb(int priority, int audioSession) throws IllegalStateException,
        IllegalArgumentException, UnsupportedOperationException, RuntimeException {
    super(new PresetReverb(priority, audioSession));
    getPresetReverb().setParameterListener(mOnParameterChangeListener);
}
 
Example #14
Source File: StandardPresetReverb.java    From android-openslmediaplayer with Apache License 2.0 2 votes vote down vote up
/**
 * Get underlying PresetReverb instance.
 *
 * @return underlying PresetReverb instance.
 */
public PresetReverb getPresetReverb() {
    return (PresetReverb) super.getAudioEffect();
}