|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
-
-
- #ifndef play_queue_h_
- #define play_queue_h_
-
- #include "Arduino.h"
- #include "AudioStream.h"
-
- class AudioPlayQueue : public AudioStream
- {
- private:
- #if defined(__IMXRT1062__) || defined(__MK66FX1M0__) || defined(__MK64FX512__)
- static const int max_buffers = 80;
- #else
- static const int max_buffers = 32;
- #endif
- public:
- AudioPlayQueue(void) : AudioStream(0, NULL),
- userblock(NULL), head(0), tail(0) { }
- void play(int16_t data);
- void play(const int16_t *data, uint32_t len);
- bool available(void);
- int16_t * getBuffer(void);
- void playBuffer(void);
- void stop(void);
-
- virtual void update(void);
- private:
- audio_block_t *queue[max_buffers];
- audio_block_t *userblock;
- volatile uint8_t head, tail;
- };
-
- #endif
|