-
Notifications
You must be signed in to change notification settings - Fork 3
/
songlist.hpp
44 lines (37 loc) · 1.02 KB
/
songlist.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef SONGLIST_H
#define SONGLIST_H
#include <filesystem>
#include <QFile>
#include <QBuffer>
#include "thdatwrapper.hpp"
namespace fs = std::filesystem;
struct song_t
{
QString filename, title, comment;
unsigned start;
unsigned loopStart;
unsigned length;
unsigned rate;
};
class SongList
{
public:
song_t songs[50];
int songCnt = 0;
QString thbgmFilePath = nullptr;
bool isTrial = false;
SongList();
bool LoadFile(QString filepath, bool ignoreAnUint = false);
bool LoadFile(QBuffer *buf, bool ignoreAnUint = false);
bool LoadFile(thDatWrapper *datw, bool ignoreAnUint = false);
bool LoadFile_th6(thDatWrapper *mdw, const fs::path &bgmdir);
private:
bool fileLoaded = false;
bool ignoreAnUint = false;
bool SongListReadGroup(QBuffer *buf, song_t &song);
uint32_t waveGetDataChunk(const fs::path &path);
uint32_t waveGetSamplingRate(const fs::path &path);
static unsigned BEu32b(QBuffer *buf);
void LoadComment(thDatWrapper *datw);
};
#endif // SONGLIST_H