How to apply bass effect programmatically in android

I am trying to apply Bass effects programmatically using the following code:

BassBoost bassBoost = new BassBoost(0, audioSessionId); bassBoost.setEnabled(true); BassBoost.Settings bassBoostSettingTemp = bassBoost.getProperties(); BassBoost.Settings bassBoostSetting = new BassBoost.Settings(bassBoostSettingTemp.toString()); bassBoostSetting.strength = MAX_STRENGTH_FOR_BASS; // 1000 bassBoost.setProperties(bassBoostSetting); bassBoost.setStrength((short) progress); // progress value from seek bar 

But bass effects do not apply to the current audio session.
Please help me by showing me what is wrong.

+7
source share
1 answer

Check if this is supported.

 bassBoost = new BassBoost(0, 0); bassBoost.setEnabled(true); if (bassBoost.getStrengthSupported()) { short word1 = bassBoost.getRoundedStrength(); bassBoost.setStrength(word1); } 

And you can also verify that everything you are testing supports (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()); } 
+1
source

All Articles