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