|
-
-
- #ifndef record_queue_h_
- #define record_queue_h_
-
- #include "Arduino.h"
- #include "AudioStream.h"
-
- class AudioRecordQueue : public AudioStream
- {
- private:
- #if defined(__IMXRT1062__) || defined(__MK66FX1M0__) || defined(__MK64FX512__)
- static const int max_buffers = 209;
- #else
- static const int max_buffers = 53;
- #endif
- public:
- AudioRecordQueue(void) : AudioStream(1, inputQueueArray),
- userblock(NULL), head(0), tail(0), enabled(0) { }
- void begin(void) {
- clear();
- enabled = 1;
- }
- int available(void);
- void clear(void);
- int16_t * readBuffer(void);
- void freeBuffer(void);
- void end(void) {
- enabled = 0;
- }
- virtual void update(void);
- private:
- audio_block_t *inputQueueArray[1];
- audio_block_t * volatile queue[max_buffers];
- audio_block_t *userblock;
- volatile uint8_t head, tail, enabled;
- };
-
- #endif
|