diff --git a/sampler/lib/Audio_SdFat/play_sd_wav.h b/sampler/lib/Audio_SdFat/play_sd_wav.h index f852d69..2136fae 100644 --- a/sampler/lib/Audio_SdFat/play_sd_wav.h +++ b/sampler/lib/Audio_SdFat/play_sd_wav.h @@ -34,32 +34,32 @@ class AudioPlaySdWav : public AudioStream { public: - AudioPlaySdWav(void) : AudioStream(0, NULL), block_left(NULL), block_right(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); + AudioPlaySdWav(void) : AudioStream(0, NULL), block_left(NULL), block_right(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[10]; // temporary storage of wav header data - uint32_t data_length; // number of bytes remaining in current section - uint32_t total_length; // number of audio data bytes in file - uint32_t bytes2millis; - audio_block_t *block_left; - audio_block_t *block_right; - uint16_t block_offset; // how much data is in block_left & block_right - uint8_t buffer[512]; // buffer one block of data - uint16_t buffer_offset; // where we're at consuming "buffer" - uint16_t buffer_length; // how much data is in "buffer" (512 until last read) - uint8_t header_offset; // number of bytes in header[] - uint8_t state; - uint8_t state_play; - uint8_t leftover_bytes; + File wavfile; + bool consume(uint32_t size); + bool parse_format(void); + uint32_t header[10]; // temporary storage of wav header data + uint32_t data_length; // number of bytes remaining in current section + uint32_t total_length; // number of audio data bytes in file + uint32_t bytes2millis; + audio_block_t *block_left; + audio_block_t *block_right; + uint16_t block_offset; // how much data is in block_left & block_right + uint8_t buffer[512]; // buffer one block of data + uint16_t buffer_offset; // where we're at consuming "buffer" + uint16_t buffer_length; // how much data is in "buffer" (512 until last read) + uint8_t header_offset; // number of bytes in header[] + uint8_t state; + uint8_t state_play; + uint8_t leftover_bytes; }; #endif diff --git a/sampler/platformio.ini b/sampler/platformio.ini index cd30915..3e51ed2 100644 --- a/sampler/platformio.ini +++ b/sampler/platformio.ini @@ -16,6 +16,7 @@ lib_ignore = Audio, SD lib_deps = 721 ; TaskScheduler 322 ; SdFat + 401 ; Adafruit SleepyDog Library [env:teensy35] platform = teensy diff --git a/sampler/src/main.cpp b/sampler/src/main.cpp index e3138f6..8894c90 100644 --- a/sampler/src/main.cpp +++ b/sampler/src/main.cpp @@ -33,6 +33,9 @@ // #define ANALOG_REF_EXTERNAL_3P3V //-------------------- +//watchdog +#include + //teensy audio #include #include @@ -121,7 +124,7 @@ public: // the filename to play is... Serial.println(filename); // go! (re-triggering) - if (player.isPlaying()) player.stop(); + // if (player.isPlaying()) player.stop(); player.play(filename); Serial.println("1"); // --> we just believe that this 'file' is existing & available. NO additional checking. @@ -303,6 +306,9 @@ void playcheck() { // // // Serial.print("AM_max:"); // Serial.println(AudioMemoryUsageMax()); + + //watchdog + Watchdog.reset(); } // Task playcheck_task(100, TASK_FOREVER, playcheck, &runner, true); @@ -462,6 +468,9 @@ void setup() { // Serial.println("[setup] done."); + + //watchdog + Watchdog.enable(1000); } void loop() {