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 114 of file Keyboard.cpp.

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