182 {
185
187
188 auto bands =
fft->db();
189
190 for (
size_t band = 0; band <
NUM_BANDS && band < bands.size(); band++) {
191 float magnitude = bands[band];
192
193
194 magnitude = magnitude / 100.0f;
196
197
200
201
203 magnitude =
fl::clamp(magnitude, 0.0f, 1.0f);
204
205 int barHeight = magnitude *
HEIGHT;
206 int xStart = band * barWidth;
207
208 for (
int x = 0;
x <
fl::max(barWidth, 1);
x++) {
209 for (
int y = 0;
y < barHeight;
y++) {
211 float(
y) /
HEIGHT, 0, 1, 0, 255
212 );
214
215 int ledIndex =
xyMap(xStart +
x,
y);
216 if (ledIndex >= 0 && ledIndex <
NUM_LEDS) {
217 leds[ledIndex] = color;
218 }
219
222 if (mirrorIndex >= 0 && mirrorIndex <
NUM_LEDS) {
223 leds[mirrorIndex] = color;
224 }
225 }
226 }
227 }
228 }
229}
UINumberField palette("Palette", 0, 0, 2)
fl::CRGBPalette16 getCurrentPalette()
static const int NUM_BANDS
float fftSmooth[NUM_BANDS]
fl::UISlider noiseFloor("Noise Floor", 0.1f, 0.0f, 1.0f, 0.01f)
fl::UICheckbox mirrorMode("Mirror Mode", false)
fl::UISlider audioGain("Audio Gain", 1.0f, 0.1f, 5.0f, 0.1f)
CRGB ColorFromPalette(const CRGBPalette16 &pal, fl::u8 index, fl::u8 brightness, TBlendType blendType)
constexpr common_type_t< T, U > max(T a, U b) FL_NOEXCEPT
FASTLED_FORCE_INLINE U map_range(T value, T in_min, T in_max, U out_min, U out_max) FL_NOEXCEPT
constexpr enable_if< is_fixed_point< T >::value, T >::type clamp(T x, T lo, T hi) FL_NOEXCEPT
Representation of an 8-bit RGB pixel (Red, Green, Blue)