- Added CC 123 Command to reset the NoteOn Counters
- Fixed Bug, where NoteOn Counters could be negative
This commit is contained in:
@@ -268,7 +268,10 @@ void Core1_Light_Controller_MIDI_Full_Note_Received(uint8_t midi_event, uint8_t
|
||||
{
|
||||
if(midi_note_in_octave == NOTE_COLOR_RED || midi_note_in_octave == NOTE_COLOR_RED_ALT)
|
||||
{
|
||||
_NoteOn_Color_Counter[ch][R]--;
|
||||
if(_NoteOn_Color_Counter[ch][R] > 0) {
|
||||
_NoteOn_Color_Counter[ch][R]--;
|
||||
}
|
||||
|
||||
if(_NoteOn_Color_Counter[ch][R] == 0) { Core1_LED_Control_Set_DC_Direct(ch, R, 0); }
|
||||
|
||||
#ifdef COUNT_APPLIED_NOTES
|
||||
@@ -277,7 +280,10 @@ void Core1_Light_Controller_MIDI_Full_Note_Received(uint8_t midi_event, uint8_t
|
||||
}
|
||||
else if(midi_note_in_octave == NOTE_COLOR_GREEN || midi_note_in_octave == NOTE_COLOR_GREEN_ALT)
|
||||
{
|
||||
_NoteOn_Color_Counter[ch][G]--;
|
||||
if(_NoteOn_Color_Counter[ch][G] > 0) {
|
||||
_NoteOn_Color_Counter[ch][G]--;
|
||||
}
|
||||
|
||||
if(_NoteOn_Color_Counter[ch][G] == 0) { Core1_LED_Control_Set_DC_Direct(ch, G, 0); }
|
||||
|
||||
#ifdef COUNT_APPLIED_NOTES
|
||||
@@ -286,7 +292,10 @@ void Core1_Light_Controller_MIDI_Full_Note_Received(uint8_t midi_event, uint8_t
|
||||
}
|
||||
else if(midi_note_in_octave == NOTE_COLOR_BLUE || midi_note_in_octave == NOTE_COLOR_BLUE_ALT)
|
||||
{
|
||||
_NoteOn_Color_Counter[ch][B]--;
|
||||
if(_NoteOn_Color_Counter[ch][B] > 0) {
|
||||
_NoteOn_Color_Counter[ch][B]--;
|
||||
}
|
||||
|
||||
if(_NoteOn_Color_Counter[ch][B] == 0) { Core1_LED_Control_Set_DC_Direct(ch, B, 0); }
|
||||
|
||||
#ifdef COUNT_APPLIED_NOTES
|
||||
@@ -313,6 +322,35 @@ void Core1_Light_Controller_MIDI_Full_Note_Received(uint8_t midi_event, uint8_t
|
||||
}
|
||||
}
|
||||
|
||||
void Core1_Light_Controller_MIDI_Full_CC_Received(uint8_t midi_event, uint8_t midi_channel, uint8_t controller_number, uint8_t controller_value)
|
||||
{
|
||||
Core1_Light_Controller_Pause_Light_Trigger(midi_event, midi_channel);
|
||||
|
||||
for(uint ch=0;ch<NUM_LED_CHANNELS;ch++)
|
||||
{
|
||||
if(Core1_Light_Controller_Check_Channel_Match(ch, midi_channel) != true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(midi_event == MIDI_EVENT_CONTROL_CHANGE) {
|
||||
switch(controller_number) {
|
||||
case MIDI_CC_ALL_NOTES_OFF:
|
||||
_NoteOn_Color_Counter[ch][R] = 0;
|
||||
_NoteOn_Color_Counter[ch][G] = 0;
|
||||
_NoteOn_Color_Counter[ch][B] = 0;
|
||||
|
||||
Core1_LED_Control_Set_DC_Direct(ch, R, 0);
|
||||
Core1_LED_Control_Set_DC_Direct(ch, G, 0);
|
||||
Core1_LED_Control_Set_DC_Direct(ch, B, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Core1_Light_Controller_Set_MIDI_To_Light_Enabled(bool enabled)
|
||||
{
|
||||
_MIDI_To_Light_Enabled = enabled;
|
||||
|
||||
Reference in New Issue
Block a user