Code example for SourceDataLine

Methods: close

0
            dataLine.start();
        } 
 
        private void stop() { 
            Logger.info("stop()"); 
            dataLine.close();
        } 
 
        @Override 
        public void play(DirectAudioPlayer mediaPlayer, Pointer samples, int sampleCount, long pts) {
            // There may be more efficient ways to do this... 
            int bufferSize = sampleCount * BLOCK_SIZE;
            // You could process these samples in some way before playing them... 
            byte[] data = samples.getByteArray(0, bufferSize);
            dataLine.write(data, 0, bufferSize);
        } 
 
        @Override 
        public void drain(DirectAudioPlayer mediaPlayer) {
            Logger.info("drain()");