-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSoundSource.h
111 lines (105 loc) · 2.5 KB
/
SoundSource.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#ifndef SOUND_SOURCE_HEADER
#define SOUND_SOURCE_HEADER
#include <array>
#ifdef OPENAL
#include <AL/al.h>
#endif
class SoundSource {
public:
#ifdef OPENAL
ALuint ID;
ALsizei buffersSize;
ALuint* buffers;
ALfloat pitch = 1.0f;
ALfloat gain = 1.0f;
std::array<ALfloat, 3> position = { 0, 0, 0 };
std::array<ALfloat, 3> velocity = { 0, 0, 0 };
ALboolean loop = false;
#endif
SoundSource();
SoundSource(
ALsizei buffersSize,
ALuint* buffers,
ALfloat pitch,
ALfloat gain,
std::array<ALfloat, 3> position,
std::array<ALfloat, 3> velocity,
ALboolean loop
);
SoundSource(
ALfloat pitch,
ALfloat gain,
std::array<ALfloat, 3> position,
std::array<ALfloat, 3> velocity,
ALboolean loop
);
~SoundSource();
void Init();
static void Init(ALuint* ID);
void Init(
ALsizei buffersSize,
ALuint* buffers,
ALfloat pitch,
ALfloat gain,
std::array<ALfloat, 3> position,
std::array<ALfloat, 3> velocity,
ALboolean loop
);
static void Init(
ALuint* ID,
ALsizei buffersSize,
ALuint* buffers,
ALfloat pitch,
ALfloat gain,
std::array<ALfloat, 3> position,
std::array<ALfloat, 3> velocity,
ALboolean loop,
ALsizei* buffersSizeVar,
ALuint** buffersVar,
ALfloat* pitchVar,
ALfloat* gainVar,
std::array<ALfloat, 3>* positionVar,
std::array<ALfloat, 3>* velocityVar,
ALboolean* loopVar
);
void UpdateSource();
static void UpdateSource(
ALuint ID,
ALsizei buffersSize,
ALuint* buffers,
ALfloat pitch,
ALfloat gain,
std::array<ALfloat, 3> position,
std::array<ALfloat, 3> velocity,
ALboolean loop
);
void UpdatePitch();
static void UpdatePitch(ALuint ID, ALfloat pitch);
void UpdateGain();
static void UpdateGain(ALuint ID, ALfloat gain);
void UpdatePosition();
static void UpdatePosition(ALuint ID, std::array<ALfloat, 3> velocity);
void UpdateVelocity();
static void UpdateVelocity(ALuint ID, std::array<ALfloat, 3> velocity);
void UpdateLoop();
static void UpdateLoop(ALuint ID, ALboolean loop);
void QueueBuffers();
static void QueueBuffers(ALuint ID, ALsizei buffersSize, ALuint* buffers);
#ifdef OPENAL
void UnqueueBuffers(ALsizei buffersSize, ALuint* buffers);
static void UnqueueBuffers(ALuint ID, ALsizei buffersSize, ALuint* buffers);
ALint GetState(ALenum toGet);
static ALint GetState(ALuint ID, ALenum toGet);
#endif
void Play();
void Play(ALuint ID);
void Stop();
static void Stop(ALuint ID);
void Pause();
static void Pause(ALuint ID);
void Rewind();
static void Rewind(ALuint ID);
void Delete();
static void Delete(ALuint* ID);
};
#endif