2020-02-09 12:26:51 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <zmusic.h>
|
|
|
|
#include "files.h"
|
|
|
|
|
|
|
|
|
|
|
|
inline ZMusicCustomReader *GetMusicReader(FileReader& fr)
|
|
|
|
{
|
2023-08-23 18:36:19 +00:00
|
|
|
using FileSys::FileReaderInterface;
|
2020-02-09 12:26:51 +00:00
|
|
|
auto zcr = new ZMusicCustomReader;
|
|
|
|
|
|
|
|
zcr->handle = fr.GetInterface();
|
|
|
|
zcr->gets = [](ZMusicCustomReader* zr, char* buff, int n) { return reinterpret_cast<FileReaderInterface*>(zr->handle)->Gets(buff, n); };
|
2023-09-23 07:56:27 +00:00
|
|
|
zcr->read = [](ZMusicCustomReader* zr, void* buff, int32_t size) -> long { return (long)reinterpret_cast<FileReaderInterface*>(zr->handle)->Read(buff, size); };
|
|
|
|
zcr->seek = [](ZMusicCustomReader* zr, long offset, int whence) -> long { return (long)reinterpret_cast<FileReaderInterface*>(zr->handle)->Seek(offset, whence); };
|
|
|
|
zcr->tell = [](ZMusicCustomReader* zr) -> long { return (long)reinterpret_cast<FileReaderInterface*>(zr->handle)->Tell(); };
|
2020-02-09 12:26:51 +00:00
|
|
|
zcr->close = [](ZMusicCustomReader* zr)
|
|
|
|
{
|
|
|
|
delete reinterpret_cast<FileReaderInterface*>(zr->handle);
|
|
|
|
delete zr;
|
|
|
|
};
|
|
|
|
return zcr;
|
2021-12-12 17:07:19 +00:00
|
|
|
}
|
|
|
|
|