Java Code Examples for android.media.audiofx.Equalizer#getBandLevelRange()
The following examples show how to use
android.media.audiofx.Equalizer#getBandLevelRange() .
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: MusicService.java From YTPlayer with GNU General Public License v3.0 | 6 votes |
static void setDefaultEqualizerValues() { try { boolean isSet = settingPref.getBoolean("equalizer_default",false); if (!isSet) { SharedPreferences.Editor editor = settingPref.edit(); int sessionId = player.getAudioComponent().getAudioSessionId(); mEqualizer = new Equalizer(1000,sessionId); short numberFrequencyBands = mEqualizer.getNumberOfBands(); final short lowerEqualizerBandLevel = mEqualizer.getBandLevelRange()[0]; final short upperEqualizerBandLevel = mEqualizer.getBandLevelRange()[1]; editor.putInt("bandLength",numberFrequencyBands); editor.putInt("lowerBand",lowerEqualizerBandLevel); editor.putInt("higherBand",upperEqualizerBandLevel); editor.putBoolean("equalizer_default",true); editor.apply(); mEqualizer.release(); } }catch (Exception ignored){} }
Example 2
Source File: EqualizerView.java From PainlessMusicPlayer with Apache License 2.0 | 5 votes |
private List<Item> buildItems(@NonNull final Equalizer equalizer) { final List<Item> items = new ArrayList<>(equalizer.getNumberOfBands()); final short[] bandLevelRange = equalizer.getBandLevelRange(); final short minEQLevel = bandLevelRange[0]; final short maxEQLevel = bandLevelRange[1]; eqLevelRange = maxEQLevel - minEQLevel; minEqLevel = minEQLevel; final Resources res = getResources(); for (short i = 0; i < equalizer.getNumberOfBands(); i++) { final Item item = new Item(); final int herz = equalizer.getCenterFreq(i) / 1000; final String herzText; if (herz > 1000) { final NumberFormat formatter = NumberFormat.getInstance(Locale.US); formatter.setMaximumFractionDigits(1); formatter.setMinimumFractionDigits(0); formatter.setRoundingMode(RoundingMode.HALF_UP); herzText = res.getString(R.string.s_kHz, formatter.format((float) herz / 1000f)); } else { herzText = res.getString(R.string.d_Hz, herz); } item.title = herzText; item.seekBarValue = equalizer.getBandLevel(i) - minEQLevel; items.add(item); } return items; }
Example 3
Source File: StandardEqualizer.java From android-openslmediaplayer with Apache License 2.0 | 5 votes |
private void initializeForCompat() { final int MIN = 0; final int MAX = 1; final Equalizer eq = getEqualizer(); mNumBands = eq.getNumberOfBands(); mNumPresets = eq.getNumberOfPresets(); short[] levelRange = eq.getBandLevelRange(); mBandLevelMin = levelRange[0]; mBandLevelMax = levelRange[1]; mBandFreqRange = new int[mNumBands][2]; mBandCenterFreq = new int[mNumBands]; for (short band = 0; band < mNumBands; band++) { int center = eq.getCenterFreq(band); int[] range = eq.getBandFreqRange(band); mBandFreqRange[band][MIN] = range[MIN]; mBandFreqRange[band][MAX] = range[MAX]; mBandCenterFreq[band] = center; } // correct center freq. & band freq. range int[] correctedCenterFreq = new int[mNumBands]; int[][] correctedBandFreqRange = new int[mNumBands][2]; if (EqualizerBandInfoCorrector.correct( mNumBands, mBandCenterFreq, mBandFreqRange, correctedCenterFreq, correctedBandFreqRange)) { mCorrectedCenterFreq = correctedCenterFreq; mCorrectedBandFreqRange = correctedBandFreqRange; } initializePresetWorkarounds(); }
Example 4
Source File: RemoteEqualizer.java From Jockey with Apache License 2.0 | 4 votes |
public RemoteEqualizer(Equalizer eq) { this(getEqualizerBands(eq), getEqualizerPresets(eq), eq.getProperties(), eq.getBandLevelRange()); }