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

Method queueBlock

src/platforms/arm/teensy/audio_input_teensy.cpp.hpp:43–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43bool TeensyAudioRecorder::queueBlock(const audio_block_t* block, u8 channel) {
44 if (!block) return false;
45
46 // Limit queue size to prevent unbounded memory growth
47 const fl::size MAX_QUEUE_SIZE = 16; // 16 blocks * 128 samples * 2.9ms = ~46ms buffer
48 if (mBlockQueue.size() >= MAX_QUEUE_SIZE) {
49 mTotalBlocksDropped++;
50 return false;
51 }
52
53 // Copy block data to our queue
54 QueuedBlock qb;
55 qb.channel = channel;
56 qb.timestamp = fl::millis();
57 // Copy samples from audio_block_t (128 samples of int16)
58 for (int i = 0; i < AUDIO_BLOCK_SAMPLES; i++) {
59 qb.samples[i] = block->data[i];
60 }
61
62 mBlockQueue.push_back(qb);
63 return true;
64}
65
66bool TeensyAudioRecorder::dequeueBlock(fl::vector<fl::i16>& samples, u8& channel, u32& timestamp) {
67 if (mBlockQueue.empty()) {

Callers

nothing calls this directly

Calls 3

millisFunction · 0.50
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected