MCPcopy Create free account
hub / github.com/FastLED/FastLED / createWithAutoInput

Method createWithAutoInput

src/fl/audio/audio_processor.cpp.hpp:980–1000  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

978}
979
980shared_ptr<Processor> Processor::createWithAutoInput(
981 shared_ptr<IInput> input) {
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 }
993 vector_inlined<Sample, 16> samples;
994 inp->readAll(&samples);
995 for (const auto& sample : samples) {
996 proc->update(sample);
997 }
998 });
999 return processor;
1000}
1001
1002} // namespace audio
1003} // namespace fl

Callers

nothing calls this directly

Calls 4

every_msFunction · 0.85
readAllMethod · 0.80
lockMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected