本文整理汇总了Java中android.media.audiofx.Equalizer.getNumberOfBands方法的典型用法代码示例。如果您正苦于以下问题:Java Equalizer.getNumberOfBands方法的具体用法?Java Equalizer.getNumberOfBands怎么用?Java Equalizer.getNumberOfBands使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.media.audiofx.Equalizer
的用法示例。
在下文中一共展示了Equalizer.getNumberOfBands方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EqualizerSettings
import android.media.audiofx.Equalizer; //导入方法依赖的package包/类
public EqualizerSettings(Equalizer equalizer)
{
enabled = equalizer.getEnabled();
bandLevels = new short[equalizer.getNumberOfBands()];
for (short i = 0; i < equalizer.getNumberOfBands(); i++)
{
bandLevels[i] = equalizer.getBandLevel(i);
}
try
{
preset = equalizer.getCurrentPreset();
}
catch (Exception x)
{
preset = -1;
}
}
示例2: isEqualizerSupported
import android.media.audiofx.Equalizer; //导入方法依赖的package包/类
public static boolean isEqualizerSupported() {
int noOfBands = 0;
int noOfPresents = 0;
try {
Equalizer equalizer = new Equalizer(0, 0);
noOfBands = equalizer.getNumberOfBands();
noOfPresents = equalizer.getNumberOfPresets();
equalizer.release();
equalizer = null;
} catch (Exception e) {
}
return noOfBands > 0 && noOfPresents > 0 && !isHTC();
}
示例3: initEq
import android.media.audiofx.Equalizer; //导入方法依赖的package包/类
public static void initEq(int audioID) {
EndEq();
try {
equalizer = new Equalizer(0, audioID);
preset = (short) Extras.getInstance().saveEq().getInt(SAVE_PRESET, 0);
if (preset < equalizer.getNumberOfPresets()){
usePreset(preset);
}else {
for (short b = 0; b < equalizer.getNumberOfBands(); b++) {
short level = (short) Extras.getInstance().saveEq().getInt(BAND_LEVEL + b, 0);
setBandLevel(b, level);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例4: EqualizerSettings
import android.media.audiofx.Equalizer; //导入方法依赖的package包/类
public EqualizerSettings(Equalizer equalizer) {
enabled = equalizer.getEnabled();
bandLevels = new short[equalizer.getNumberOfBands()];
for (short i = 0; i < equalizer.getNumberOfBands(); i++) {
bandLevels[i] = equalizer.getBandLevel(i);
}
try {
preset = equalizer.getCurrentPreset();
} catch (Exception x) {
preset = -1;
}
}
示例5: buildItems
import android.media.audiofx.Equalizer; //导入方法依赖的package包/类
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];
mEqLevelRange = maxEQLevel - minEQLevel;
mMinEqLevel = 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;
}
示例6: getEqualizerBands
import android.media.audiofx.Equalizer; //导入方法依赖的package包/类
private static Band[] getEqualizerBands(Equalizer equalizer) {
Band[] bands = new Band[equalizer.getNumberOfBands()];
for (short i = 0; i < bands.length; i++) {
int[] range = equalizer.getBandFreqRange(i);
int centerFrequency = equalizer.getCenterFreq(i);
int lowFrequency = range[0];
int highFrequency = range[1];
bands[i] = new Band(lowFrequency, highFrequency, centerFrequency);
}
return bands;
}
示例7: getBandLevelsFromEqualizer
import android.media.audiofx.Equalizer; //导入方法依赖的package包/类
private short[] getBandLevelsFromEqualizer(Equalizer equalizer) {
short[] levels = new short[equalizer.getNumberOfBands()];
for (short i = 0; i < levels.length; i++)
levels[i] = equalizer.getBandLevel(i);
return levels;
}