-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAudio3DContext.h
47 lines (33 loc) · 991 Bytes
/
Audio3DContext.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 __CELESTIA__AUDIO_3D__CONTEXT__H__
#define __CELESTIA__AUDIO_3D__CONTEXT__H__
#include <AL/al.h>
#include <AL/alc.h>
#include "Audio3DDevice.h"
namespace Audio3D
{
class Context
{
ALCcontext *_cnt;
public:
struct Properties
{
ALCint freq;
ALCint monoCount;
ALCint refresh;
ALCint stereoCount;
ALCboolean sync;
};
Context(ALCcontext *c) : _cnt(c) {}
Context(Device *d)
{
_cnt = alcCreateContext(d->internalPtr(), NULL);
}
~Context() { alcDestroyContext(_cnt); }
static ALCcontext *newContext(ALCdevice *d = NULL) { return alcCreateContext(d, NULL); }
bool makeCurrent() { return alcMakeContextCurrent(_cnt); }
void process() { alcProcessContext(_cnt); }
void suspend() { alcSuspendContext(_cnt); }
ALCdevice *device() { return alcGetContextsDevice(_cnt); }
};
}
#endif