Code example for SourceDataLine

Methods: close

        private void stop() { 
        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);
        public void drain(DirectAudioPlayer mediaPlayer) {
Experience pair programming with AI  Get Codota for Java