public void execute() { if (saved == null) { decodeFrame(); if (buffer.isOpen()) buffer.write(sampleBuffer.getData()); } else { buffer.write(saved); saved = null; } }
@Override public AudioFormat getFormat() { if (audioFormat == null) { // read first frame decodeFrame(); audioFormat = new AudioFormat( sampleBuffer.getSampleRate(), sampleBuffer.getBitsPerSample(), sampleBuffer.getChannels(), true, true); saved = sampleBuffer.getData(); } return audioFormat; }