When testing my MIDIO128 in my organ application I came across the following problem:
The Program Change (C0) event didn’t produce the desired result. I used the following example in the MIDI128 ini file
(Program Change) Example: C0 01 00 FF 00 00 @OnOff (ON: send C0 01, OFF: send nothing!)
(Channel Aftertouch) Example: D0 40 00 FF 00 00 @OnOff (ON: send D0 40, OFF: send nothing!)
The result was this:
00048EBF 9 – C0 00 – 1 — PC: Acc. Grand Piano
000495CF 9 – F0 Buffer: 9 Bytes System Exclusive
SYSX: F0 43 10 5C 10 10 31 00 F7
00050607 9 – D0 00 – 1 — Channel Aft
00050BCA 9 – F0 Buffer: 9 Bytes System Exclusive
SYSX: F0 43 10 5C 10 10 31 00 F7
After some experimenting I found that the “on†event sends byte 2 instead of byte 1. The cause seems to come from the “midi_evnt.incâ€
;; sending two bytes
MIDI_EVNT_Send_Cx ; Program Change
MIDI_EVNT_Send_Dx ; Channel Pressure
movff MIDI_EVNT0, WREG
call MIOS_MIDI_TxBufferPut
movff MIDI_EVNT_VALUE, WREG
andlw 0x7f
call MIOS_MIDI_TxBufferPut
rgoto MIDI_EVNT_Send_End
After I changed it to the following the “on†event works OK
;; sending two bytes
MIDI_EVNT_Send_Cx ; Program Change
MIDI_EVNT_Send_Dx ; Channel Pressure
movff MIDI_EVNT0, WREG
call MIOS_MIDI_TxBufferPut
MOVFF MIDI_EVNT1, WREG ; <-----Changed
andlw 0x7f
call MIOS_MIDI_TxBufferPut
rgoto MIDI_EVNT_Send_End
Result:
000A492B 9 – C0 01 – 1 — PC: Brite Acc. Piano <— OK
000A4AA6 9 – F0 Buffer: 9 Bytes System Exclusive <— Shouldn’t be there!!
SYSX: F0 43 10 5C 10 10 31 00 F7
000A8675 9 – D0 40 – 1 — Channel Aft <— OK
000A8785 9 – F0 Buffer: 9 Bytes System Exclusive <— Shouldn’t be there!!
SYSX: F0 43 10 5C 10 10 31 00 F7
If byte 0 is FF the MIDIO128 is supposed to send nothing. Instead a SYSEX string is presented. It seems to originate from the midi_meta.inc routine but I don’t know how to fix it so I’m hoping for some help there.
Per S