本文整理汇总了Java中android.media.audiofx.Equalizer.getNumberOfPresets方法的典型用法代码示例。如果您正苦于以下问题:Java Equalizer.getNumberOfPresets方法的具体用法?Java Equalizer.getNumberOfPresets怎么用?Java Equalizer.getNumberOfPresets使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.media.audiofx.Equalizer
的用法示例。
在下文中一共展示了Equalizer.getNumberOfPresets方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: 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();
}
}
示例3: apply
import android.media.audiofx.Equalizer; //导入方法依赖的package包/类
public void apply(Equalizer equalizer)
{
for (short i = 0; i < bandLevels.length; i++)
{
equalizer.setBandLevel(i, bandLevels[i]);
}
if (preset >= 0 && preset < equalizer.getNumberOfPresets())
{
equalizer.usePreset(preset);
}
equalizer.setEnabled(enabled);
}
示例4: getEqualizerPresets
import android.media.audiofx.Equalizer; //导入方法依赖的package包/类
private static Preset[] getEqualizerPresets(Equalizer equalizer) {
Preset[] presets = new Preset[equalizer.getNumberOfPresets()];
for (short i = 0; i < presets.length; i++) {
presets[i] = new Preset(equalizer.getPresetName(i));
}
return presets;
}
示例5: PresetSpinnerAdapter
import android.media.audiofx.Equalizer; //导入方法依赖的package包/类
public PresetSpinnerAdapter(Context context, Equalizer equalizer) {
super(context, android.R.layout.simple_spinner_item);
setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
short numPresets = equalizer.getNumberOfPresets();
String[] presets = new String[numPresets + 1];
for (short i = 0; i < numPresets; i++)
presets[i] = equalizer.getPresetName(i);
customPresetIndex = presets.length - 1;
presets[customPresetIndex] = context.getString(R.string.custom);
addAll(presets);
}
示例6: apply
import android.media.audiofx.Equalizer; //导入方法依赖的package包/类
public void apply(Equalizer equalizer) {
for (short i = 0; i < bandLevels.length; i++) {
equalizer.setBandLevel(i, bandLevels[i]);
}
if (preset >= 0 && preset < equalizer.getNumberOfPresets()) {
equalizer.usePreset(preset);
}
equalizer.setEnabled(enabled);
}