| 26 | } |
| 27 | |
| 28 | bool Recorder::begin() { |
| 29 | if (_available) return true; |
| 30 | if (!device || !target) return false; |
| 31 | device->setBuffer(PDM_BUFFER, pdm_b_size, pdm_b_count); |
| 32 | _sampleRate = device->setSampleRate(_sampleRate); |
| 33 | _channels = device->setChannels(_channels); |
| 34 | target->setSampleRate(_sampleRate); |
| 35 | target->setChannels(_channels); |
| 36 | target->begin(); |
| 37 | if (!target->available()) return false; |
| 38 | _available = device->begin(); |
| 39 | if(!_available) target->end(); |
| 40 | return _available; |
| 41 | } |
| 42 | |
| 43 | bool Recorder::available() { |
| 44 | return _available; |
nothing calls this directly
no test coverage detected