fix NoteOff ElapsedTime of MIDI Tracks

This commit is contained in:
josc146 2023-11-30 11:55:10 +08:00
parent 102763b94d
commit a78c346371

View File

@ -86,6 +86,12 @@ func (a *App) OpenMidiPort(index int) error {
channel := bytes[0] & 0x0f
switch msgType {
case 0x8:
elapsed := time.Since(lastNoteTime)
lastNoteTime = time.Now()
runtime.EventsEmit(a.ctx, "midiMessage", &MIDIMessage{
MessageType: "ElapsedTime",
Value: int(elapsed.Milliseconds()),
})
note := bytes[1]
runtime.EventsEmit(a.ctx, "midiMessage", &MIDIMessage{
MessageType: "NoteOff",