| 145 | } |
| 146 | |
| 147 | void Teensy_I2S_Audio::start() { |
| 148 | if (mHasError) { |
| 149 | FL_WARN("Cannot start Teensy I2S audio - initialization error occurred"); |
| 150 | return; |
| 151 | } |
| 152 | |
| 153 | if (mInitialized) { |
| 154 | FL_WARN("Teensy I2S audio is already initialized"); |
| 155 | return; |
| 156 | } |
| 157 | |
| 158 | mInitialized = true; |
| 159 | mTotalSamplesRead = 0; |
| 160 | mBlocksAccumulated = 0; |
| 161 | mAccumulatedSamples.clear(); |
| 162 | |
| 163 | // Reset recorder queue |
| 164 | if (mRecorder) { |
| 165 | mRecorder->reset(); |
| 166 | } |
| 167 | |
| 168 | FL_WARN("Teensy I2S audio input started (512-sample mono buffering)"); |
| 169 | |
| 170 | #if defined(FL_IS_TEENSY_3X) |
| 171 | FL_WARN(" Teensy 3.x I2S1 pins: BCLK=9, MCLK=11, RX=13, LRCLK=23"); |
| 172 | #elif defined(FL_IS_TEENSY_4X) |
| 173 | if (static_cast<audio::TeensyI2S::I2SPort>(mConfig.mI2sNum) == audio::TeensyI2S::I2SPort::I2S1) { |
| 174 | FL_WARN(" Teensy 4.x I2S1 pins: BCLK=21, MCLK=23, RX=8, LRCLK=20"); |
| 175 | } else { |
| 176 | FL_WARN(" Teensy 4.x I2S2 pins: BCLK=4, MCLK=33, RX=5, LRCLK=3"); |
| 177 | } |
| 178 | #endif |
| 179 | |
| 180 | // Log channel selection |
| 181 | FL_WARN(" Channel: " << ((mConfig.mAudioChannel == audio::AudioChannel::Left) ? "Left" : |
| 182 | (mConfig.mAudioChannel == audio::AudioChannel::Right) ? "Right" : "Both (downmixed)")); |
| 183 | } |
| 184 | |
| 185 | void Teensy_I2S_Audio::stop() { |
| 186 | if (!mInitialized) { |