| 16 | } |
| 17 | |
| 18 | shared_ptr<Processor> AudioManager::add(const Config &config) { |
| 19 | #if FASTLED_HAS_AUDIO_INPUT |
| 20 | fl::string errorMsg; |
| 21 | auto input = IInput::create(config, &errorMsg); |
| 22 | if (!input) { |
| 23 | FL_WARN("Failed to create audio input: " << errorMsg); |
| 24 | return nullptr; |
| 25 | } |
| 26 | input->start(); |
| 27 | auto proc = Processor::createWithAutoInput(fl::move(input)); |
| 28 | if (config.getMicProfile() != MicProfile::None) { |
| 29 | proc->setMicProfile(config.getMicProfile()); |
| 30 | } |
| 31 | if (processor()) { |
| 32 | FL_WARN("Replacing existing audio processor"); |
| 33 | } |
| 34 | processor() = proc; |
| 35 | return proc; |
| 36 | #else |
| 37 | (void)config; |
| 38 | auto proc = fl::make_shared<Processor>(); |
| 39 | if (processor()) { |
| 40 | FL_WARN("Replacing existing audio processor"); |
| 41 | } |
| 42 | processor() = proc; |
| 43 | return proc; |
| 44 | #endif |
| 45 | } |
| 46 | |
| 47 | shared_ptr<Processor> AudioManager::add(shared_ptr<IInput> input) { |
| 48 | if (!input) { |
no test coverage detected