-
Notifications
You must be signed in to change notification settings - Fork 0
/
SoundBuffer.h
47 lines (39 loc) · 883 Bytes
/
SoundBuffer.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
#ifndef SOUND_BUFFER_HEADER
#define SOUND_BUFFER_HEADER
#ifdef OPENAL
#include <AL/alext.h>
#endif
#include <iostream>
#include <climits>
#include <sndfile.h>
#include <inttypes.h>
#include <array>
#include <vector>
struct SoundData {
ALenum format;
short* data;
ALsizei size;
ALsizei freq;
SoundData(ALenum format = (ALenum)NULL, short* data = nullptr, ALsizei size = 0, ALsizei freq = 0) {
this->format = format;
this->data = data;
this->size = size;
this->freq = freq;
}
};
class SoundBuffer {
public:
#ifdef OPENAL
ALuint ID;
#endif
SoundBuffer(SoundData data);
~SoundBuffer();
void Init(SoundData data);
static void Init(ALuint* ID, SoundData data);
void StoreBuffer(SoundData data);
static void StoreBuffer(ALuint* ID, SoundData data);
static SoundData GetOggData(const char* filename);
void Delete();
static void Delete(ALuint* ID);
};
#endif