PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

play_serialflash_raw.h 2.0KB

před 3 roky
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* Audio Library for Teensy 3.X
  2. * Copyright (c) 2014, Paul Stoffregen, paul@pjrc.com
  3. * Modified to use SerialFlash instead of SD library by Wyatt Olson <wyatt@digitalcave.ca>
  4. *
  5. * Development of this audio library was funded by PJRC.COM, LLC by sales of
  6. * Teensy and Audio Adaptor boards. Please support PJRC's efforts to develop
  7. * open source software by purchasing Teensy or other PJRC products.
  8. *
  9. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10. * of this software and associated documentation files (the "Software"), to deal
  11. * in the Software without restriction, including without limitation the rights
  12. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13. * copies of the Software, and to permit persons to whom the Software is
  14. * furnished to do so, subject to the following conditions:
  15. *
  16. * The above copyright notice, development funding notice, and this permission
  17. * notice shall be included in all copies or substantial portions of the Software.
  18. *
  19. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  24. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  25. * THE SOFTWARE.
  26. */
  27. #ifndef play_serial_raw_h_
  28. #define play_serial_raw_h_
  29. #include "Arduino.h"
  30. #include <AudioStream.h>
  31. #include <SerialFlash.h>
  32. class AudioPlaySerialflashRaw : public AudioStream
  33. {
  34. public:
  35. AudioPlaySerialflashRaw(void) : AudioStream(0, NULL) { begin(); }
  36. void begin(void);
  37. bool play(const char *filename);
  38. void stop(void);
  39. bool isPlaying(void) { return playing; }
  40. uint32_t positionMillis(void);
  41. uint32_t lengthMillis(void);
  42. virtual void update(void);
  43. private:
  44. SerialFlashFile rawfile;
  45. uint32_t file_size;
  46. volatile uint32_t file_offset;
  47. volatile bool playing;
  48. };
  49. #endif