Well this is finally working. I got my mb64 to do transpose.
Here’s my extra code to use META_EVENT_8 to perform a note shift or transpose.
When you assign a button to a meta event, in the Edit Events, first it’s midi channel 1, the first hex number will be 08 (meta function #8) and the second hex number will be the number of half steps to transpose up (an octave will be 12 notes 0C hex). Lastly set the button mode to T (Toggle), unless you want to use 2 buttons for up and down, then O for OnOnly. In theory you can go up almost 10 octaves, yikes, at the touch of a button.
Hope it’s useful for anyone.
Oh, one thing, I haven’t trapped the possiblility of transposing whilst another button is held down, you’ll get notes stuck on.
Insert into app_defines.h after line 196 DRUMS_CTR
;; used by Bassman's note shifting code
NOTE_SHIFT EQU 0x69 ;;holds value for note number shift
Insert into midi_event.inc after line 71 MIDI_EVNT_Send_9x
;; pickup NOTE_SHIFT value and add to current note number
movf NOTE_SHIFT, W ;; get note shift value
addwf MIDI_EVNT1, W
movwf MIDI_EVNT1
so the section will look like;
;; sending three bytes:
MIDI_EVNT_Send_8x ; Note Off
MIDI_EVNT_Send_9x ; Note On
;; pickup NOTE_SHIFT value and add to current note number
movf NOTE_SHIFT, W ;; get note shift value
addwf MIDI_EVNT1, W ;; add NOTE_SHIFT to MIDI_EVNT1
movwf MIDI_EVNT1
MIDI_EVNT_Send_Ax ; Aftertouch
MIDI_EVNT_Send_Bx ; Controller
movff MIDI_EVNT0, WREG
call MIOS_MIDI_TxBufferPut
movff MIDI_EVNT1, WREG
andlw 0x7f
call MIOS_MIDI_TxBufferPut
movff MIDI_EVNT_VALUE, WREG
andlw 0x7f
call MIOS_MIDI_TxBufferPut
rgoto MIDI_EVNT_Send_End
This will only affect notes. But you could adapt it for other events, like move all your program changes up by 16 or 32 etc. In this case use similar 3 extra lines but put it after MIDI_EVNT_Send_Cx ; Program Change, just change the 2 references to MIDI_EVNT1 to MIDI_EVNT_VALUE. Lastly Insert into mb64_meta.inc after line 184 MB64_META_Handler_08;
movff MIDI_EVNT_VALUE, NOTE_SHIFT ;; Save shift amount in NOTE_SHIFT
return ;; exit
So it will look like this;
;; a trick: all labels are pointing to the same routine
;; Currently mb64_meta events are all F0, so midi channel 1
;; Use the first hex number in Event Edit - Meta to determine which Meta handler # to jump to.
;; Use the second hex number in Event Edit - Meta to determine number of notes to transpose
MB64_META_Handler_08 ;; Perform Note shift
;; BANKED access not required - see mb64_meta.inc
movff MIDI_EVNT_VALUE, NOTE_SHIFT ;; Save shift amount in NOTE_SHIFT
return ;; exit
MB64_META_Handler_09
MB64_META_Handler_0A
MB64_META_Handler_0B
MB64_META_Handler_0C
MB64_META_Handler_0D
MB64_META_Handler_0E
MB64_META_Handler_0F
Many thanks to stryd_one, who helped me figure it out.
bassman