问题
*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