Code example for AudioTrack

Methods: setPlaybackRate

0
 
    private void tweakSpeed(int i) {
        //int sampleRate = _speaker.getPlaybackRate(); 
        _sampleRate += i;
        if ((((_origSampleRate -_sampleRate)*100.0)/_origSampleRate) < 2.0){
            _speaker.setPlaybackRate(_sampleRate);
        } else { 
            _sampleRate -= i;
        } 
        AndroidLog.getLog().debug( 
                this.getClass().getSimpleName()
                + ".tweakSpeed(): would set speed to " + _sampleRate);
    } 
 
    AudioTrack getAudioTrack() {
        return _speaker;
    } 
}