added a CAUDIO_EAX_ENABLED flag to cAudio Defines and enabled EAX
This commit is contained in:
parent
d0ff906bb0
commit
8b1019a98b
|
@ -10,9 +10,10 @@
|
|||
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#include <AL/efx.h>
|
||||
#include <AL/efx-creative.h>
|
||||
#include <AL/xram.h>
|
||||
|
||||
//!#include <AL/alext.h>
|
||||
//!#include <AL/efx.h>
|
||||
#include <iostream>
|
||||
#define LOAD_AL_FUNC(x) (x = (typeof(x))alGetProcAddress(#x))
|
||||
|
||||
|
@ -47,12 +48,26 @@ namespace cAudio
|
|||
ALCdevice *Device;
|
||||
//Create a new device
|
||||
Device = alcOpenDevice(NULL);
|
||||
//Stores the EAX attributes
|
||||
ALint attribs[4] = { 0 };
|
||||
//Check if device can be created
|
||||
if (Device == NULL)
|
||||
exit(-1);
|
||||
|
||||
//Create context
|
||||
//Setup attributes to request 4 slots per a sound source
|
||||
attribs[0] = ALC_MAX_AUXILIARY_SENDS;
|
||||
attribs[1] = 4;
|
||||
|
||||
//Create context with eax effects for windows
|
||||
#ifdef CAUDIO_EAX_ENABLED
|
||||
if(alcIsExtensionPresent(Device, "ALC_EXT_EFX") == AL_FALSE)
|
||||
return;
|
||||
|
||||
Context=alcCreateContext(Device, attribs);
|
||||
#else
|
||||
Context=alcCreateContext(Device, NULL);
|
||||
#endif
|
||||
|
||||
//Set active context
|
||||
alcMakeContextCurrent(Context);
|
||||
// Clear Error Code
|
||||
|
@ -295,6 +310,7 @@ namespace cAudio
|
|||
alcDestroyContext(Context);
|
||||
//Close the device
|
||||
alcCloseDevice(Device);
|
||||
|
||||
Mutex.unlock();
|
||||
RunThread = false;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
//Will also disable internal threading by the library
|
||||
#define CAUDIO_MAKE_THREAD_SAFE
|
||||
|
||||
//Define for compiling with EAX
|
||||
#define CAUDIO_EAX_ENABLED
|
||||
|
||||
#ifdef CAUDIO_MAKE_THREAD_SAFE
|
||||
//Define enables threading for the main update loop. Disable to run the internal update loop yourself
|
||||
//NOTE: Internal threading should NOT be used if the library is not thread safe!
|
||||
|
|
Loading…
Reference in New Issue