#ifndef TEENSY_RESAMPLING_INDEXABLESD_FILE_H #define TEENSY_RESAMPLING_INDEXABLESD_FILE_H #include #include "IndexableFile.h" #include #include namespace newdigate { template // BUFFER_SIZE needs to be a power of two class IndexableSDFile : public IndexableFile { public: static_assert(isPowerOf2(BUFFER_SIZE), "BUFFER_SIZE must be a power of 2"); IndexableSDFile(const char *filename) : IndexableFile(filename) { IndexableFile::_file = open(filename); } File open(const char *filename) override { return SD.open(filename); } virtual ~IndexableSDFile() { IndexableFile::close(); } int16_t &operator[](int i) { return IndexableFile::operator[](i); } }; } #endif