Skip to content
Kaoru Shoji edited this page Feb 22, 2015 · 1 revision

For example, Playing C Scales with Player:

	Player player = new Player();
	player.play("C D E F G A B");

Different from the original JFugue, Player.play(...) doesn't block the current thread. The play method returns immediately, and the Sequencer runs on the another Thread. To wait finishing playing, player.getSequencer().addMetaEventListener(...) can be used.

For example:

	player.getSequencer().addMetaEventListener(new MetaEventListener() {
		@Override
		public void meta(MetaMessage metaMessage) {
			if (MetaMessage.TYPE_END_OF_TRACK == metaMessage.getType()) {
				// XXX playing finished
			}
		}
	});
Clone this wiki locally