-
Notifications
You must be signed in to change notification settings - Fork 2
/
Device.cpp
46 lines (37 loc) · 888 Bytes
/
Device.cpp
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
#include "Common.h"
/* Actions */
void Extension::DeviceOpen(const char* Name)
{
//Can't open more than one device at once.
if(Device || Context)
return;
//Attributes for the context: Use 4 auxiliary sends.
const ALint Attributes[4] = {ALC_MAX_AUXILIARY_SENDS, 4, 0, 0};
//Open a device and create a contex for it
if(Device = alcOpenDevice(Name))
{
Context = alcCreateContext(Device, Attributes);
alcMakeContextCurrent(Context);
}
}
void Extension::DeviceClose()
{
if(Device && Context)
{
alcDestroyContext(Context);
alcCloseDevice(Device);
Device = 0;
Context = 0;
}
}
void Extension::DeviceEnumerate()
{
for(EnumeratedDevice = DeviceList; *EnumeratedDevice; EnumeratedDevice += strlen(EnumeratedDevice))
Runtime.GenerateEvent(5);
EnumeratedDevice = "";
}
/* Expressions */
char* Extension::DeviceGetEnumerated()
{
return (char*)EnumeratedDevice;
}