- rewrote the ZMusic interface so that it is free of C++ constructs.
Now it is ready to put in a DLL.
This commit is contained in:
parent
0d000344ca
commit
d2ca1ea4e0
19 changed files with 224 additions and 182 deletions
|
|
@ -1,45 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "../libraries/music_common/fileio.h"
|
||||
#include "zmusic/zmusic.h"
|
||||
#include "files.h"
|
||||
|
||||
|
||||
struct FileReaderMusicInterface : public MusicIO::FileInterface
|
||||
{
|
||||
FileReader fr;
|
||||
|
||||
FileReaderMusicInterface(FileReader& fr_in)
|
||||
{
|
||||
fr = std::move(fr_in);
|
||||
}
|
||||
char* gets(char* buff, int n) override
|
||||
{
|
||||
if (!fr.isOpen()) return nullptr;
|
||||
return fr.Gets(buff, n);
|
||||
}
|
||||
long read(void* buff, int32_t size) override
|
||||
{
|
||||
if (!fr.isOpen()) return 0;
|
||||
return (long)fr.Read(buff, size);
|
||||
}
|
||||
long seek(long offset, int whence) override
|
||||
{
|
||||
if (!fr.isOpen()) return 0;
|
||||
return (long)fr.Seek(offset, (FileReader::ESeek)whence);
|
||||
}
|
||||
long tell() override
|
||||
{
|
||||
if (!fr.isOpen()) return 0;
|
||||
return (long)fr.Tell();
|
||||
}
|
||||
FileReader& getReader()
|
||||
{
|
||||
return fr;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
inline ZMusicCustomReader *GetMusicReader(FileReader& fr)
|
||||
{
|
||||
auto zcr = new ZMusicCustomReader;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue