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

Class UIAudio

src/fl/ui/audio.h:54–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52#endif
53
54class UIAudio : public UIElement {
55 public:
56 FL_NO_COPY(UIAudio)
57 UIAudio(const fl::string& name) FL_NOEXCEPT;
58 UIAudio(const fl::string& name, const fl::url& url) FL_NOEXCEPT;
59 /// Asset-handle overload (issue #2284). Resolves `asset` via
60 /// `fl::resolve_asset()` at construction time: the manifest/registry
61 /// is consulted first, then (on host/stub) the local filesystem and
62 /// sibling `.lnk`. If resolution succeeds, forwards to the url()
63 /// constructor; otherwise behaves like the name-only constructor.
64 UIAudio(const fl::string& name, const fl::asset_ref& asset) FL_NOEXCEPT;
65 UIAudio(const fl::string& name, const fl::audio::Config& config) FL_NOEXCEPT;
66 ~UIAudio() FL_NOEXCEPT;
67 audio::Sample next() FL_NOEXCEPT { return mImpl.next(); }
68 bool hasNext() FL_NOEXCEPT { return mImpl.hasNext(); }
69
70 // Expose underlying audio input for FastLED.add() auto-pump
71 fl::shared_ptr<audio::IInput> audioInput() FL_NOEXCEPT { return mImpl.audioInput(); }
72
73 // Returns the hardware microphone config, if one was provided.
74 const fl::optional<audio::Config>& config() const FL_NOEXCEPT { return mConfig; }
75
76 // Lazily registers with CFastLED::add() on first call and returns the
77 // auto-pumped audio::Processor. Subsequent calls return the cached processor.
78 fl::shared_ptr<audio::Processor> processor() FL_NOEXCEPT;
79
80 // Override setGroup to also update the implementation
81 void setGroup(const fl::string& groupName) FL_NOEXCEPT override {
82 UIElement::setGroup(groupName);
83 // Update the implementation's group if it has the method (WASM platforms)
84 mImpl.setGroup(groupName);
85 }
86
87 protected:
88 UIAudioImpl mImpl;
89 fl::optional<audio::Config> mConfig;
90 fl::shared_ptr<audio::Processor> mProcessor;
91};
92
93} // namespace fl

Callers

nothing calls this directly

Calls 3

nextMethod · 0.45
hasNextMethod · 0.45
setGroupMethod · 0.45

Tested by

no test coverage detected