adamstan Posted November 15, 2006 Report Share Posted November 15, 2006 Hello. On my neverending ;-) quest for building polysynth using MidiBox as keyboard decoder, I started to wonder if it's possible to 'merge' MIDIO128 functions into MidiBox CV so it would become all-in-one keyboard scanner ,voice assigner and MIDI interface - in one CORE module. It would be also nice to have Mono/Poly/Unison switch to change these settings without diving into menus. Do you have any suggestions??Thanks in advance :-)PS I've found quite cheap PCB manufacturer, and nearly all boards are designed, so maybe in few months the quest will be completed :-) Quote Link to comment Share on other sites More sharing options...
TK. Posted November 15, 2006 Report Share Posted November 15, 2006 Hi,so long you only want to send common MIDI events, the appr. code can be added very easily to the main.asm file:;; --------------------------------------------------------------------------;; This function is called by MIOS when an button has been toggled;; Input:;; o Button number in WREG and MIOS_PARAMETER1;; o Button value MIOS_PARAMETER2:;; - 1 if button has been released (=5V);; - 0 if button has been pressed (=0V);; --------------------------------------------------------------------------USER_DIN_NotifyToggle ;; check for control surface buttons - the CS handler will jump ;; back if the button has not been assigned to a CS function goto CS_MENU_BUTTON_HandlerCS_MENU_BUTTON_Handler_Return ;; Ok, button not assigned to CS, send a MIDI Note event movlw 0x90 call MIOS_MIDI_TxBufferPut movf MIOS_PARAMETER1, W ; button number addlw 0x18 - 4 ; add 0x18 (C-1) - 4 (first four buttons assigned to CS) call MIOS_MIDI_TxBufferPut movlw 0x7f ; send velocity=0x7f when button pressed, 0 when button depressed IFSET MIOS_PARAMETER2, 0, movlw 0 call MIOS_MIDI_TxBufferPut return[/code] The CS buttons should be assigned to DIN 0..3: [code] #define DEFAULT_DIN_MENU_EXEC 3 ; menu exec button assigned to DIN pin #3 #define DEFAULT_DIN_MENU_RIGHT 2 ; menu right button assigned to DIN pin #2 #define DEFAULT_DIN_MENU_LEFT 1 ; menu left button assigned to DIN pin #1 #define DEFAULT_DIN_MENU_SELECT 0 ; menu select button assigned to DIN pin #0Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
adamstan Posted November 15, 2006 Author Report Share Posted November 15, 2006 Thanks. I think that is what I'm looking for - but I need not only to transmit these notes via MIDI OUT, but also send them locally to CV channels without connecting MIDI OUT to IN. Does above code allow this, or is there something more needed? Quote Link to comment Share on other sites More sharing options...
TK. Posted November 15, 2006 Report Share Posted November 15, 2006 Just forward the bytes to USER_MPROC_NotifyReceivedEvent, the function header describes where the bytes are expected...Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
adamstan Posted November 16, 2006 Author Report Share Posted November 16, 2006 Is this code correct?USER_DIN_NotifyToggle ;; check for control surface buttons - the CS handler will jump ;; back if the button has not been assigned to a CS function goto CS_MENU_BUTTON_Handler CS_MENU_BUTTON_Handler_Return ;; Ok, button not assigned to CS, send a MIDI Note event movlw 0x90 call MIOS_MIDI_TxBufferPut movf MIOS_PARAMETER1, W ; button number addlw 0x18 - 4 ; add 0x18 (C-1) - 4 (first four buttons assigned to CS) movwf MIOS_PARAMETER1 ; store key number temporarily in MIOS_PARAMETER1 call MIOS_MIDI_TxBufferPut movlw 0x7f ; send velocity=0x7f when button pressed, 0 when button depressed IFSET MIOS_PARAMETER2, 0, movlw 0 call MIOS_MIDI_TxBufferPut movwf MIOS_PARAMETER3 ; put velocity in MIOS_PARAMETER3 movff MIOS_PARAMETER1, MIOS_PARAMETER2 ; put key number in MIOS_PARAMETER2 movlw 0x90 movwf MIOS_PARAMETER1 ; put 0x90 in MIOS_PARAMETER1 call USER_MPROC_NotifyReceivedEvent return Quote Link to comment Share on other sites More sharing options...
TK. Posted November 16, 2006 Report Share Posted November 16, 2006 Currently you are writing the output of MIOS_MIDI_TxBufferPut into the MIOS_PARAMETERx registers, this won't work, because WREG has an undefined value at this time.It's better to determine the MIDI bytes again after the entire MIDI event has been sent (just duplicate the code), to write them into MIOS_PARAMETER[123] instead of calling MIOS_MIDI_TxBufferPut. Thereafter you can call the MIOS hook.Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
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.