4 #define AL_MAX_CHANNELS 4
5 #define AL_MAX_SOURCES 32
13 //#define strcasecmp _stricmp
20 #define IsBadWritePtr(a,b) (0)
22 typedef pthread_mutex_t CRITICAL_SECTION
;
23 static inline void EnterCriticalSection(CRITICAL_SECTION
*cs
)
25 assert(pthread_mutex_lock(cs
) == 0);
27 static inline void LeaveCriticalSection(CRITICAL_SECTION
*cs
)
29 assert(pthread_mutex_unlock(cs
) == 0);
31 static inline void InitializeCriticalSection(CRITICAL_SECTION
*cs
)
33 pthread_mutexattr_t attrib
;
35 assert(pthread_mutexattr_init(&attrib
) == 0);
37 assert(pthread_mutexattr_settype(&attrib
, PTHREAD_MUTEX_RECURSIVE
) == 0);
38 assert(pthread_mutex_init(cs
, &attrib
) == 0);
40 pthread_mutexattr_destroy(&attrib
);
43 static inline void DeleteCriticalSection(CRITICAL_SECTION
*cs
)
45 assert(pthread_mutex_destroy(cs
) == 0);
48 #define min(x,y) (((x)<(y))?(x):(y))
49 #define max(x,y) (((x)>(y))?(x):(y))
54 #include "alExtension.h"
55 #include "alListener.h"
65 #define AL_FORMAT_MONO_IMA4 0x1300
66 #define AL_FORMAT_STEREO_IMA4 0x1301
67 // These are from AL_EXT_MCFORMATS, which we don't support yet but the mixer
68 // can use 4-channel formats
69 #define AL_FORMAT_QUAD8 0x1204
70 #define AL_FORMAT_QUAD16 0x1205
72 #define SWMIXER_OUTPUT_RATE 44100
73 //#define OUTPUT_BUFFER_SIZE (32768*SWMIXER_OUTPUT_RATE/22050)
75 #define SPEEDOFSOUNDMETRESPERSEC (343.3f)
78 ALCboolean (*OpenPlayback
)(ALCdevice
*, const ALCchar
*);
79 void (*ClosePlayback
)(ALCdevice
*);
81 ALCboolean (*OpenCapture
)(ALCdevice
*, const ALCchar
*, ALCuint
, ALCenum
, ALCsizei
);
82 void (*CloseCapture
)(ALCdevice
*);
83 void (*StartCapture
)(ALCdevice
*);
84 void (*StopCapture
)(ALCdevice
*);
85 void (*CaptureSamples
)(ALCdevice
*, void*, ALCuint
);
86 ALCuint (*AvailableSamples
)(ALCdevice
*);
89 struct ALCdevice_struct
92 ALboolean IsCaptureDevice
;
100 ALCchar szDeviceName
[256];
102 // Maximum number of sources that can be created
103 ALuint MaxNoOfSources
;
105 // Context created on this device
109 void *ExtraData
; // For the backend's use
112 #define ALCdevice_OpenPlayback(a,b) ((a)->Funcs->OpenPlayback((a), (b)))
113 #define ALCdevice_ClosePlayback(a) ((a)->Funcs->ClosePlayback((a)))
114 #define ALCdevice_OpenCapture(a,b,c,d,e) ((a)->Funcs->OpenCapture((a), (b), (c), (d), (e)))
115 #define ALCdevice_CloseCapture(a) ((a)->Funcs->CloseCapture((a)))
116 #define ALCdevice_StartCapture(a) ((a)->Funcs->StartCapture((a)))
117 #define ALCdevice_StopCapture(a) ((a)->Funcs->StopCapture((a)))
118 #define ALCdevice_CaptureSamples(a,b,c) ((a)->Funcs->CaptureSamples((a), (b), (c)))
119 #define ALCdevice_AvailableSamples(a) ((a)->Funcs->AvailableSamples((a)))
121 struct ALCcontext_struct
133 ALenum DistanceModel
;
135 ALfloat DopplerFactor
;
136 ALfloat DopplerVelocity
;
137 ALfloat flSpeedOfSound
;
139 ALint lNumMonoSources
;
140 ALint lNumStereoSources
;
143 ALCchar ExtensionList
[1024];
148 ALCchar
*AppendDeviceList(char *name
);
149 ALCchar
*AppendAllDeviceList(char *name
);
150 ALCchar
*AppendCaptureDeviceList(char *name
);
152 ALCvoid
SetALCError(ALenum errorCode
);
154 ALCvoid
SuspendContext(ALCcontext
*context
);
155 ALCvoid
ProcessContext(ALCcontext
*context
);
157 ALvoid
*StartThread(ALuint (*func
)(ALvoid
*), ALvoid
*ptr
);
158 ALuint
StopThread(ALvoid
*thread
);
160 void ReadALConfig(void);
161 void FreeALConfig(void);
162 const char *GetConfigValue(const char *blockName
, const char *keyName
, const char *def
);
163 int GetConfigValueInt(const char *blockName
, const char *keyName
, int def
);
164 float GetConfigValueFloat(const char *blockName
, const char *keyName
, float def
);