Hi I have java application which plays midi messages from sequence. I\'m doing this using jfugue library.
the problem is when I\'m tryingto stop playback with stop butto
I'm guessing you need to call Player.allNotesOff() before calling sequencer.stop()
. Untested, so please let me know if it didn't work.
When MIDI plays music, it uses a combination of NOTE_ON and NOTE_OFF events. It sounds like when you press the stop button, the sequence is stopping after a NOTE_ON event had been sent, but before a NOTE_OFF event was sent. That means the sound will continue to play indefinitely.
Player.allNotesOff()
in JFugue makes a call to JavaSound's allNotesOff()
method in the Channel class; this call is made for each MIDI Channel (there are 16 channels). It's unfortunate that this solution isn't working. Try calling Player.allNotesOff()
after sequencer.stop()
, see if that helps.