Code example for AudioTrack

Methods: playwrite

0
 
    private void playPlayer(int previousState) {
        (new Thread() {
            @Override 
            public void run() { 
                audiotrack.play();
                audiotrack.write(audio, 0, audio.length);
            } 
        }).start();
    } 
 
    private void stopPlayer(boolean reinit) {
        if(audiotrack != null) {
            try { audiotrack.stop(); } catch(Exception e) { e.printStackTrace(); }
            audiotrack.release();
            audiotrack = null;
            audio = null;
        } 
        if(reinit) {
            initializeAudioTrack(); 
Experience pair programming with AI  Get Codota for Java