FastLED 3.10.6
Loading...
Searching...
No Matches

◆ put()

void fl::audio::anonymous_namespace{audio.cpp.hpp}::AudioSamplePool::put ( SampleImplPtr && impl)
inline

Definition at line 34 of file audio.cpp.hpp.

34 {
35 if (impl.unique()) {
36 // There is no more shared_ptr to this object, so we can recycle it.
37 fl::unique_lock<fl::mutex> lock(mutex);
38 if (impl && pool.size() < MAX_POOL_SIZE) {
39 // Reset the impl for reuse (clear internal state)
40 impl->reset();
41 pool.push_back(impl);
42 return;
43 }
44 }
45 // Pool is full, discard the impl
46 impl.reset();
47 }

References MAX_POOL_SIZE, mutex, and pool.