dcsimg

How do I determine when a Midi Audio Player has finished playing?

John Zukowski

Add a MetaEventListener to the sequencer. See How do I load and play a Midi audio file? for how to setup the sequencer.

MetaEventListener listener = new MetaEventListener() {
  public void meta(MetaMessage event) {
    if (event.getType() == 47) {
      System.out.println("Done playing");
    }
  }
};
sequencer.addMetaEventListener(listener);