Code example for Visualizer

Methods: release

0
    //Test case 2.2: test capture in polling mode with volume scaling 
    @LargeTest 
    public void test2_2PollingCaptureVolumeScaling() throws Exception { 
        // test that when playing a sound, the energy measured with Visualizer in 
        //   SCALING_MODE_AS_PLAYED mode decreases when lowering the volume 
        boolean result = false;
        String msg = "test2_2PollingCaptureVolumeScaling()";
        AudioEffect vc = null;
        MediaPlayer mp = null;
        AudioManager am = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE);
        int ringerMode = am.getRingerMode();
        am.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
        final int volMax = am.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
        am.setStreamVolume(AudioManager.STREAM_MUSIC, volMax, 0);
 
        try { 
            // test setup not related to tested functionality: 
            // creating a volume controller on output mix ensures that ro.audio.silent mutes 
            // audio after the effects and not before 
            vc = new AudioEffect(
                                AudioEffect.EFFECT_TYPE_NULL,