Avoid unnecessarily using type aliases
[openal-soft.git] / OpenAL32 / Include / alMain.h
blob7e954f0d3ee8f355e7a003a6f343c9929ae3e453
1 #ifndef AL_MAIN_H
2 #define AL_MAIN_H
4 #include <string.h>
5 #include <stdio.h>
6 #include <stddef.h>
7 #include <stdarg.h>
8 #include <assert.h>
9 #include <math.h>
10 #include <limits.h>
12 #ifdef HAVE_STRINGS_H
13 #include <strings.h>
14 #endif
16 #include "AL/al.h"
17 #include "AL/alc.h"
18 #include "AL/alext.h"
20 #include "logging.h"
21 #include "polymorphism.h"
22 #include "static_assert.h"
23 #include "align.h"
24 #include "atomic.h"
25 #include "uintmap.h"
26 #include "vector.h"
27 #include "alstring.h"
28 #include "almalloc.h"
29 #include "threads.h"
31 #ifndef ALC_SOFT_loopback2
32 #define ALC_SOFT_loopback2 1
33 #define ALC_AMBISONIC_LAYOUT_SOFT 0xfff0
34 #define ALC_AMBISONIC_SCALING_SOFT 0xfff1
35 #define ALC_AMBISONIC_ORDER_SOFT 0xfff2
36 #define ALC_MAX_AMBISONIC_ORDER_SOFT 0xfff3
38 #define ALC_BFORMAT3D_SOFT 0x1508
40 /* Ambisonic layouts */
41 #define ALC_ACN_SOFT 0xfff4
42 #define ALC_FUMA_SOFT 0xfff5
44 /* Ambisonic scalings (normalization) */
45 /*#define ALC_FUMA_SOFT*/
46 #define ALC_SN3D_SOFT 0xfff6
47 #define ALC_N3D_SOFT 0xfff7
48 #endif
50 #ifndef ALC_SOFT_device_clock
51 #define ALC_SOFT_device_clock 1
52 typedef int64_t ALCint64SOFT;
53 typedef uint64_t ALCuint64SOFT;
54 #define ALC_DEVICE_CLOCK_SOFT 0x1600
55 #define ALC_DEVICE_LATENCY_SOFT 0x1601
56 #define ALC_DEVICE_CLOCK_LATENCY_SOFT 0x1602
57 #define AL_SAMPLE_OFFSET_CLOCK_SOFT 0x1202
58 #define AL_SEC_OFFSET_CLOCK_SOFT 0x1203
59 typedef void (ALC_APIENTRY*LPALCGETINTEGER64VSOFT)(ALCdevice *device, ALCenum pname, ALsizei size, ALCint64SOFT *values);
60 #ifdef AL_ALEXT_PROTOTYPES
61 ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, ALsizei size, ALCint64SOFT *values);
62 #endif
63 #endif
65 #ifndef AL_SOFT_buffer_samples2
66 #define AL_SOFT_buffer_samples2 1
67 /* Channel configurations */
68 #define AL_MONO_SOFT 0x1500
69 #define AL_STEREO_SOFT 0x1501
70 #define AL_REAR_SOFT 0x1502
71 #define AL_QUAD_SOFT 0x1503
72 #define AL_5POINT1_SOFT 0x1504
73 #define AL_6POINT1_SOFT 0x1505
74 #define AL_7POINT1_SOFT 0x1506
75 #define AL_BFORMAT2D_SOFT 0x1507
76 #define AL_BFORMAT3D_SOFT 0x1508
78 /* Sample types */
79 #define AL_BYTE_SOFT 0x1400
80 #define AL_UNSIGNED_BYTE_SOFT 0x1401
81 #define AL_SHORT_SOFT 0x1402
82 #define AL_UNSIGNED_SHORT_SOFT 0x1403
83 #define AL_INT_SOFT 0x1404
84 #define AL_UNSIGNED_INT_SOFT 0x1405
85 #define AL_FLOAT_SOFT 0x1406
86 #define AL_DOUBLE_SOFT 0x1407
87 #define AL_BYTE3_SOFT 0x1408
88 #define AL_UNSIGNED_BYTE3_SOFT 0x1409
89 #define AL_MULAW_SOFT 0x140A
91 /* Storage formats */
92 #define AL_MONO8_SOFT 0x1100
93 #define AL_MONO16_SOFT 0x1101
94 #define AL_MONO32F_SOFT 0x10010
95 #define AL_STEREO8_SOFT 0x1102
96 #define AL_STEREO16_SOFT 0x1103
97 #define AL_STEREO32F_SOFT 0x10011
98 #define AL_QUAD8_SOFT 0x1204
99 #define AL_QUAD16_SOFT 0x1205
100 #define AL_QUAD32F_SOFT 0x1206
101 #define AL_REAR8_SOFT 0x1207
102 #define AL_REAR16_SOFT 0x1208
103 #define AL_REAR32F_SOFT 0x1209
104 #define AL_5POINT1_8_SOFT 0x120A
105 #define AL_5POINT1_16_SOFT 0x120B
106 #define AL_5POINT1_32F_SOFT 0x120C
107 #define AL_6POINT1_8_SOFT 0x120D
108 #define AL_6POINT1_16_SOFT 0x120E
109 #define AL_6POINT1_32F_SOFT 0x120F
110 #define AL_7POINT1_8_SOFT 0x1210
111 #define AL_7POINT1_16_SOFT 0x1211
112 #define AL_7POINT1_32F_SOFT 0x1212
113 #define AL_BFORMAT2D_8_SOFT 0x20021
114 #define AL_BFORMAT2D_16_SOFT 0x20022
115 #define AL_BFORMAT2D_32F_SOFT 0x20023
116 #define AL_BFORMAT3D_8_SOFT 0x20031
117 #define AL_BFORMAT3D_16_SOFT 0x20032
118 #define AL_BFORMAT3D_32F_SOFT 0x20033
120 /* Buffer attributes */
121 #define AL_INTERNAL_FORMAT_SOFT 0x2008
122 #define AL_BYTE_LENGTH_SOFT 0x2009
123 #define AL_SAMPLE_LENGTH_SOFT 0x200A
124 #define AL_SEC_LENGTH_SOFT 0x200B
126 #if 0
127 typedef void (AL_APIENTRY*LPALBUFFERSAMPLESSOFT)(ALuint,ALuint,ALenum,ALsizei,ALenum,ALenum,const ALvoid*);
128 typedef void (AL_APIENTRY*LPALGETBUFFERSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,ALvoid*);
129 typedef ALboolean (AL_APIENTRY*LPALISBUFFERFORMATSUPPORTEDSOFT)(ALenum);
130 #ifdef AL_ALEXT_PROTOTYPES
131 AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer, ALuint samplerate, ALenum internalformat, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data);
132 AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint buffer, ALsizei offset, ALsizei samples, ALenum channels, ALenum type, ALvoid *data);
133 AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format);
134 #endif
135 #endif
136 #endif
139 #if defined(_WIN64)
140 #define SZFMT "%I64u"
141 #elif defined(_WIN32)
142 #define SZFMT "%u"
143 #else
144 #define SZFMT "%zu"
145 #endif
148 #ifdef __GNUC__
149 #define LIKELY(x) __builtin_expect(!!(x), !0)
150 #define UNLIKELY(x) __builtin_expect(!!(x), 0)
151 #else
152 #define LIKELY(x) (!!(x))
153 #define UNLIKELY(x) (!!(x))
154 #endif
156 typedef ALint64SOFT ALint64;
157 typedef ALuint64SOFT ALuint64;
159 #ifndef U64
160 #if defined(_MSC_VER)
161 #define U64(x) ((ALuint64)(x##ui64))
162 #elif SIZEOF_LONG == 8
163 #define U64(x) ((ALuint64)(x##ul))
164 #elif SIZEOF_LONG_LONG == 8
165 #define U64(x) ((ALuint64)(x##ull))
166 #endif
167 #endif
169 #ifndef UINT64_MAX
170 #define UINT64_MAX U64(18446744073709551615)
171 #endif
173 #ifndef UNUSED
174 #if defined(__cplusplus)
175 #define UNUSED(x)
176 #elif defined(__GNUC__)
177 #define UNUSED(x) UNUSED_##x __attribute__((unused))
178 #elif defined(__LCLINT__)
179 #define UNUSED(x) /*@unused@*/ x
180 #else
181 #define UNUSED(x) x
182 #endif
183 #endif
185 /* Calculates the size of a struct with N elements of a flexible array member.
186 * GCC and Clang allow offsetof(Type, fam[N]) for this, but MSVC seems to have
187 * trouble, so a bit more verbose workaround is needed.
189 #define FAM_SIZE(T, M, N) (offsetof(T, M) + sizeof(((T*)NULL)->M[0])*(N))
191 #ifdef HAVE_C99_VLA
192 #define DECL_VLA(T, _name, _size) T _name[(_size)]
193 #else
194 #define DECL_VLA(T, _name, _size) T *_name = alloca((_size) * sizeof(T))
195 #endif
198 static const union {
199 ALuint u;
200 ALubyte b[sizeof(ALuint)];
201 } EndianTest = { 1 };
202 #define IS_LITTLE_ENDIAN (EndianTest.b[0] == 1)
204 #define COUNTOF(x) (sizeof(x) / sizeof(0[x]))
207 #ifdef __cplusplus
208 extern "C" {
209 #endif
211 struct Hrtf;
212 struct HrtfEntry;
213 struct DirectHrtfState;
214 struct FrontStablizer;
215 struct Compressor;
216 struct ALCbackend;
217 struct ALcontextProps;
218 struct ALlistenerProps;
219 struct ALvoiceProps;
220 struct ALeffectslotProps;
223 #define DEFAULT_OUTPUT_RATE (44100)
224 #define MIN_OUTPUT_RATE (8000)
227 /* Find the next power-of-2 for non-power-of-2 numbers. */
228 inline ALuint NextPowerOf2(ALuint value)
230 if(value > 0)
232 value--;
233 value |= value>>1;
234 value |= value>>2;
235 value |= value>>4;
236 value |= value>>8;
237 value |= value>>16;
239 return value+1;
242 /** Round up a value to the next multiple. */
243 inline size_t RoundUp(size_t value, size_t r)
245 value += r-1;
246 return value - (value%r);
249 /* Fast float-to-int conversion. Assumes the FPU is already in round-to-zero
250 * mode. */
251 inline ALint fastf2i(ALfloat f)
253 #ifdef HAVE_LRINTF
254 return lrintf(f);
255 #elif defined(_MSC_VER) && defined(_M_IX86)
256 ALint i;
257 __asm fld f
258 __asm fistp i
259 return i;
260 #else
261 return (ALint)f;
262 #endif
266 enum DevProbe {
267 ALL_DEVICE_PROBE,
268 CAPTURE_DEVICE_PROBE
272 enum DistanceModel {
273 InverseDistanceClamped = AL_INVERSE_DISTANCE_CLAMPED,
274 LinearDistanceClamped = AL_LINEAR_DISTANCE_CLAMPED,
275 ExponentDistanceClamped = AL_EXPONENT_DISTANCE_CLAMPED,
276 InverseDistance = AL_INVERSE_DISTANCE,
277 LinearDistance = AL_LINEAR_DISTANCE,
278 ExponentDistance = AL_EXPONENT_DISTANCE,
279 DisableDistance = AL_NONE,
281 DefaultDistanceModel = InverseDistanceClamped
284 enum Channel {
285 FrontLeft = 0,
286 FrontRight,
287 FrontCenter,
288 LFE,
289 BackLeft,
290 BackRight,
291 BackCenter,
292 SideLeft,
293 SideRight,
295 UpperFrontLeft,
296 UpperFrontRight,
297 UpperBackLeft,
298 UpperBackRight,
299 LowerFrontLeft,
300 LowerFrontRight,
301 LowerBackLeft,
302 LowerBackRight,
304 Aux0,
305 Aux1,
306 Aux2,
307 Aux3,
308 Aux4,
309 Aux5,
310 Aux6,
311 Aux7,
312 Aux8,
313 Aux9,
314 Aux10,
315 Aux11,
316 Aux12,
317 Aux13,
318 Aux14,
319 Aux15,
321 InvalidChannel
325 /* Device formats */
326 enum DevFmtType {
327 DevFmtByte = ALC_BYTE_SOFT,
328 DevFmtUByte = ALC_UNSIGNED_BYTE_SOFT,
329 DevFmtShort = ALC_SHORT_SOFT,
330 DevFmtUShort = ALC_UNSIGNED_SHORT_SOFT,
331 DevFmtInt = ALC_INT_SOFT,
332 DevFmtUInt = ALC_UNSIGNED_INT_SOFT,
333 DevFmtFloat = ALC_FLOAT_SOFT,
335 DevFmtTypeDefault = DevFmtFloat
337 enum DevFmtChannels {
338 DevFmtMono = ALC_MONO_SOFT,
339 DevFmtStereo = ALC_STEREO_SOFT,
340 DevFmtQuad = ALC_QUAD_SOFT,
341 DevFmtX51 = ALC_5POINT1_SOFT,
342 DevFmtX61 = ALC_6POINT1_SOFT,
343 DevFmtX71 = ALC_7POINT1_SOFT,
344 DevFmtAmbi3D = ALC_BFORMAT3D_SOFT,
346 /* Similar to 5.1, except using rear channels instead of sides */
347 DevFmtX51Rear = 0x80000000,
349 DevFmtChannelsDefault = DevFmtStereo
351 #define MAX_OUTPUT_CHANNELS (16)
353 ALsizei BytesFromDevFmt(enum DevFmtType type);
354 ALsizei ChannelsFromDevFmt(enum DevFmtChannels chans, ALsizei ambiorder);
355 inline ALsizei FrameSizeFromDevFmt(enum DevFmtChannels chans, enum DevFmtType type, ALsizei ambiorder)
357 return ChannelsFromDevFmt(chans, ambiorder) * BytesFromDevFmt(type);
360 enum AmbiLayout {
361 AmbiLayout_FuMa = ALC_FUMA_SOFT, /* FuMa channel order */
362 AmbiLayout_ACN = ALC_ACN_SOFT, /* ACN channel order */
364 AmbiLayout_Default = AmbiLayout_ACN
367 enum AmbiNorm {
368 AmbiNorm_FuMa = ALC_FUMA_SOFT, /* FuMa normalization */
369 AmbiNorm_SN3D = ALC_SN3D_SOFT, /* SN3D normalization */
370 AmbiNorm_N3D = ALC_N3D_SOFT, /* N3D normalization */
372 AmbiNorm_Default = AmbiNorm_SN3D
376 enum DeviceType {
377 Playback,
378 Capture,
379 Loopback
383 enum RenderMode {
384 NormalRender,
385 StereoPair,
386 HrtfRender
390 /* The maximum number of Ambisonics coefficients. For a given order (o), the
391 * size needed will be (o+1)**2, thus zero-order has 1, first-order has 4,
392 * second-order has 9, third-order has 16, and fourth-order has 25.
394 #define MAX_AMBI_ORDER 3
395 #define MAX_AMBI_COEFFS ((MAX_AMBI_ORDER+1) * (MAX_AMBI_ORDER+1))
397 /* A bitmask of ambisonic channels with height information. If none of these
398 * channels are used/needed, there's no height (e.g. with most surround sound
399 * speaker setups). This only specifies up to 4th order, which is the highest
400 * order a 32-bit mask value can specify (a 64-bit mask could handle up to 7th
401 * order). This is ACN ordering, with bit 0 being ACN 0, etc.
403 #define AMBI_PERIPHONIC_MASK (0xfe7ce4)
405 /* The maximum number of Ambisonic coefficients for 2D (non-periphonic)
406 * representation. This is 2 per each order above zero-order, plus 1 for zero-
407 * order. Or simply, o*2 + 1.
409 #define MAX_AMBI2D_COEFFS (MAX_AMBI_ORDER*2 + 1)
412 typedef ALfloat ChannelConfig[MAX_AMBI_COEFFS];
413 typedef struct BFChannelConfig {
414 ALfloat Scale;
415 ALsizei Index;
416 } BFChannelConfig;
418 typedef union AmbiConfig {
419 /* Ambisonic coefficients for mixing to the dry buffer. */
420 ChannelConfig Coeffs[MAX_OUTPUT_CHANNELS];
421 /* Coefficient channel mapping for mixing to the dry buffer. */
422 BFChannelConfig Map[MAX_OUTPUT_CHANNELS];
423 } AmbiConfig;
426 typedef struct EnumeratedHrtf {
427 al_string name;
429 struct HrtfEntry *hrtf;
430 } EnumeratedHrtf;
431 TYPEDEF_VECTOR(EnumeratedHrtf, vector_EnumeratedHrtf)
434 /* Maximum delay in samples for speaker distance compensation. */
435 #define MAX_DELAY_LENGTH 1024
437 typedef struct DistanceComp {
438 ALfloat Gain;
439 ALsizei Length; /* Valid range is [0...MAX_DELAY_LENGTH). */
440 ALfloat *Buffer;
441 } DistanceComp;
443 /* Size for temporary storage of buffer data, in ALfloats. Larger values need
444 * more memory, while smaller values may need more iterations. The value needs
445 * to be a sensible size, however, as it constrains the max stepping value used
446 * for mixing, as well as the maximum number of samples per mixing iteration.
448 #define BUFFERSIZE 2048
450 typedef struct DryMixParams {
451 AmbiConfig Ambi;
452 /* Number of coefficients in each Ambi.Coeffs to mix together (4 for first-
453 * order, 9 for second-order, etc). If the count is 0, Ambi.Map is used
454 * instead to map each output to a coefficient index.
456 ALsizei CoeffCount;
458 ALfloat (*Buffer)[BUFFERSIZE];
459 ALsizei NumChannels;
460 ALsizei NumChannelsPerOrder[MAX_AMBI_ORDER+1];
461 } DryMixParams;
463 typedef struct BFMixParams {
464 AmbiConfig Ambi;
465 /* Will only be 4 or 0. */
466 ALsizei CoeffCount;
468 ALfloat (*Buffer)[BUFFERSIZE];
469 ALsizei NumChannels;
470 } BFMixParams;
472 typedef struct RealMixParams {
473 enum Channel ChannelName[MAX_OUTPUT_CHANNELS];
475 ALfloat (*Buffer)[BUFFERSIZE];
476 ALsizei NumChannels;
477 } RealMixParams;
479 struct ALCdevice_struct
481 RefCount ref;
483 ALCboolean Connected;
484 enum DeviceType Type;
486 ALuint Frequency;
487 ALuint UpdateSize;
488 ALuint NumUpdates;
489 enum DevFmtChannels FmtChans;
490 enum DevFmtType FmtType;
491 ALboolean IsHeadphones;
492 ALsizei AmbiOrder;
493 /* For DevFmtAmbi* output only, specifies the channel order and
494 * normalization.
496 enum AmbiLayout AmbiLayout;
497 enum AmbiNorm AmbiScale;
499 al_string DeviceName;
501 ATOMIC(ALCenum) LastError;
503 // Maximum number of sources that can be created
504 ALuint SourcesMax;
505 // Maximum number of slots that can be created
506 ALuint AuxiliaryEffectSlotMax;
508 ALCuint NumMonoSources;
509 ALCuint NumStereoSources;
510 ALsizei NumAuxSends;
512 // Map of Buffers for this device
513 UIntMap BufferMap;
515 // Map of Effects for this device
516 UIntMap EffectMap;
518 // Map of Filters for this device
519 UIntMap FilterMap;
521 /* HRTF state and info */
522 struct DirectHrtfState *Hrtf;
523 al_string HrtfName;
524 struct Hrtf *HrtfHandle;
525 vector_EnumeratedHrtf HrtfList;
526 ALCenum HrtfStatus;
528 /* UHJ encoder state */
529 struct Uhj2Encoder *Uhj_Encoder;
531 /* High quality Ambisonic decoder */
532 struct BFormatDec *AmbiDecoder;
534 /* Stereo-to-binaural filter */
535 struct bs2b *Bs2b;
537 /* First-order ambisonic upsampler for higher-order output */
538 struct AmbiUpsampler *AmbiUp;
540 /* Rendering mode. */
541 enum RenderMode Render_Mode;
543 // Device flags
544 ALuint Flags;
546 ALuint64 ClockBase;
547 ALuint SamplesDone;
549 /* Temp storage used for mixer processing. */
550 alignas(16) ALfloat TempBuffer[4][BUFFERSIZE];
552 /* The "dry" path corresponds to the main output. */
553 DryMixParams Dry;
555 /* First-order ambisonics output, to be upsampled to the dry buffer if different. */
556 BFMixParams FOAOut;
558 /* "Real" output, which will be written to the device buffer. May alias the
559 * dry buffer.
561 RealMixParams RealOut;
563 struct FrontStablizer *Stablizer;
565 struct Compressor *Limiter;
567 /* The average speaker distance as determined by the ambdec configuration
568 * (or alternatively, by the NFC-HOA reference delay). Only used for NFC.
570 ALfloat AvgSpeakerDist;
572 /* Delay buffers used to compensate for speaker distances. */
573 DistanceComp ChannelDelay[MAX_OUTPUT_CHANNELS];
575 /* Dithering control. */
576 ALfloat DitherDepth;
577 ALuint DitherSeed;
579 /* Running count of the mixer invocations, in 31.1 fixed point. This
580 * actually increments *twice* when mixing, first at the start and then at
581 * the end, so the bottom bit indicates if the device is currently mixing
582 * and the upper bits indicates how many mixes have been done.
584 RefCount MixCount;
586 // Contexts created on this device
587 ATOMIC(ALCcontext*) ContextList;
589 almtx_t BackendLock;
590 struct ALCbackend *Backend;
592 ALCdevice *volatile next;
595 // Frequency was requested by the app or config file
596 #define DEVICE_FREQUENCY_REQUEST (1u<<1)
597 // Channel configuration was requested by the config file
598 #define DEVICE_CHANNELS_REQUEST (1u<<2)
599 // Sample type was requested by the config file
600 #define DEVICE_SAMPLE_TYPE_REQUEST (1u<<3)
602 // Specifies if the DSP is paused at user request
603 #define DEVICE_PAUSED (1u<<30)
605 // Specifies if the device is currently running
606 #define DEVICE_RUNNING (1u<<31)
609 /* Nanosecond resolution for the device clock time. */
610 #define DEVICE_CLOCK_RES U64(1000000000)
613 /* Must be less than 15 characters (16 including terminating null) for
614 * compatibility with pthread_setname_np limitations. */
615 #define MIXER_THREAD_NAME "alsoft-mixer"
617 #define RECORD_THREAD_NAME "alsoft-record"
620 struct ALCcontext_struct {
621 RefCount ref;
623 struct ALlistener *Listener;
625 UIntMap SourceMap;
626 UIntMap EffectSlotMap;
628 ATOMIC(ALenum) LastError;
630 enum DistanceModel DistanceModel;
631 ALboolean SourceDistanceModel;
633 ALfloat DopplerFactor;
634 ALfloat DopplerVelocity;
635 ALfloat SpeedOfSound;
636 ALfloat MetersPerUnit;
638 ATOMIC_FLAG PropsClean;
639 ATOMIC(ALenum) DeferUpdates;
641 RWLock PropLock;
643 /* Counter for the pre-mixing updates, in 31.1 fixed point (lowest bit
644 * indicates if updates are currently happening).
646 RefCount UpdateCount;
647 ATOMIC(ALenum) HoldUpdates;
649 ALfloat GainBoost;
651 ATOMIC(struct ALcontextProps*) Update;
653 /* Linked lists of unused property containers, free to use for future
654 * updates.
656 ATOMIC(struct ALcontextProps*) FreeContextProps;
657 ATOMIC(struct ALlistenerProps*) FreeListenerProps;
658 ATOMIC(struct ALvoiceProps*) FreeVoiceProps;
659 ATOMIC(struct ALeffectslotProps*) FreeEffectslotProps;
661 struct ALvoice **Voices;
662 ALsizei VoiceCount;
663 ALsizei MaxVoices;
665 ATOMIC(struct ALeffectslotArray*) ActiveAuxSlots;
667 /* Default effect slot */
668 struct ALeffectslot *DefaultSlot;
670 ALCdevice *Device;
671 const ALCchar *ExtensionList;
673 ALCcontext *volatile next;
675 /* Memory space used by the listener (and possibly default effect slot) */
676 alignas(16) ALCbyte _listener_mem[];
679 ALCcontext *GetContextRef(void);
681 void ALCcontext_DecRef(ALCcontext *context);
683 void ALCcontext_DeferUpdates(ALCcontext *context);
684 void ALCcontext_ProcessUpdates(ALCcontext *context);
686 void AllocateVoices(ALCcontext *context, ALsizei num_voices, ALsizei old_sends);
688 void AppendAllDevicesList(const ALCchar *name);
689 void AppendCaptureDeviceList(const ALCchar *name);
692 extern ALint RTPrioLevel;
693 void SetRTPriority(void);
695 void SetDefaultChannelOrder(ALCdevice *device);
696 void SetDefaultWFXChannelOrder(ALCdevice *device);
698 const ALCchar *DevFmtTypeString(enum DevFmtType type);
699 const ALCchar *DevFmtChannelsString(enum DevFmtChannels chans);
701 inline ALint GetChannelIndex(const enum Channel names[MAX_OUTPUT_CHANNELS], enum Channel chan)
703 ALint i;
704 for(i = 0;i < MAX_OUTPUT_CHANNELS;i++)
706 if(names[i] == chan)
707 return i;
709 return -1;
712 * GetChannelIdxByName
714 * Returns the index for the given channel name (e.g. FrontCenter), or -1 if it
715 * doesn't exist.
717 inline ALint GetChannelIdxByName(const RealMixParams *real, enum Channel chan)
718 { return GetChannelIndex(real->ChannelName, chan); }
721 vector_al_string SearchDataFiles(const char *match, const char *subdir);
723 #ifdef __cplusplus
725 #endif
727 #endif