|
-
-
- #ifndef play_sd_wav_h_
- #define play_sd_wav_h_
-
- #include "AudioStream.h"
- #include "SD.h"
-
- class AudioPlaySdWav : public AudioStream
- {
- public:
- AudioPlaySdWav(void) : AudioStream(0, NULL) { begin(); }
- void begin(void);
- bool play(const char *filename);
- void stop(void);
- bool isPlaying(void);
- uint32_t positionMillis(void);
- uint32_t lengthMillis(void);
- virtual void update(void);
- private:
- File wavfile;
- bool consume(uint32_t size);
- bool parse_format(void);
- uint32_t header[6];
- uint32_t data_length;
- uint32_t total_length;
- uint32_t bytes2millis;
- audio_block_t *block_left;
- audio_block_t *block_right;
- uint16_t block_offset;
- uint8_t buffer[512];
- uint16_t buffer_offset;
- uint16_t buffer_length;
- uint8_t header_offset;
- uint8_t state;
- uint8_t state_play;
- uint8_t leftover_bytes;
- };
-
- #endif
|