Пример #1
0
 public void execute() {
   if (saved == null) {
     decodeFrame();
     if (buffer.isOpen()) buffer.write(sampleBuffer.getData());
   } else {
     buffer.write(saved);
     saved = null;
   }
 }
Пример #2
0
 @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;
 }