@@ -15,15 +15,19 @@ PatchProcessor* getInitialisingPatchProcessor(){
1515}
1616
1717void doSetPatchParameter (uint8_t id, int16_t value){
18- if (getProgramVector ()->checksum >= PROGRAM_VECTOR_CHECKSUM_V12 &&
19- getProgramVector ()->setPatchParameter != NULL )
20- getProgramVector ()->setPatchParameter (id, value);
18+ ProgramVector vec = getProgramVector ();
19+ if (vec->checksum >= PROGRAM_VECTOR_CHECKSUM_V12 &&
20+ vec->setPatchParameter != NULL && vec->parameters [id] != value)
21+ vec->setPatchParameter (id, value);
2122}
2223
2324void doSetButton (uint8_t id, uint16_t value, uint16_t samples){
24- if (getProgramVector ()->checksum >= PROGRAM_VECTOR_CHECKSUM_V12 &&
25- getProgramVector ()->setButton != NULL )
26- getProgramVector ()->setButton ((PatchButtonId)id, value, samples);
25+ ProgramVector vec = getProgramVector ();
26+ if (vec->checksum >= PROGRAM_VECTOR_CHECKSUM_V12 &&
27+ vec->setButton != NULL &&
28+ // if it is not a MIDI note, check that value has changed
29+ (id > 31 || (bool )(vec->buttons &(1 <<id)) != (bool )value))
30+ vec->setButton ((PatchButtonId)id, value, samples);
2731}
2832
2933void onButtonChanged (uint8_t id, uint16_t value, uint16_t samples){
0 commit comments