Bass Boost not working in android

筅森魡賤 提交于 2019-12-07 22:38:01

问题


*when i run this code only simple sound is playing BassBoost is not working when change the seek bar,have i done anything wrong. how i have watched some tutorials in Google,on stack-overflow none of them were answered.

	player = MediaPlayer.create(getApplicationContext(), R.raw.song);
player.start();
	

    bb = new BassBoost(0, player.getAudioSessionId());
    		bb.setEnabled(true);
    		player.setAuxEffectSendLevel(1.0f);
    		



	bassbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
    				@Override
    				public void onStopTrackingTouch(SeekBar seekBar) {
    					// TODO Auto-generated method stub
    				}
    				@Override
    				public void onStartTrackingTouch(SeekBar seekBar) {
    					// TODO Auto-generated method stub
    				}
    				@Override
    				public void onProgressChanged(SeekBar seekBar, int progress,
    						boolean fromUser) {
    					// TODO Auto-generated method stub
    					bb.setStrength((short) (progress * 10));
    				}
    			});

回答1:


Check whether it is supported or not.

bassBoost = new BassBoost(0, 0);
bassBoost.setEnabled(true);

if (bassBoost.getStrengthSupported())
{
    short word1 = bassBoost.getRoundedStrength();
    bassBoost.setStrength(word1);
}

And you can also check that whatever you're testing on supports it (it is device-dependent). You can use:

final Descriptor[] effects = AudioEffect.queryEffects();

// Determine available/supported effects 
for (final Descriptor effect : effects) {
    Log.d(TAG, effect.name.toString() + ", type: " + effect.type.toString());
}


来源:https://stackoverflow.com/questions/28584920/bass-boost-not-working-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!