FastLED 3.9.15
Loading...
Searching...
No Matches

◆ HandleNoteOn()

void KeyboardState::HandleNoteOn ( uint8_t midi_note,
uint8_t velocity,
int color_selector_value,
uint32_t now_ms )

Definition at line 116 of file Keyboard.cpp.

116 {
117 if (0 == velocity) {
118 // Some keyboards signify "NoteOff" with a velocity of zero.
119 HandleNoteOff(midi_note, velocity, now_ms);
120 return;
121 }
122
123#ifdef DEBUG_KEYBOARD
124 dprint("HandleNoteOn:");
125
126 dprint("midi_note = ");
127 dprint(midi_note);
128
129 dprint(", velocity = ");
130 dprintln(velocity);
131 #endif
132
133 float brightness = ToBrightness(velocity);
134
135 dprint("brightness: "); dprintln(brightness);
136
137 ColorHSV pixel_color_hsv = SelectColor(midi_note, brightness,
138 color_selector_value);
139
140 // TODO: Give a key access to the Keyboard owner, therefore it could inspect the
141 // sustained variable instead of passing it here.
142 Key* key = GetKey(midi_note);
143
144 dprint("key indx: "); dprintln(key->idx_);
145
146 key->SetOn(velocity, pixel_color_hsv, now_ms);
147}
UISlider brightness("Brightness", 255, 0, 255, 1)
Key * GetKey(int midi_pitch)
Definition Keyboard.cpp:207
void HandleNoteOff(uint8_t midi_note, uint8_t velocity, uint32_t now_ms)
Definition Keyboard.cpp:149
const ColorHSV SelectColor(int midi_note, float brightness, int color_selector_val)
#define dprint(x)
Definition dprint.h:11
#define dprintln(x)
Definition dprint.h:12
int idx_
Definition Keyboard.h:40
void SetOn(uint8_t vel, const ColorHSV &color, uint32_t now_ms)
Definition Keyboard.cpp:14
float ToBrightness(int velocity)
Definition util.cpp:98

References brightness, dprint, dprintln, GetKey(), HandleNoteOff(), Key::idx_, SelectColor(), Key::SetOn(), and ToBrightness().

+ Here is the call graph for this function: