Code example for AudioTrack

Methods: getStatereleasesetPlaybackRate

0
        final int TEST_MODE = AudioTrack.MODE_STATIC;
        final int TEST_STREAM_TYPE = AudioManager.STREAM_MUSIC;
         
        //-------- initialization -------------- 
        int minBuffSize = AudioTrack.getMinBufferSize(TEST_SR, TEST_CONF, TEST_FORMAT);
        AudioTrack track = new AudioTrack(TEST_STREAM_TYPE, TEST_SR, TEST_CONF, TEST_FORMAT, 
                minBuffSize, TEST_MODE);
        //--------    test        -------------- 
        assumeTrue(TEST_NAME, track.getState() == AudioTrack.STATE_NO_STATIC_DATA);
        assertTrue(TEST_NAME, 
                track.setPlaybackRate(TEST_SR/2) == AudioTrack.ERROR_INVALID_OPERATION);
        //-------- tear down      -------------- 
        track.release();
    } 
     
    //----------------------------------------------------------------- 
    //      Playback progress 
    //---------------------------------- 
     
    //Test case 1: setPlaybackHeadPosition() on playing track 
    @LargeTest