当前位置: 首页>>代码示例>>Java>>正文


Java Equalizer.setEnabled方法代码示例

本文整理汇总了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);
}
 
开发者ID:Doctoror,项目名称:PainlessMusicPlayer,代码行数:27,代码来源:AudioEffects.java

示例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);
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:15,代码来源:EqualizerController.java

示例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);
    }
 
开发者ID:reyanshmishra,项目名称:Rey-MusicPlayer,代码行数:15,代码来源:EqualizerHelper.java

示例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);
	}
}
 
开发者ID:nvllsvm,项目名称:Audinaut,代码行数:15,代码来源:EqualizerController.java

示例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);
}
 
开发者ID:MadMarty,项目名称:madsonic-5.5,代码行数:10,代码来源:EqualizerController.java

示例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);

}
 
开发者ID:KishanV,项目名称:Android-Music-Player,代码行数:61,代码来源:musicHandler.java

示例7: bindCustomEqualizer

import android.media.audiofx.Equalizer; //导入方法依赖的package包/类
private void bindCustomEqualizer(int audioSessionId) {
    mEqualizer = new Equalizer(0, audioSessionId);
    mEqualizer.setProperties(mEqualizerSettings);
    mEqualizer.setEnabled(true);
}
 
开发者ID:marverenic,项目名称:Jockey,代码行数:6,代码来源:EqualizedExoPlayer.java

示例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);
   	}    	
}
 
开发者ID:arpruss,项目名称:speakerboost,代码行数:47,代码来源:Settings.java


注:本文中的android.media.audiofx.Equalizer.setEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。