Stryd
When I woke up this morning, I was able to test my solution for this problem after installing Code:Blocks and the nice library that comes with it.
The solution seems to work like a charm; each pot I confgured to behave differently in regards to when and how often it sends a SYSEX.
For the slow pots, they only send SYSEX on the first movement and on the last.
Below is the code I wrote to make this happen:
void AIN_NotifyChange(unsigned char pin, unsigned int pin_value) __wparam
{
.
.
.
// when a pot is 1st moved, this flag isn’t set, so the first move gets transmitted
// and all other subsequent pot movements do not.
if(!app_flags.TRANSMIT_SPECIAL_PARAM) {
Transmit_MIDI(pin, value);
app_flags.TRANSMIT_SPECIAL_PARAM = 1;
MIOS_LCD_CursorSet(0x46); // give a visual that a pot is being moved
MIOS_LCD_PrintCString(“-”);
}
.
.
.
}
and later in:
void Tick(void) __wparam
{
unsigned int interval;
// We set the special parameter when a slow pot was moved in AIN_Notify
// We didn’t transmit then but we will after this counts to max
if(!app_flags.TRANSMIT_SPECIAL_PARAM)
return;
// At this point, app_flags.TRANSMIT_SPECIAL_PARAM is set to 1
// the pot config lookup table is made of unsigned chars, so we have to cast the UPDATE_INTERVAL value to an INT so we can multiply it to a larger number
interval = (unsigned int)POT_CONFIG_MAP[last_ain_pin][POT_CONFIG_UPDATE_INTERVAL];
// we transmit the last pin values here only when we’ve counted high enough
if(PotUpdateCount >= (interval * 500) {
MIOS_LCD_CursorSet(0x46); // display a visual of when the SYSEX transmits
MIOS_LCD_PrintCString(“*”); //
app_flags.TRANSMIT_SPECIAL_PARAM = 0;
Transmit_MIDI(last_ain_pin, last_ain_value);
PotUpdateCount = 0;
}
PotUpdateCount++;
}
I spent 5 minutes moving, listening and watching the MIDI monitor while moving the pots and I like what I see.
The high resolution pots sound good and the pots that need slow transmissions are working with no stuttering or note hanging.
I’m very pleased!