Refactor and cleanup CC dispatch logic
This commit is contained in:
parent
394b374b7f
commit
1130fceea5
7 changed files with 173 additions and 116 deletions
10
mustang.cpp
10
mustang.cpp
|
|
@ -219,18 +219,24 @@ void Mustang::updateReverb(void) {
|
|||
}
|
||||
|
||||
|
||||
int Mustang::effect_toggle(int state_index, int state)
|
||||
int Mustang::effect_toggle(int cc, int value)
|
||||
{
|
||||
int ret, received;
|
||||
unsigned char array[LENGTH];
|
||||
|
||||
// Translate 23..26 --> 2..5 (current state index)
|
||||
int state_index = cc - 21;
|
||||
int state;
|
||||
if ( value >= 0 && value <= 63 ) state = 1;
|
||||
else if ( value > 63 && value <= 127 ) state = 0;
|
||||
|
||||
memset(array, 0x00, LENGTH);
|
||||
array[0] = 0x19;
|
||||
array[1] = 0xc3;
|
||||
// Translate DSP to family
|
||||
array[FAMILY] = curr_state[state_index][DSP] - 3;
|
||||
// Invert logic
|
||||
array[ACTIVE_INVERT] = state > 0 ? 0 : 1;
|
||||
array[ACTIVE_INVERT] = state;
|
||||
array[FXSLOT] = curr_state[state_index][FXSLOT];
|
||||
#if 0
|
||||
for ( int i=0; i<15; i++ ) fprintf( stderr, "%02x ", array[i] );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue