| 113 | } |
| 114 | |
| 115 | void setup() { |
| 116 | Serial.begin(115200); |
| 117 | // auto screenmap = frameBufferXY.toScreenMap(); |
| 118 | // screenmap.setDiameter(.2); |
| 119 | // FastLED.addLeds<NEOPIXEL, 2>(framebuffer, |
| 120 | // NUM_LEDS).setScreenMap(screenmap); |
| 121 | auto screenmap = ledsXY.toScreenMap(); |
| 122 | screenmap.setDiameter(.2); |
| 123 | |
| 124 | decayTimeSeconds.onChanged([](float value) { |
| 125 | audioFadeTracker.setDecayTime(value); |
| 126 | FL_WARN("Fade time seconds: " << value); |
| 127 | }); |
| 128 | attackTimeSeconds.onChanged([](float value) { |
| 129 | audioFadeTracker.setAttackTime(value); |
| 130 | FL_WARN("Attack time seconds: " << value); |
| 131 | }); |
| 132 | outputTimeSec.onChanged([](float value) { |
| 133 | audioFadeTracker.setOutputTime(value); |
| 134 | FL_WARN("Output time seconds: " << value); |
| 135 | }); |
| 136 | |
| 137 | // Initialize pitch detection |
| 138 | pitchConfig.sample_rate_hz = 44100.0f; |
| 139 | pitchEngine = new fl::SoundToMIDIEngine(pitchConfig); // ok bare allocation |
| 140 | pitchEngine->onNoteOn = [](uint8_t note, uint8_t velocity) { |
| 141 | currentMIDINote = note; |
| 142 | noteIsOn = true; |
| 143 | Serial.print("Note ON: "); |
| 144 | Serial.print(note); |
| 145 | Serial.print(" vel: "); |
| 146 | Serial.println(velocity); |
| 147 | }; |
| 148 | pitchEngine->onNoteOff = [](uint8_t note) { |
| 149 | noteIsOn = false; |
| 150 | Serial.print("Note OFF: "); |
| 151 | Serial.println(note); |
| 152 | }; |
| 153 | |
| 154 | FastLED.addLeds<NEOPIXEL, PIN_DATA>(leds, ledsXY.getTotal()) |
| 155 | .setScreenMap(screenmap); |
| 156 | } |
| 157 | |
| 158 | void shiftUp() { |
| 159 | // fade each led by 1% |
nothing calls this directly
no test coverage detected