Java Code Examples for android.media.audiofx.Equalizer#Settings
The following examples show how to use
android.media.audiofx.Equalizer#Settings .
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: AudioEffectsImpl.java From PainlessMusicPlayer with Apache License 2.0 | 6 votes |
@Override public void saveEqualizerSettings(@NonNull final Equalizer.Settings settings) { synchronized (SETTINGS_LOCK) { final EffectsProto.EqualizerSettings proto = mEqualizerSettings; proto.curPreset = settings.curPreset; proto.numBands = settings.numBands; final short[] bandLevels = settings.bandLevels; proto.bandValues = new int[bandLevels != null ? bandLevels.length : 0]; if (bandLevels != null) { for (int i = 0; i < bandLevels.length; i++) { proto.bandValues[i] = bandLevels[i]; } } } persistEqualizerSettingsAsync(); }
Example 2
Source File: ImmutablePreferenceStore.java From Jockey with Apache License 2.0 | 6 votes |
public ImmutablePreferenceStore(ReadOnlyPreferenceStore preferencesStore) { mShowFirstStart = preferencesStore.showFirstStart(); mAllowLogging = preferencesStore.allowLogging(); mUseMobileNetwork = preferencesStore.useMobileNetwork(); mOpenNowPlayingOnNewQueue = preferencesStore.openNowPlayingOnNewQueue(); mEnableNowPlayingGestures = preferencesStore.enableNowPlayingGestures(); mDefaultPage = preferencesStore.getDefaultPage(); mPrimaryColor = preferencesStore.getPrimaryColor(); mAccentColor = preferencesStore.getAccentColor(); mBaseColor = preferencesStore.getBaseColor(); mIconColor = preferencesStore.getIconColor(); mResumeOnHeadphonesConnect = preferencesStore.resumeOnHeadphonesConnect(); mShuffled = preferencesStore.isShuffled(); mPreviousSleepTimerDurationMillis = preferencesStore.getLastSleepTimerDuration(); mRepeatMode = preferencesStore.getRepeatMode(); mSlsEnabled = preferencesStore.isSlsBroadcastingEnabled(); mEqualizerPresetId = preferencesStore.getEqualizerPresetId(); mEqualizerEnabled = preferencesStore.getEqualizerEnabled(); Equalizer.Settings eqSettings = preferencesStore.getEqualizerSettings(); if (eqSettings != null) { mEqualizerSettings = eqSettings.toString(); } else { mEqualizerSettings = null; } }
Example 3
Source File: AudioEffectsImpl.java From PainlessMusicPlayer with Apache License 2.0 | 6 votes |
private void restoreEqualizer() { mEqualizer = new Equalizer(Integer.MAX_VALUE, mSessionId); synchronized (SETTINGS_LOCK) { final EffectsProto.EqualizerSettings proto = mEqualizerSettings; if (proto.curPreset != 0 || proto.numBands != 0 || proto.bandValues.length != 0) { final Equalizer.Settings settings = new Equalizer.Settings(); settings.curPreset = (short) proto.curPreset; settings.numBands = (short) proto.numBands; settings.bandLevels = new short[proto.bandValues.length]; for (int i = 0; i < settings.bandLevels.length; i++) { settings.bandLevels[i] = (short) proto.bandValues[i]; } try { mEqualizer.setProperties(settings); } catch (IllegalArgumentException e) { Log.wtf(TAG, "Failed restoring equalizer settings", e); } } } mEqualizer.setEnabled(true); }
Example 4
Source File: AudioEffectSettingsConverter.java From android-openslmediaplayer with Apache License 2.0 | 5 votes |
/** * Equalizer.Settings -> IEqualizer.Settings * * @param settings Equalizer.Settings * @return IEqualizer.Settings */ public static IEqualizer.Settings convert(Equalizer.Settings settings) { IEqualizer.Settings settings2 = new IEqualizer.Settings(); settings2.curPreset = settings.curPreset; settings2.numBands = settings.numBands; settings2.bandLevels = settings.bandLevels; return settings2; }
Example 5
Source File: AudioEffectSettingsConverter.java From android-openslmediaplayer with Apache License 2.0 | 5 votes |
/** * IEqualizer.Settings -> Equalizer.Settings * * @param settings IEqualizer.Settings * @return Equalizer.Settings */ public static Equalizer.Settings convert(IEqualizer.Settings settings) { Equalizer.Settings settings2 = new Equalizer.Settings(); settings2.curPreset = settings.curPreset; settings2.numBands = settings.numBands; settings2.bandLevels = settings.bandLevels; return settings2; }
Example 6
Source File: EqualizerFragment.java From Jockey with Apache License 2.0 | 5 votes |
private RemoteEqualizer generateEqualizerConfig() { // Obtain an instance of the system equalizer to discover available configuration options // for an equalizer including bands and presets. This equalizer is not used to control // audio settings and is released before this method ends Equalizer systemEqualizer = new Equalizer(0, 1); RemoteEqualizer eq = new RemoteEqualizer(systemEqualizer); Equalizer.Settings settings = mPrefStore.getEqualizerSettings(); if (settings != null) { eq.setProperties(mPrefStore.getEqualizerSettings()); } systemEqualizer.release(); return eq; }
Example 7
Source File: EqualizedExoPlayer.java From Jockey with Apache License 2.0 | 5 votes |
public void setEqualizerSettings(boolean enabled, Equalizer.Settings settings) { boolean invalidate = mEqualizerEnabled != enabled || mEqualizerEnabled; boolean wasSystem = isUsingSystemEqualizer(); mEqualizerEnabled = enabled; mEqualizerSettings = settings; if (invalidate) { updateEqualizerPrefs(enabled, wasSystem); } }
Example 8
Source File: RemoteEqualizer.java From Jockey with Apache License 2.0 | 5 votes |
public Equalizer.Settings getProperties() { Equalizer.Settings settings = new Equalizer.Settings(); settings.bandLevels = intArrayToShortArray(mBandLevels); settings.curPreset = (short) mCurPreset; settings.numBands = (short) getNumberOfBands(); return settings; }
Example 9
Source File: RemoteEqualizer.java From Jockey with Apache License 2.0 | 5 votes |
public RemoteEqualizer(Band[] bands, Preset[] presets, Equalizer.Settings settings, short[] bandLevelRange) { mBands = bands; mPresets = presets; mMinBandLevel = bandLevelRange[0]; mMaxBandLevel = bandLevelRange[1]; setProperties(settings); }
Example 10
Source File: SharedPreferenceStore.java From Jockey with Apache License 2.0 | 5 votes |
@Override public Equalizer.Settings getEqualizerSettings() { if (contains(R.string.pref_key_eq_settings)) { try { return new Equalizer.Settings(getString(R.string.pref_key_eq_settings, null)); } catch (IllegalArgumentException exception) { Timber.e(exception, "getEqualizerSettings: failed to parse equalizer settings"); } } return null; }
Example 11
Source File: ImmutablePreferenceStore.java From Jockey with Apache License 2.0 | 5 votes |
@Override public Equalizer.Settings getEqualizerSettings() { if (mEqualizerSettings != null) { try { return new Equalizer.Settings(mEqualizerSettings); } catch (IllegalArgumentException exception) { Timber.e(exception, "getEqualizerSettings: failed to parse equalizer settings"); } } return null; }
Example 12
Source File: RemoteEqualizer.java From Jockey with Apache License 2.0 | 4 votes |
public void setProperties(Equalizer.Settings settings) { mBandLevels = shortArrayToIntArray(settings.bandLevels); mCurPreset = settings.curPreset; }
Example 13
Source File: QueuedExoPlayer.java From Jockey with Apache License 2.0 | 4 votes |
@Override public void setEqualizer(boolean enabled, Equalizer.Settings settings) { mExoPlayer.setEqualizerSettings(enabled, settings); }
Example 14
Source File: SharedPreferenceStore.java From Jockey with Apache License 2.0 | 4 votes |
@Override public void setEqualizerSettings(Equalizer.Settings settings) { putString(R.string.pref_key_eq_settings, settings.toString()); }
Example 15
Source File: QueuedMediaPlayer.java From Jockey with Apache License 2.0 | 2 votes |
/** * Sets a custom equalizer to apply to music playback * @param enabled Whether or not to apply the specified equalizer. {@code true} will apply the * equalizer settings, {@code false} will turn off the equalizer. * @param settings The equalizer settings to apply */ void setEqualizer(boolean enabled, Equalizer.Settings settings);
Example 16
Source File: PreferenceStore.java From Jockey with Apache License 2.0 | votes |
void setEqualizerSettings(Equalizer.Settings settings);
Example 17
Source File: ReadOnlyPreferenceStore.java From Jockey with Apache License 2.0 | votes |
Equalizer.Settings getEqualizerSettings();