Best code examples for Android BassBoost class (android.media.audiofx.BassBoost)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android BassBoost class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android BassBoost examples from Open Source projects
This code example shows how to use the following methods: release, getProperties, setProperties
    public void test1_1Properties() throws Exception { 
        boolean result = false;
        String msg = "test1_1Properties()";
        getBassBoost(0); 
        try { 
            BassBoost.Settings settings = mBassBoost.getProperties();
            String str = settings.toString();
            settings = new BassBoost.Settings(str);
            mBassBoost.setProperties(settings);
            result = true;
        } catch (IllegalArgumentException e) {
            msg = msg.concat(": Bad parameter value");
            loge(msg, "Bad parameter value");
        } catch (UnsupportedOperationException e) {
            msg = msg.concat(": get parameter() rejected");
            loge(msg, "get parameter() rejected");
        } catch (IllegalStateException e) {
            msg = msg.concat("get parameter() called in wrong state");
            loge(msg, "get parameter() called in wrong state");
        } finally { 

9
CodeRank
This code example shows how to use the following methods: release, getRoundedStrength, getStrengthSupported, setStrength
    public void test1_0Strength() throws Exception { 
        boolean result = false;
        String msg = "test1_0Strength()";
        getBassBoost(0); 
        try { 
            if (mBassBoost.getStrengthSupported()) {
                mBassBoost.setStrength((short)TEST_STRENGTH);
                short strength = mBassBoost.getRoundedStrength();
                // allow 10% difference between set strength and rounded strength 
                assertTrue(msg +": got incorrect strength",
                        ((float)strength > (float)TEST_STRENGTH * 0.9f) &&
                        ((float)strength < (float)TEST_STRENGTH * 1.1f));
            } else { 
                short strength = mBassBoost.getRoundedStrength();
                assertTrue(msg +": got incorrect strength", strength >= 0 && strength <= 1000);
            } 
            result = true;
        } catch (IllegalArgumentException e) {
            msg = msg.concat(": Bad parameter value");
            loge(msg, "Bad parameter value");

7
CodeRank
This code example shows how to use the following methods: release, getRoundedStrength, getStrengthSupported, setStrength
    public void test1_0Strength() throws Exception { 
        boolean result = false;
        String msg = "test1_0Strength()";
        getBassBoost(0); 
        try { 
            if (mBassBoost.getStrengthSupported()) {
                mBassBoost.setStrength((short)TEST_STRENGTH);
                short strength = mBassBoost.getRoundedStrength();
                // allow 10% difference between set strength and rounded strength 
                assertTrue(msg +": got incorrect strength",
                        ((float)strength > (float)TEST_STRENGTH * 0.9f) &&
                        ((float)strength < (float)TEST_STRENGTH * 1.1f));
            } else { 
                short strength = mBassBoost.getRoundedStrength();
                assertTrue(msg +": got incorrect strength", strength >= 0 && strength <= 1000);
            } 
            result = true;
        } catch (IllegalArgumentException e) {
            msg = msg.concat(": Bad parameter value");
            loge(msg, "Bad parameter value");

6
CodeRank
This code example shows how to use the following methods: setEnabled, setStrength
					Log.d("test", "bassBoost off");
				} 
			}else if(level > 20){
				bassLevel = (short) level;
				Log.d("test", "bassLevel = " + bassLevel);
				bass = new BassBoost(0, SessionID);
				bass.setEnabled(true);
				bass.setStrength(bassLevel);
				Log.d("test", "bassBoost on");
			} 
		} 
	} 
 
	public int getBassLevel(){ 
		if(!effect_on || bass == null){
			return 0; 
		} 
		return bass.getRoundedStrength();
	} 
 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getEnabled, setEnabled, getRoundedStrength
	} 
	 
	public void bassBoost(Context mContext, MediaPlayer mMediaPlayer, boolean enabled) {
		String TAG = "prototype_bassBoost";
		int sessionId = mMediaPlayer.getAudioSessionId();
		BassBoost bb = new BassBoost(0, sessionId);
		if (!enabled) {
			bb.setEnabled(enabled);
			return; 
		} 
		boolean bbEnabled = bb.getEnabled();
		Log.d(TAG, String.format("bb enabled? %s", bbEnabled));
		if (!bbEnabled) {
			Log.d(TAG, "enabling Bass Boost");
			bb.setEnabled(!bbEnabled);
		} 
		/*if (bb.getStrengthSupported()) 
			bb.setStrength((short) BB_LEVEL_LOW);*/ 
		Log.d(TAG, String.format("bass boost set to: %d", bb.getRoundedStrength()));
		 

5
CodeRank
See Code Examples for Android BassBoost Methods: