CoderLine/alphaTab — Issue #21: Java applet stutters/stalls on Mac OSX
Author: omnomnomben
Created: 2011-12-10 04:51:23+00:00
State: open

A longstanding issue that I haven't been able to fix. Initial research seems to suggest that this is a bug in Apple's Java implementation. Some report that it is a Lion-only bug.

Some testing reveals that this is indeed the case:
```import javax.sound.midi.*;
import java.io.InputStream;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

public class MidiPlayer {

public static void main(String[] args) {
try {
Sequencer sequencer = MidiSystem.getSequencer();
if (sequencer == null)
throw new MidiUnavailableException();
sequencer.open();
FileInputStream is = new FileInputStream("sample.mid");
Sequence mySeq = MidiSystem.getSequence(is);
sequencer.setSequence(mySeq);
sequencer.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}```
This ultra-simple test demonstrates stuttering/hanging of playback on Mac OSX.

However, TuxGuitar, which is Java based, doesn't exhibit this issue. I'll do more research on this and try to adopt whatever method they used to overcome this bug.