本文整理汇总了Java中android.media.audiofx.BassBoost.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java BassBoost.setEnabled方法的具体用法?Java BassBoost.setEnabled怎么用?Java BassBoost.setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.media.audiofx.BassBoost
的用法示例。
在下文中一共展示了BassBoost.setEnabled方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EqualizerHelper
import android.media.audiofx.BassBoost; //导入方法依赖的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);
}
示例2: apply
import android.media.audiofx.BassBoost; //导入方法依赖的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);
}
}
示例3: initMusicPlayer
import android.media.audiofx.BassBoost; //导入方法依赖的package包/类
public void initMusicPlayer(){
Log.d("State", "MyService: initMusicPlayer()");
player = new MediaPlayer();
player.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK);
player.setAudioStreamType(AudioManager.STREAM_MUSIC);
MainActivity.SESSION=player.getAudioSessionId();
Log.d("State","Session: "+player.getAudioSessionId());
bass=new BassBoost(0,MainActivity.SESSION);
bass.setEnabled(true);
MainActivity.settings.moveToFirst();
if(MainActivity.settings.getInt(4)==1) {
bass.setStrength((short)1000);
}else{
bass.setStrength((short)0);
}
if(MainActivity.IS_FIRST_TIME_BY_SESSION_INIT) {
afListenerMusic = new AFListener();
int requestResult = audioManager.requestAudioFocus(afListenerMusic, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
Log.d("State", "Music request focus, result: " + requestResult);
MainActivity.IS_FIRST_TIME_BY_SESSION_INIT=false;
}else{
Player.setupEqualizer();
}
player.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
musicCompleted();
}
});
}
示例4: restoreBassBoost
import android.media.audiofx.BassBoost; //导入方法依赖的package包/类
private void restoreBassBoost() {
mBassBoost = new BassBoost(Integer.MAX_VALUE, mSessionId);
synchronized (SETTINGS_LOCK) {
mBassBoost.setStrength((short) mBassBoostSettings.strength);
}
mBassBoost.setEnabled(true);
}
示例5: onCreate
import android.media.audiofx.BassBoost; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d(AppConstants.LOG_TAG, "onCreate");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hello_audioeffect);
setUpViews();
playSong();
mBassBoost = new BassBoost(0, mMediaPlayer.getAudioSessionId());
mBassBoost.setEnabled(true);
mVirtualizer = new Virtualizer(0, mMediaPlayer.getAudioSessionId());
mVirtualizer.setEnabled(true);
mAudioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
mMaxVolume = mAudioManager
.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
Log.d(AppConstants.LOG_TAG, "Max Volume: " + mMaxVolume);
mVolumeBar.setMax(mMaxVolume);
mLeftSeekBar.setMax(mMaxVolume);
mRightSeekBar.setMax(mMaxVolume);
updateCurrentVolume();
}
示例6: musicHandler
import android.media.audiofx.BassBoost; //导入方法依赖的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);
}