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

◆ createWithAutoInput()

shared_ptr< Processor > fl::audio::Processor::createWithAutoInput ( fl::shared_ptr< IInput > input)
staticprivate

Definition at line 980 of file audio_processor.cpp.hpp.

981 {
982 auto processor = make_shared<Processor>();
983 processor->mAudioInput = input;
984 // weak_ptr so the lambda doesn't prevent Processor destruction
985 weak_ptr<Processor> weak = processor;
986 weak_ptr<IInput> weakInput = input;
987 processor->mAutoTask = fl::task::every_ms(1).then([weak, weakInput]() {
988 auto proc = weak.lock();
989 auto inp = weakInput.lock();
990 if (!proc || !inp) {
991 return;
992 }
994 inp->readAll(&samples);
995 for (const auto& sample : samples) {
996 proc->update(sample);
997 }
998 });
999 return processor;
1000}
Handle & then(function< void()> on_then) FL_NOEXCEPT
Definition task.cpp.hpp:276
Handle every_ms(int interval_ms)
Definition task.cpp.hpp:320
CRGB sample(const CRGB *grid, const XYMap &xyMap, float x, float y, SampleMode mode)
Sample a pixel from a 2D CRGB grid at floating-point coordinates.
Definition sample.cpp.hpp:9
shared_ptr< T > make_shared(Args &&... args) FL_NOEXCEPT
Definition shared_ptr.h:414
VectorN< T, INLINED_SIZE > vector_inlined
Definition vector.h:1133

References createWithAutoInput(), fl::task::every_ms(), fl::weak_ptr< T >::lock(), fl::make_shared(), fl::sample(), and fl::task::Handle::then().

Referenced by fl::audio::AudioManager::add(), fl::audio::AudioManager::add(), and createWithAutoInput().

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