Hi, i’m trying to use this emulation in a non standard setup and was wondering if it would be easy to add another group of switches but with ability to send NoteOn and NoteOff messages.
This is the original motormix emulation code for button handling :-
MM_BUTTON_Handler
;; in calibration mode, jump to dedicated button handler
IFSET MM_STAT, MM_STAT_CALI_SEL, goto MM_CALI_BUTTON_Handler
MM_CALI_BUTTON_Handler_Return
;; calc address to button function: MM_IO_TABLE + (button_nr << 1)
TABLE_ADDR MM_IO_TABLE_LAYER0 ; init table pointer
movf MIOS_PARAMETER1, W
mullw 2
;; if layer1 selected, increment high byte (-> +256)
btfsc MM_STAT, MM_STAT_LAYER_SEL
incf PRODH, F
movf PRODL, W ; add low-byte of offset to TBLPTRL
addwf TBLPTRL, F
movf PRODH, W ; add high-byte of offset to TBLPTRL
addwfc TBLPTRH, F
;; read ID
tblrd*+
;; exit routine if no event has been defined for this button (entry = 0xff)
incf TABLAT, W
skpnz
return
;; if bit 7 is set, branch to MM_SFB handler!
movf TABLAT, W
andlw 0x7f
IFSET TABLAT, 7, rgoto MM_SFB_Handler
#if TOUCH_SENSOR_MODE >= 1
;; if note event matches with any ID_FADER_TOUCH_CHNx, use the MIOS function
;; to suspend the faders
#if ID_FADER_TOUCH_CHN1 != 0x00 || ID_FADER_TOUCH_CHN2 != 0x01 || ID_FADER_TOUCH_CHN3 != 0x02 || ID_FADER_TOUCH_CHN4 != 0x03
.error "inconsistency in ID_FADER_TOUCH_CHNx - the TOUCH_SENSOR_MODE won't work properly!"
#endif
#if ID_FADER_TOUCH_CHN5 != 0x04 || ID_FADER_TOUCH_CHN6 != 0x05 || ID_FADER_TOUCH_CHN7 != 0x06 || ID_FADER_TOUCH_CHN8 != 0x07
.error "inconsistency in ID_FADER_TOUCH_CHNx - the TOUCH_SENSOR_MODE won't work properly!"
#endif
movf TABLAT, W
andlw 0xf8
xorlw ID_FADER_TOUCH_CHN1
bz MM_BUTTON_Handler_MFSuspend
movf TABLAT, W
MM_BUTTON_Handler_MFSuspend
movf TABLAT, W
andlw 0x07
IFCLR MIOS_PARAMETER2, 0, call MIOS_MF_SuspendEnable
IFSET MIOS_PARAMETER2, 0, call MIOS_MF_SuspendDisable
MM_BUTTON_Handler_NoMFSuspend
#endif
;; for MIDIbox Link: notify begin of stream
call MIOS_MIDI_BeginStream
;; send first MIDI byte, must be 0xb0
movlw 0xb0 | ((MM_MIDI_CHANNEL-1) & 0x0f)
call MIOS_MIDI_TxBufferPut
;; send second MIDI byte (0x0f)
movlw 0x0f
call MIOS_MIDI_TxBufferPut
;; now branch depending on button ID range
movlw 0x30-1
IFLEQ TABLAT, ACCESS, rgoto MM_BUTTON_Handler_R1
movlw 0x38-1
IFLEQ TABLAT, ACCESS, rgoto MM_BUTTON_Handler_R2
movlw 0x40-1
IFLEQ TABLAT, ACCESS, rgoto MM_BUTTON_Handler_R3
movlw 0x50-1
IFLEQ TABLAT, ACCESS, rgoto MM_BUTTON_Handler_R4
rgoto MM_BUTTON_Handler_R5
MM_BUTTON_Handler_R1 ; Range #1: Fader/Select/Mute/Solo/Multi/RecRdy
;; send third byte: button 0-7
movf TABLAT, W
andlw 0x07
call MIOS_MIDI_TxBufferPut
;; send fourth byte: always 0x2f
movlw 0x2f
call MIOS_MIDI_TxBufferPut
;; send fifth byte: 0x00-0x05
rrf TABLAT, W
rrf WREG, W
rrf WREG, W
andlw 0x07
rgoto MM_BUTTON_Handler_Cont
MM_BUTTON_Handler_R2 ; Range #2: 0x08 group
;; send third byte: 0x08
movlw 0x08
call MIOS_MIDI_TxBufferPut
;; send fourth byte: always 0x2f
movlw 0x2f
call MIOS_MIDI_TxBufferPut
;; send fifth byte: 0x00-0x07
movf TABLAT, W
andlw 0x07
rgoto MM_BUTTON_Handler_Cont
MM_BUTTON_Handler_R3 ; Range #3: 0x09 group
;; send third byte: 0x09
movlw 0x09
call MIOS_MIDI_TxBufferPut
;; send fourth byte: always 0x2f
movlw 0x2f
call MIOS_MIDI_TxBufferPut
;; send fifth byte: 0x00-0x07
movf TABLAT, W
andlw 0x07
rgoto MM_BUTTON_Handler_Cont
MM_BUTTON_Handler_R4 ; Range #4: 0x0a group
;; send third byte: 0x0a
movlw 0x0a
call MIOS_MIDI_TxBufferPut
;; send fourth byte: always 0x2f
movlw 0x2f
call MIOS_MIDI_TxBufferPut
;; send fifth byte: 0x00-0x07
movf TABLAT, W
andlw 0x07
rgoto MM_BUTTON_Handler_Cont
MM_BUTTON_Handler_R5 ; Range #5: 0x0b group
;; send third byte: 0x0b
movlw 0x0b
call MIOS_MIDI_TxBufferPut
;; send fourth byte: always 0x2f
movlw 0x2f
call MIOS_MIDI_TxBufferPut
;; send fifth byte: 0x00-0x07
movf TABLAT, W
andlw 0x07
;; rgoto MM_BUTTON_Handler_Cont
MM_BUTTON_Handler_Cont
;; fifth byte: set bit#6 if button pressed
IFCLR MIOS_PARAMETER2, 0, iorlw 0x40
call MIOS_MIDI_TxBufferPut
;; for MIDIbox Link: notify end of stream
call MIOS_MIDI_EndStream
;; thats all
return
So i was wondering if its possible and easy to add another group of 8 switches and corresponding leds to send NoteOn/Off messages after Range #5: 0x0b group.
Any tips or info would be much appreciated.
Thanks
Frank