| 17 | } |
| 18 | |
| 19 | void FxLayer::draw(fl::u32 now, float speed, const AudioBatch *audio) { |
| 20 | // assert(fx); |
| 21 | if (!frame) { |
| 22 | frame = fl::make_shared<Frame>(fx->getNumLeds()); |
| 23 | } |
| 24 | |
| 25 | if (!running) { |
| 26 | // Clear the frame |
| 27 | fl::memset((u8*)frame->rgb().data(), 0, frame->size() * sizeof(CRGB)); |
| 28 | fx->resume(now); |
| 29 | mLastNow = now; |
| 30 | running = true; |
| 31 | } |
| 32 | u16 frame_time = static_cast<u16>(now - mLastNow); |
| 33 | mLastNow = now; |
| 34 | Fx::DrawContext context(now, frame->rgb(), frame_time, speed, audio); |
| 35 | fx->draw(context); |
| 36 | } |
| 37 | |
| 38 | void FxLayer::pause(fl::u32 now) { |
| 39 | if (fx && running) { |