Frank Posted May 10, 2005 Report Posted May 10, 2005 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 returnSo 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.ThanksFrank Quote
TK. Posted May 10, 2005 Report Posted May 10, 2005 Hi Frank,I would integrate such changes into the USER_DIN_NotifyToggle and USER_MPROC_NotifyReceivedEvent hook (the can be found in main.asm).Currently they are branching directly to MM_BUTTON_Handler and MM_MPROC_NotifyReceivedEventBefore these branches (goto's), you could check for a certain button number (or button group) and - if the check matches - branch to your own routine which sends Note On/Off eventsLEDs: check for the expected MIDI events before branching to MM_MPROC_NotifyReceivedEventBest Regards, Thorsten. Quote
Frank Posted May 11, 2005 Author Report Posted May 11, 2005 Hi, Okay i'll check it out. Thanks TKPeace Quote
TK. Posted May 16, 2005 Report Posted May 16, 2005 Hi Frank,I'm planning to port this application to C, so it could be that such changes will be easier in the future :)Best Regards, Thorsten. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.