Code example for Visualizer

Methods: release

    //Test case 2.2: test capture in polling mode with volume scaling 
    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();
        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 mutes 
            // audio after the effects and not before 
            vc = new AudioEffect(