本文整理汇总了Java中android.media.audiofx.Equalizer.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java Equalizer.setEnabled方法的具体用法?Java Equalizer.setEnabled怎么用?Java Equalizer.setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.media.audiofx.Equalizer
的用法示例。
在下文中一共展示了Equalizer.setEnabled方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: restoreEqualizer
import android.media.audiofx.Equalizer; //导入方法依赖的package包/类
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);
}
示例2: 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);
}
示例3: EqualizerHelper
import android.media.audiofx.Equalizer; //导入方法依赖的package包/类
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);
}
示例4: apply
import android.media.audiofx.Equalizer; //导入方法依赖的package包/类
public void apply(Equalizer equalizer, BassBoost boost, LoudnessEnhancerController loudnessController) {
for (short i = 0; i < bandLevels.length; i++) {
equalizer.setBandLevel(i, bandLevels[i]);
}
equalizer.setEnabled(enabled);
if(bass != 0) {
boost.setEnabled(true);
boost.setStrength(bass);
}
if(loudness != 0) {
loudnessController.enable();
loudnessController.setGain(loudness);
}
}
示例5: 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);
}
示例6: musicHandler
import android.media.audiofx.Equalizer; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.KITKAT)
public musicHandler(musicPlayer Gh) {
mEvent = new Event("PLayer");
this.Gh = Gh;
loadStartup();
mediaplayer = new MediaPlayer();
mediaplayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
if(needPlay){
isPrepared = true;
play(needId);
}else{
isPrepared = true;
if(needStop){
needStop = false;
}else{
mediaplayer.start();
}
mediaplayer.setOnCompletionListener(OC);
mEvent.trigger(playerEvents.SONG_CHANGED);
}
}
});
needStop = true;
playByNumber(0);
EQs = new EqlizerSettings(Gh.getBaseContext());
bass = new BassBoost(0, mediaplayer.getAudioSessionId());
bass.setEnabled(true);
equlizer = new Equalizer(0, mediaplayer.getAudioSessionId());
equlizer.setEnabled(true);
virtualizer = new Virtualizer(0, mediaplayer.getAudioSessionId());
virtualizer.setEnabled(true);
if(android.os.Build.VERSION.SDK_INT >= 19){
loudness = new LoudnessEnhancer( mediaplayer.getAudioSessionId());
loudness.setEnabled(true);
}else{
loudness = null;
}
setEQs(EQs.isOn);
setBass(EQs.BASS);
setTrable(EQs.TRABLE);
setVoice(EQs.VOICE);
setVirtualizer(EQs.VIRCHULIZER);
setLoudnessEnhancer(EQs.LOUDNESS);
mEvent.trigger(playerEvents.EQ_CHANGED);
mEvent.trigger(playerEvents.PLAYER_COMPLETE);
}
示例7: bindCustomEqualizer
import android.media.audiofx.Equalizer; //导入方法依赖的package包/类
private void bindCustomEqualizer(int audioSessionId) {
mEqualizer = new Equalizer(0, audioSessionId);
mEqualizer.setProperties(mEqualizerSettings);
mEqualizer.setEnabled(true);
}
示例8: setEqualizer
import android.media.audiofx.Equalizer; //导入方法依赖的package包/类
private void setEqualizer(Equalizer e) {
SpeakerBoost.log("setEqualizer "+boostValue);
if (e == null)
return;
short v = (short)( (boostValue * rangeHigh + NOMINAL_RANGE_HIGH/2) / NOMINAL_RANGE_HIGH );
if (v < 0)
v = 0;
if (v > rangeHigh)
v = rangeHigh;
if (v != 0) {
e.setEnabled(true);
for (short i=0; i<bands; i++) {
short adj = v;
if (shape) {
int hz = e.getCenterFreq(i)/1000;
if (hz < 150)
adj = 0;
else if (hz < 250)
adj = (short)(v/2);
else if (hz > 8000)
adj = (short)(3*(int)v/4);
}
SpeakerBoost.log("boost "+i+" ("+(eq.getCenterFreq(i)/1000)+"hz) to "+adj);
SpeakerBoost.log("previous value "+eq.getBandLevel(i));
try {
e.setBandLevel(i, (short) adj);
}
catch (Exception exc) {
SpeakerBoost.log("Error "+exc);
}
}
}
else {
e.setEnabled(false);
}
}