forked from nmlgc/musicroom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scan.h
70 lines (53 loc) · 1.58 KB
/
scan.h
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Music Room Interface
// --------------------
// scan.h - Track scanning and verification
// --------------------
// "©" Nmlgc, 2010-2011
#ifndef MUSICROOM_SCAN_H
#define MUSICROOM_SCAN_H
struct OggVorbis_File;
// Base class
// ----------
class TrackScanner
{
protected:
TrackScanner() {}
static OggVorbis_File SF;
static FXFile F;
static FXuint OpenFNHash; // Comparison hash of [F] and [SF]
virtual bool Open(GameInfo* GI, TrackInfo* TI); // Makes sure [F] or [SF] contains the file of [TI]
virtual ListEntry<TrackInfo>* Init(GameInfo* GI); // Initializes the scanner and returns the entry of the first track
public:
static bool Close();
};
// ----------
// Seek test
// Verifies the number of BGM tracks
// ---------
class SeekTest : public TrackScanner
{
protected:
SeekTest() {}
bool Track(GameInfo* GI, TrackInfo* TI); // return whether a single track is present
public:
bool Scan(GameInfo* GI);
SINGLETON(SeekTest);
};
// ---------
// Silence scanner
// Finds the amount of leading silence on each track
// ---------------
class SilenceScan : public TrackScanner
{
protected:
SilenceScan() {}
ulong Track_PCM(GameInfo *GI, TrackInfo *TI, ulong* Buf, ulong BufSize);
ulong Track_Vorbis(GameInfo *GI, TrackInfo *TI, ulong* Buf, ulong BufSize);
// Returns the amount of silence samples at the start of [TI]
ulong Track(GameInfo* GI, TrackInfo* TI, ulong* Buf, ulong BufSize);
public:
bool Scan(GameInfo* GI);
SINGLETON(SilenceScan);
};
bool PerformScans(GameInfo* GI);
#endif /* MUSICROOM_SCAN_H */