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

◆ PaintVuNotes()

void Painter::PaintVuNotes ( uint32_t now_ms,
const KeyboardState & keyboard,
const int * led_column_table,
int led_column_table_length,
LedRopeInterface * led_rope )
staticprivate

Definition at line 165 of file Painter.cpp.

168 {
169
170
171 FL_WARN("\n\n############## VU NOTES ################\n\n");
172
174
175 for (int i = 0; i < led_column_table_length; ++i) {
176 const Key& key = keyboard.mKeys[i];
177
178
179 // Map the white keys to the bottom and the black keys to the top.
180 bool black_key = false;
181 switch (key.mIdx % 12) {
182 case 1:
183 case 4:
184 case 6:
185 case 9:
186 case 11:
187 black_key = true;
188 break;
189 }
190
191 const int pixel_count = led_column_table[i];
192 const int draw_pixel_count = fl::ceil(pixel_count * fl::sqrt(key.mCurrColor.v_));
193
194 const int black_pixel_count = pixel_count - draw_pixel_count;
195 const Color3i& c = *led_rope->GetIterator(i);
196
197
198 const bool reverse_correct = black_key == (key.mIdx % 2);
199
200 if (reverse_correct) {
201 for (int j = 0; j < draw_pixel_count; ++j) {
202 if (j < draw_pixel_count - 1) {
204 } else {
205 // Last pixel.
206 ColorHSV hsv(random(512) / 512.f, random(512) / 512.f, 1.0);
207 led_rope->RawDrawPixel(hsv.ToRGB());
208 }
209 }
210
211 for (int j = 0; j < black_pixel_count; ++j) {
213 }
214 } else {
215 for (int j = 0; j < black_pixel_count; ++j) {
217 }
218
219 for (int j = draw_pixel_count - 1; j >= 0; --j) {
220 if (j < draw_pixel_count - 1) {
222 } else {
223 // Last pixel.
224 ColorHSV hsv(random(512) / 512.f, random(512) / 512.f, 1.0);
225 led_rope->RawDrawPixel(hsv.ToRGB());
226 }
227 }
228 }
229 }
231}
LedRopeTCL led_rope(kNumKeys)
KeyboardState keyboard
Key mKeys[kNumKeys]
Definition Keyboard.h:103
void RawCommitDraw()
void RawDrawPixel(const Color3i &c)
Color3i * GetIterator(int i)
Definition LedRopeTCL.h:58
void RawBeginDraw()
#define FL_WARN(X)
Definition log.h:276
constexpr enable_if< is_fixed_point< T >::value, T >::type ceil(T x) FL_NOEXCEPT
constexpr enable_if< is_fixed_point< T >::value, T >::type sqrt(T x) FL_NOEXCEPT
static Color3i Black()
Definition color.h:7
float v_
Definition color.h:108
int mIdx
Definition Keyboard.h:40
ColorHSV mCurrColor
Definition Keyboard.h:48

References Color3i::Black(), fl::ceil(), FL_WARN, keyboard, led_rope, Key::mCurrColor, Key::mIdx, fl::sqrt(), ColorHSV::ToRGB(), and ColorHSV::v_.

Referenced by Paint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: