Enhanced NG features for optimized use of a Mackie C4 Controller#10
Open
mstr0bl wants to merge 7 commits intomidibox:masterfrom
Open
Enhanced NG features for optimized use of a Mackie C4 Controller#10mstr0bl wants to merge 7 commits intomidibox:masterfrom
mstr0bl wants to merge 7 commits intomidibox:masterfrom
Conversation
midibox
reviewed
Oct 10, 2020
| case MBNG_EVENT_ENC_MODE_C4ENC: | ||
| if( item->value != 0x00 ) { | ||
| if(item->value < 0x40){ | ||
| switch(item->value){ |
Owner
There was a problem hiding this comment.
Instead of a switch() statement it would be better to use range checks here in case values are processed which are not explicitly mentioned here (for whatever reason…)
E.g.:
if( item->value <= 1 ) incrementer = 1;
else if( item->value <=4 ) incrementer = 2;
else if( item->value <=8 ) incrementer= 4;
…
midibox
reviewed
Oct 10, 2020
| } | ||
| else{ | ||
| switch(item->value){ | ||
| case 0x41: incrementer = -1; break; |
Owner
There was a problem hiding this comment.
same here: range checks would be better
Author
There was a problem hiding this comment.
What about mbng_enc.c line 223 onwards?
case MBNG_EVENT_ENC_MODE_C4ENC: if(event_incrementer > 0){ switch(event_incrementer){ case 1: item.value = 0x01; break; case 2: item.value = 0x04; break; case 4: item.value = 0x08; break;
And so on..
Is a range check more efficient in that case too?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The relevant modifications are referred to as "macdis" and "c4enc"