| 64 | } |
| 65 | |
| 66 | bool TeensyAudioRecorder::dequeueBlock(fl::vector<fl::i16>& samples, u8& channel, u32& timestamp) { |
| 67 | if (mBlockQueue.empty()) { |
| 68 | return false; |
| 69 | } |
| 70 | |
| 71 | const QueuedBlock& block = mBlockQueue.front(); |
| 72 | channel = block.channel; |
| 73 | timestamp = block.timestamp; |
| 74 | |
| 75 | // Copy samples |
| 76 | samples.clear(); |
| 77 | samples.reserve(AUDIO_BLOCK_SAMPLES); |
| 78 | for (int i = 0; i < AUDIO_BLOCK_SAMPLES; i++) { |
| 79 | samples.push_back(block.samples[i]); |
| 80 | } |
| 81 | |
| 82 | mBlockQueue.erase(mBlockQueue.begin()); |
| 83 | return true; |
| 84 | } |
| 85 | |
| 86 | // Teensy_I2S_Audio implementation |
| 87 | |