本文整理汇总了Java中android.media.audiofx.BassBoost类的典型用法代码示例。如果您正苦于以下问题:Java BassBoost类的具体用法?Java BassBoost怎么用?Java BassBoost使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BassBoost类属于android.media.audiofx包,在下文中一共展示了BassBoost类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: release
import android.media.audiofx.BassBoost; //导入依赖的package包/类
private void release(AudioEffect effect) {
if (null != effect) {
effect.setControlStatusListener(null);
effect.setEnableStatusListener(null);
if (effect instanceof Equalizer) {
((Equalizer) effect).setParameterListener(null);
} else if (effect instanceof BassBoost) {
((BassBoost) effect).setParameterListener(null);
} else if (effect instanceof Virtualizer) {
((Virtualizer) effect).setParameterListener(null);
}
effect.release();
}
}
示例2: 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);
}
示例3: initBass
import android.media.audiofx.BassBoost; //导入依赖的package包/类
public static void initBass(int audioID) {
EndBass();
try {
bassBoost = new BassBoost(0, audioID);
short savestr = (short) Extras.getInstance().saveEq().getInt(BASS_BOOST, 0);
if (savestr > 0) {
setBassBoostStrength(savestr);
}else {
setBassBoostStrength((short) 0);
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例4: init
import android.media.audiofx.BassBoost; //导入依赖的package包/类
private void init() {
equalizer = new Equalizer(0, audioSessionId);
bass = new BassBoost(0, audioSessionId);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
loudnessAvailable = true;
loudnessEnhancerController = new LoudnessEnhancerController(context, audioSessionId);
}
}
示例5: getBassBoost
import android.media.audiofx.BassBoost; //导入依赖的package包/类
public BassBoost getBassBoost() {
if(released) {
released = false;
try {
init();
} catch (Throwable x) {
bass = null;
Log.w(TAG, "Failed to create bass booster.", x);
}
}
return bass;
}
示例6: 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);
}
}
示例7: initEqualizer
import android.media.audiofx.BassBoost; //导入依赖的package包/类
/**
* @param media player from apollo service.
*/
public static void initEqualizer(MediaPlayer player, Context context){
releaseEqualizer();
int id = player.getAudioSessionId();
mEqualizer = new Equalizer(1,id);
mBoost = new BassBoost(1, id);
updateEqualizerSettings(context);
}
示例8: 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();
}
});
}
示例9: 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);
}
示例10: getBassBoost
import android.media.audiofx.BassBoost; //导入依赖的package包/类
public static BassBoost getBassBoost() {
if (AudioTimeline.getMusicPlaybackService() == null
|| AudioTimeline.getMusicPlaybackService().getMediaPlayer() == null) {
return null;
}
int audioSessionId = AudioTimeline.getMusicPlaybackService()
.getMediaPlayer().getAudioSessionId();
bassBoost = new BassBoost(0, audioSessionId);
return bassBoost;
}
示例11: 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();
}
示例12: getBassBoost
import android.media.audiofx.BassBoost; //导入依赖的package包/类
public BassBoost getBassBoost() {
return mBassBoost;
}
示例13: setBassBoost
import android.media.audiofx.BassBoost; //导入依赖的package包/类
public void setBassBoost(BassBoost bassBoost) {
mBassBoost = bassBoost;
}
示例14: 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);
}