-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy patha_wav.h
40 lines (32 loc) · 792 Bytes
/
a_wav.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
#ifndef A_WAV_HDR
#define A_WAV_HDR
#include "a_system.h"
#include "u_file.h"
namespace a {
struct WAVFile;
struct WAVFileInstance final : SourceInstance {
WAVFileInstance(WAVFile *parent);
virtual void getAudio(float *buffer, size_t samples) final;
virtual bool rewind() final;
virtual bool hasEnded() const final;
virtual ~WAVFileInstance() final;
private:
WAVFile *m_parent;
u::file m_file;
size_t m_offset;
};
struct WAVFile final : Source {
WAVFile();
virtual ~WAVFile() final;
bool load(const char *fileName);
virtual SourceInstance *create() final;
private:
friend struct WAVFileInstance;
bool load(u::file &fp);
u::string m_fileName;
size_t m_dataOffset;
size_t m_bits;
size_t m_sampleCount;
};
}
#endif