I’ve finally run into another stumbling block in getting the SEQ to feel like an 808’s sequencer. What I have been successful in doing is ‘mapping’ the press of a function button + GP button to changing both the track and layer parameters so that users can select which instrument they are editing (we are in drum mode). Now, what I want to implement is the instrument select switch like on the original using an encoder. I’ve already got variables setup that remember which number instrument was last pressed so I can increment or decrement that in response to an encoder event and then I *should* be able to move the result into MIOS_PARAMETER1 and then call PROJECT8_ChangeInstrument which takes a GP number, converts it into track/layer then calls SEQ_BUTTON_Trackx_Cont & SEQ_BUTTON_Layerx to change the active layer. Now, moving the encoder does change the value of PROJECT8_INSTNUM0 and that is reflected in the GP LED display (I have coded it to display the selected track when the function key is pressed). However, there are two problems: the first is that the track/layer value doesn’t get updated and the second I believe provides the best clue as to what is happening. When I move the encoder the app doesn’t always respond right away, the impression I get is that the value from the encoder is only being updated at a period similar to 1/8 note causing it to sometimes adjust immediatly and sometimes take a few 10s of miliseconds to update. Now, after troubleshooting this for most of the evening I’ve decided to take a break and see if I can get a hint or just a fresh perspective from people here. It’s occured to me that perhaps this is normal behavior for the encoders in the SEQ app as they are not normally used like this. That still would not explain why the track/layer doesn’t get updated tho, most of my troubleshooting has been focused around being sure that the value of MIOS_PARAMETER1 that gets ‘passed’ into PROJECT8_ChangeInstrument is correct, and I am 99% sure of that now.
Variable declarations
;; free for your pleasure: 0x360-0x37f
;; and 0x380-0x3ff if the AIN handler is disabled
P8_BASE EQU 0x380
PROJECT8_INSTNUM0 EQU 0x380
PROJECT8_INSTNUM1 EQU 0x381
PROJECT8_MODE EQU 0x382
PROJECT8_PARAM1 EQU 0x383
PROJECT8_PARAM2 EQU 0x384
PROJECT8_PARAM3 EQU 0x385
PROJECT8_INST_LED0 EQU 0x386
PROJECT8_INST_LED1 EQU 0x387
PROJECT8_TEMP_VAR EQU 0x388
Encoder pin assignments
MIOS_ENC_PIN_TABLE
;; encoders 1-16
;; SR Pin Mode
#if DEFAULT_ENC_DATAWHEEL >= 0
ENC_ENTRY 2, 2, MIOS_ENC_MODE_DETENTED ; Data Wheel
#endif
ENC_ENTRY 1, 6, MIOS_ENC_MODE_DETENTED2 ; ins select
ENC_ENTRY 6, 2, MIOS_ENC_MODE_DETENTED2 ; tempo
Catching the encoder events
USER_ENC_NotifyChange
#if DEFAULT_ENC_DATAWHEEL >= 0
;; branch to SEQ_ENC_Datawheel if datawheel
movf MIOS_PARAMETER1, W
xorlw DEFAULT_ENC_DATAWHEEL
skpnz
goto SEQ_ENC_Datawheel
#endif
movf MIOS_PARAMETER1, W
xorlw 0x00
skpnz
goto PROJECT8_InstChange
movf MIOS_PARAMETER1, W
xorlw 0x01
skpnz
goto PROJECT8_TempoChange
inc/dec the current selected instrument (track/layer) and move it into MIOS_PARAMETER1
PROJECT8_InstChange
SET_BSR P8_BASE
btfss MIOS_PARAMETER2, 7, 0 ; increment if negative bit is clear
incf PROJECT8_INSTNUM0, 1
btfsc MIOS_PARAMETER2, 7, 0 ; decrement if negative bit is set
decf PROJECT8_INSTNUM0, 1
movff PROJECT8_INSTNUM0, MIOS_PARAMETER1
PROJECT8_ChangeInstrument
;This function takes MIOS_PARAMETER1, converts it to a track/layer number then calls the functions to change the track/layer
Some of the additional code to display the selected track on the GP LED’s. PROJECT8_INSTNUM0 is used to determine which LED to light up, so I’m fairly sure it is not being overwritten
SEQ_GP_LED_Update
;; clear the 16 GP LEDs
SET_BSR SEQ_BASE
clrf SEQ_GP_LED0, BANKED
clrf SEQ_GP_LED1, BANKED
;; menu select LED overlays everything
SET_BSR P8_BASE
BIFSET PROJECT8_MODE, PROJECT8_MODE_MENU1, BANKED, rgoto PROJECT8_Menu1_LED
SET_BSR SEQ_BASE