diff options
author | Chris Robinson <[email protected]> | 2018-11-17 23:02:27 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-17 23:02:27 -0800 |
commit | fa3c34268dd7d9bc380ecd19aedb28924d29b295 (patch) | |
tree | c702638d5589054498fc6c7292b6d6d908954954 | |
parent | 8f6e0f97ec5543de8ae49f12046b5c893565778e (diff) |
Move the ALCcontext definition to its own header
30 files changed, 234 insertions, 191 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp index c719eaa9..ec9a0adf 100644 --- a/Alc/alc.cpp +++ b/Alc/alc.cpp @@ -37,6 +37,7 @@ #include <algorithm> #include "alMain.h" +#include "alcontext.h" #include "alSource.h" #include "alListener.h" #include "alSource.h" @@ -2633,7 +2634,7 @@ static ALvoid InitContext(ALCcontext *Context) ATOMIC_INIT(&Context->ActiveAuxSlots, auxslots); //Set globals - Context->DistanceModel = DefaultDistanceModel; + Context->DistanceModel = DistanceModel::Default; Context->SourceDistanceModel = AL_FALSE; Context->DopplerFactor = 1.0f; Context->DopplerVelocity = 1.0f; diff --git a/Alc/alcontext.h b/Alc/alcontext.h new file mode 100644 index 00000000..9ef2db3b --- /dev/null +++ b/Alc/alcontext.h @@ -0,0 +1,180 @@ +#ifndef ALCONTEXT_H +#define ALCONTEXT_H + +#include "AL/al.h" +#include "AL/alc.h" +#include "AL/alext.h" +#include "inprogext.h" + +#include "atomic.h" +#include "vector.h" +#include "threads.h" + + +struct ALlistener; +struct ALsource; +struct ALeffectslot; +struct ALcontextProps; +struct ALlistenerProps; +struct ALvoiceProps; +struct ALeffectslotProps; +struct ALvoice; +struct ALeffectslotArray; +struct ll_ringbuffer; + +enum class DistanceModel { + InverseClamped = AL_INVERSE_DISTANCE_CLAMPED, + LinearClamped = AL_LINEAR_DISTANCE_CLAMPED, + ExponentClamped = AL_EXPONENT_DISTANCE_CLAMPED, + Inverse = AL_INVERSE_DISTANCE, + Linear = AL_LINEAR_DISTANCE, + Exponent = AL_EXPONENT_DISTANCE, + Disable = AL_NONE, + + Default = InverseClamped +}; + +struct SourceSubList { + uint64_t FreeMask; + ALsource *Sources; /* 64 */ +}; +TYPEDEF_VECTOR(SourceSubList, vector_SourceSubList) + +/* Effect slots are rather large, and apps aren't likely to have more than one + * or two (let alone 64), so hold them individually. + */ +using ALeffectslotPtr = struct ALeffectslot*; +TYPEDEF_VECTOR(ALeffectslotPtr, vector_ALeffectslotPtr) + +struct ALCcontext_struct { + RefCount ref; + + ALlistener *Listener; + + vector_SourceSubList SourceList; + ALuint NumSources; + almtx_t SourceLock; + + vector_ALeffectslotPtr EffectSlotList; + almtx_t EffectSlotLock; + + ATOMIC(ALenum) LastError; + + enum DistanceModel DistanceModel; + ALboolean SourceDistanceModel; + + ALfloat DopplerFactor; + ALfloat DopplerVelocity; + ALfloat SpeedOfSound; + ALfloat MetersPerUnit; + + ATOMIC(ALenum) PropsClean; + ATOMIC(ALenum) DeferUpdates; + + almtx_t PropLock; + + /* Counter for the pre-mixing updates, in 31.1 fixed point (lowest bit + * indicates if updates are currently happening). + */ + RefCount UpdateCount; + ATOMIC(ALenum) HoldUpdates; + + ALfloat GainBoost; + + ATOMIC(ALcontextProps*) Update; + + /* Linked lists of unused property containers, free to use for future + * updates. + */ + ATOMIC(ALcontextProps*) FreeContextProps; + ATOMIC(ALlistenerProps*) FreeListenerProps; + ATOMIC(ALvoiceProps*) FreeVoiceProps; + ATOMIC(ALeffectslotProps*) FreeEffectslotProps; + + ALvoice **Voices; + ALsizei VoiceCount; + ALsizei MaxVoices; + + ATOMIC(ALeffectslotArray*) ActiveAuxSlots; + + althrd_t EventThread; + alsem_t EventSem; + ll_ringbuffer *AsyncEvents; + ATOMIC(ALbitfieldSOFT) EnabledEvts; + almtx_t EventCbLock; + ALEVENTPROCSOFT EventCb; + void *EventParam; + + /* Default effect slot */ + ALeffectslot *DefaultSlot; + + ALCdevice *Device; + const ALCchar *ExtensionList; + + ATOMIC(ALCcontext*) next; + + /* Memory space used by the listener (and possibly default effect slot) */ + alignas(16) ALCbyte _listener_mem[]; +}; + +ALCcontext *GetContextRef(void); +void ALCcontext_DecRef(ALCcontext *context); + +void UpdateContextProps(ALCcontext *context); + +void ALCcontext_DeferUpdates(ALCcontext *context); +void ALCcontext_ProcessUpdates(ALCcontext *context); + +inline void LockEffectSlotList(ALCcontext *context) +{ almtx_lock(&context->EffectSlotLock); } +inline void UnlockEffectSlotList(ALCcontext *context) +{ almtx_unlock(&context->EffectSlotLock); } + + +/* Simple RAII context reference. Takes the reference of the provided + * ALCcontext, and decrements it when leaving scope. Movable (transfer + * reference) but not copyable (no new references). + */ +class ContextRef { + ALCcontext *mCtx{nullptr}; + + void release() noexcept + { + if(mCtx) + ALCcontext_DecRef(mCtx); + mCtx = nullptr; + } + +public: + ContextRef() noexcept = default; + explicit ContextRef(ALCcontext *ctx) noexcept : mCtx(ctx) { } + ~ContextRef() { release(); } + + ContextRef& operator=(const ContextRef&) = delete; + ContextRef& operator=(ContextRef&& rhs) noexcept + { + release(); + mCtx = rhs.mCtx; + rhs.mCtx = nullptr; + return *this; + } + + operator bool() const noexcept { return mCtx != nullptr; } + + ALCcontext* operator->() noexcept { return mCtx; } + ALCcontext* get() noexcept { return mCtx; } +}; + + +struct ALcontextProps { + ALfloat DopplerFactor; + ALfloat DopplerVelocity; + ALfloat SpeedOfSound; + ALboolean SourceDistanceModel; + enum DistanceModel DistanceModel; + ALfloat MetersPerUnit; + + ATOMIC(struct ALcontextProps*) next; +}; + +#endif /* ALCONTEXT_H */ diff --git a/Alc/alu.cpp b/Alc/alu.cpp index 3075f1ec..1895b777 100644 --- a/Alc/alu.cpp +++ b/Alc/alu.cpp @@ -27,6 +27,7 @@ #include <assert.h> #include "alMain.h" +#include "alcontext.h" #include "alSource.h" #include "alBuffer.h" #include "alListener.h" @@ -1218,12 +1219,12 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *prop switch(Listener->Params.SourceDistanceModel ? props->DistanceModel : Listener->Params.DistanceModel) { - case InverseDistanceClamped: + case DistanceModel::InverseClamped: ClampedDist = clampf(ClampedDist, props->RefDistance, props->MaxDistance); if(props->MaxDistance < props->RefDistance) break; /*fall-through*/ - case InverseDistance: + case DistanceModel::Inverse: if(!(props->RefDistance > 0.0f)) ClampedDist = props->RefDistance; else @@ -1238,12 +1239,12 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *prop } break; - case LinearDistanceClamped: + case DistanceModel::LinearClamped: ClampedDist = clampf(ClampedDist, props->RefDistance, props->MaxDistance); if(props->MaxDistance < props->RefDistance) break; /*fall-through*/ - case LinearDistance: + case DistanceModel::Linear: if(!(props->MaxDistance != props->RefDistance)) ClampedDist = props->RefDistance; else @@ -1260,12 +1261,12 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *prop } break; - case ExponentDistanceClamped: + case DistanceModel::ExponentClamped: ClampedDist = clampf(ClampedDist, props->RefDistance, props->MaxDistance); if(props->MaxDistance < props->RefDistance) break; /*fall-through*/ - case ExponentDistance: + case DistanceModel::Exponent: if(!(ClampedDist > 0.0f && props->RefDistance > 0.0f)) ClampedDist = props->RefDistance; else @@ -1276,7 +1277,7 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *prop } break; - case DisableDistance: + case DistanceModel::Disable: ClampedDist = props->RefDistance; break; } diff --git a/Alc/effects/autowah.cpp b/Alc/effects/autowah.cpp index b4ef8f3c..e2f07b6f 100644 --- a/Alc/effects/autowah.cpp +++ b/Alc/effects/autowah.cpp @@ -24,6 +24,7 @@ #include <stdlib.h> #include "alMain.h" +#include "alcontext.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" diff --git a/Alc/effects/chorus.cpp b/Alc/effects/chorus.cpp index b658098e..411ba6a5 100644 --- a/Alc/effects/chorus.cpp +++ b/Alc/effects/chorus.cpp @@ -24,6 +24,7 @@ #include <stdlib.h> #include "alMain.h" +#include "alcontext.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" diff --git a/Alc/effects/compressor.cpp b/Alc/effects/compressor.cpp index 0a307a5f..5603deea 100644 --- a/Alc/effects/compressor.cpp +++ b/Alc/effects/compressor.cpp @@ -18,13 +18,15 @@ * Or go to http://www.gnu.org/copyleft/lgpl.html */ +#include "config.h" + #include <stdlib.h> -#include "config.h" -#include "alError.h" #include "alMain.h" -#include "alAuxEffectSlot.h" +#include "alcontext.h" #include "alu.h" +#include "alAuxEffectSlot.h" +#include "alError.h" #define AMP_ENVELOPE_MIN 0.5f diff --git a/Alc/effects/dedicated.cpp b/Alc/effects/dedicated.cpp index dd250e64..705f7d41 100644 --- a/Alc/effects/dedicated.cpp +++ b/Alc/effects/dedicated.cpp @@ -23,10 +23,10 @@ #include <stdlib.h> #include "alMain.h" +#include "alcontext.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" -#include "filters/defs.h" struct ALdedicatedState final : public ALeffectState { diff --git a/Alc/effects/distortion.cpp b/Alc/effects/distortion.cpp index 75629d9c..7dd15981 100644 --- a/Alc/effects/distortion.cpp +++ b/Alc/effects/distortion.cpp @@ -24,6 +24,7 @@ #include <stdlib.h> #include "alMain.h" +#include "alcontext.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" diff --git a/Alc/effects/echo.cpp b/Alc/effects/echo.cpp index f987e582..492da6f6 100644 --- a/Alc/effects/echo.cpp +++ b/Alc/effects/echo.cpp @@ -24,6 +24,7 @@ #include <stdlib.h> #include "alMain.h" +#include "alcontext.h" #include "alFilter.h" #include "alAuxEffectSlot.h" #include "alError.h" diff --git a/Alc/effects/equalizer.cpp b/Alc/effects/equalizer.cpp index 8388a123..48c6d1e2 100644 --- a/Alc/effects/equalizer.cpp +++ b/Alc/effects/equalizer.cpp @@ -24,6 +24,7 @@ #include <stdlib.h> #include "alMain.h" +#include "alcontext.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" diff --git a/Alc/effects/fshifter.cpp b/Alc/effects/fshifter.cpp index 304e281f..f112c4c7 100644 --- a/Alc/effects/fshifter.cpp +++ b/Alc/effects/fshifter.cpp @@ -27,10 +27,10 @@ #include <algorithm> #include "alMain.h" +#include "alcontext.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" -#include "filters/defs.h" #include "alcomplex.h" diff --git a/Alc/effects/modulator.cpp b/Alc/effects/modulator.cpp index 19513add..7e8f8ce4 100644 --- a/Alc/effects/modulator.cpp +++ b/Alc/effects/modulator.cpp @@ -24,6 +24,7 @@ #include <stdlib.h> #include "alMain.h" +#include "alcontext.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" diff --git a/Alc/effects/null.cpp b/Alc/effects/null.cpp index 377593ab..0d85d505 100644 --- a/Alc/effects/null.cpp +++ b/Alc/effects/null.cpp @@ -4,7 +4,9 @@ #include "AL/al.h" #include "AL/alc.h" + #include "alMain.h" +#include "alcontext.h" #include "alAuxEffectSlot.h" #include "alError.h" diff --git a/Alc/effects/pshifter.cpp b/Alc/effects/pshifter.cpp index f0cdf53e..1199a19d 100644 --- a/Alc/effects/pshifter.cpp +++ b/Alc/effects/pshifter.cpp @@ -27,10 +27,10 @@ #include <algorithm> #include "alMain.h" +#include "alcontext.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" -#include "filters/defs.h" #include "alcomplex.h" diff --git a/Alc/effects/reverb.cpp b/Alc/effects/reverb.cpp index 5cfc0012..fe9cc9f7 100644 --- a/Alc/effects/reverb.cpp +++ b/Alc/effects/reverb.cpp @@ -25,6 +25,7 @@ #include <math.h> #include "alMain.h" +#include "alcontext.h" #include "alu.h" #include "alAuxEffectSlot.h" #include "alListener.h" diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp index 03d51dd6..f89b6efa 100644 --- a/Alc/mixvoice.cpp +++ b/Alc/mixvoice.cpp @@ -26,9 +26,11 @@ #include <ctype.h> #include <assert.h> -#include "alMain.h" #include "AL/al.h" #include "AL/alc.h" + +#include "alMain.h" +#include "alcontext.h" #include "alSource.h" #include "alBuffer.h" #include "alListener.h" diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a9fdee6..e81dc403 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -741,6 +741,7 @@ SET(ALC_OBJS Alc/alu.cpp Alc/alconfig.cpp Alc/alconfig.h + Alc/alcontext.h Alc/bs2b.cpp Alc/converter.cpp Alc/converter.h diff --git a/OpenAL32/Include/alListener.h b/OpenAL32/Include/alListener.h index 9efadf47..33dea4f3 100644 --- a/OpenAL32/Include/alListener.h +++ b/OpenAL32/Include/alListener.h @@ -8,17 +8,6 @@ extern "C" { #endif -struct ALcontextProps { - ALfloat DopplerFactor; - ALfloat DopplerVelocity; - ALfloat SpeedOfSound; - ALboolean SourceDistanceModel; - enum DistanceModel DistanceModel; - ALfloat MetersPerUnit; - - ATOMIC(struct ALcontextProps*) next; -}; - struct ALlistenerProps { ALfloat Position[3]; ALfloat Velocity[3]; diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index b5c86dc6..0e6e4cd9 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -204,7 +204,6 @@ static const union { #endif -struct ll_ringbuffer; struct Hrtf; struct HrtfEntry; struct DirectHrtfState; @@ -214,11 +213,6 @@ struct ALCbackend; struct ALbuffer; struct ALeffect; struct ALfilter; -struct ALsource; -struct ALcontextProps; -struct ALlistenerProps; -struct ALvoiceProps; -struct ALeffectslotProps; #define DEFAULT_OUTPUT_RATE (44100) @@ -380,18 +374,6 @@ enum DevProbe { }; -enum DistanceModel { - InverseDistanceClamped = AL_INVERSE_DISTANCE_CLAMPED, - LinearDistanceClamped = AL_LINEAR_DISTANCE_CLAMPED, - ExponentDistanceClamped = AL_EXPONENT_DISTANCE_CLAMPED, - InverseDistance = AL_INVERSE_DISTANCE, - LinearDistance = AL_LINEAR_DISTANCE, - ExponentDistance = AL_EXPONENT_DISTANCE, - DisableDistance = AL_NONE, - - DefaultDistanceModel = InverseDistanceClamped -}; - enum Channel { FrontLeft = 0, FrontRight, @@ -552,18 +534,6 @@ typedef struct FilterSubList { } FilterSubList; TYPEDEF_VECTOR(FilterSubList, vector_FilterSubList) -typedef struct SourceSubList { - ALuint64 FreeMask; - struct ALsource *Sources; /* 64 */ -} SourceSubList; -TYPEDEF_VECTOR(SourceSubList, vector_SourceSubList) - -/* Effect slots are rather large, and apps aren't likely to have more than one - * or two (let alone 64), so hold them individually. - */ -typedef struct ALeffectslot *ALeffectslotPtr; -TYPEDEF_VECTOR(ALeffectslotPtr, vector_ALeffectslotPtr) - typedef struct EnumeratedHrtf { char *name; @@ -790,83 +760,6 @@ typedef struct AsyncEvent { } AsyncEvent; #define ASYNC_EVENT(t) { t, { 0 } } -struct ALCcontext_struct { - RefCount ref; - - struct ALlistener *Listener; - - vector_SourceSubList SourceList; - ALuint NumSources; - almtx_t SourceLock; - - vector_ALeffectslotPtr EffectSlotList; - almtx_t EffectSlotLock; - - ATOMIC(ALenum) LastError; - - enum DistanceModel DistanceModel; - ALboolean SourceDistanceModel; - - ALfloat DopplerFactor; - ALfloat DopplerVelocity; - ALfloat SpeedOfSound; - ALfloat MetersPerUnit; - - ATOMIC(ALenum) PropsClean; - ATOMIC(ALenum) DeferUpdates; - - almtx_t PropLock; - - /* Counter for the pre-mixing updates, in 31.1 fixed point (lowest bit - * indicates if updates are currently happening). - */ - RefCount UpdateCount; - ATOMIC(ALenum) HoldUpdates; - - ALfloat GainBoost; - - ATOMIC(struct ALcontextProps*) Update; - - /* Linked lists of unused property containers, free to use for future - * updates. - */ - ATOMIC(struct ALcontextProps*) FreeContextProps; - ATOMIC(struct ALlistenerProps*) FreeListenerProps; - ATOMIC(struct ALvoiceProps*) FreeVoiceProps; - ATOMIC(struct ALeffectslotProps*) FreeEffectslotProps; - - struct ALvoice **Voices; - ALsizei VoiceCount; - ALsizei MaxVoices; - - ATOMIC(struct ALeffectslotArray*) ActiveAuxSlots; - - althrd_t EventThread; - alsem_t EventSem; - struct ll_ringbuffer *AsyncEvents; - ATOMIC(ALbitfieldSOFT) EnabledEvts; - almtx_t EventCbLock; - ALEVENTPROCSOFT EventCb; - void *EventParam; - - /* Default effect slot */ - struct ALeffectslot *DefaultSlot; - - ALCdevice *Device; - const ALCchar *ExtensionList; - - ATOMIC(ALCcontext*) next; - - /* Memory space used by the listener (and possibly default effect slot) */ - alignas(16) ALCbyte _listener_mem[]; -}; - -ALCcontext *GetContextRef(void); - -void ALCcontext_DecRef(ALCcontext *context); - -void ALCcontext_DeferUpdates(ALCcontext *context); -void ALCcontext_ProcessUpdates(ALCcontext *context); void AllocateVoices(ALCcontext *context, ALsizei num_voices, ALsizei old_sends); @@ -909,11 +802,6 @@ inline void UnlockEffectList(ALCdevice *device) { almtx_unlock(&device->EffectLo inline void LockFilterList(ALCdevice *device) { almtx_lock(&device->FilterLock); } inline void UnlockFilterList(ALCdevice *device) { almtx_unlock(&device->FilterLock); } -inline void LockEffectSlotList(ALCcontext *context) -{ almtx_lock(&context->EffectSlotLock); } -inline void UnlockEffectSlotList(ALCcontext *context) -{ almtx_unlock(&context->EffectSlotLock); } - int EventThread(void *arg); @@ -923,40 +811,6 @@ char *alstrdup(const char *str); } // extern "C" std::vector<std::string> SearchDataFiles(const char *match, const char *subdir); - -/* Simple RAII context reference. Takes the reference of the provided - * ALCcontext, and decrements it when leaving scope. Movable (transfer - * reference) but not copyable (no new references). - */ -class ContextRef { - ALCcontext *mCtx{nullptr}; - - void release() noexcept - { - if(mCtx) - ALCcontext_DecRef(mCtx); - mCtx = nullptr; - } - -public: - ContextRef() noexcept = default; - explicit ContextRef(ALCcontext *ctx) noexcept : mCtx(ctx) { } - ~ContextRef() { release(); } - - ContextRef& operator=(const ContextRef&) = delete; - ContextRef& operator=(ContextRef&& rhs) noexcept - { - release(); - mCtx = rhs.mCtx; - rhs.mCtx = nullptr; - return *this; - } - - operator bool() const noexcept { return mCtx != nullptr; } - - ALCcontext* operator->() noexcept { return mCtx; } - ALCcontext* get() noexcept { return mCtx; } -}; #endif #endif diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 78ec502d..7031df70 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -19,6 +19,8 @@ #include "filters/nfc.h" +enum class DistanceModel; + #define MAX_PITCH (255) /* Maximum number of samples to pad on either end of a buffer for resampling. @@ -517,8 +519,6 @@ void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples); /* Caller must lock the device, and the mixer must not be running. */ void aluHandleDisconnect(ALCdevice *device, const char *msg, ...) DECL_FORMAT(printf, 2, 3); -void UpdateContextProps(ALCcontext *context); - extern MixerFunc MixSamples; extern RowMixerFunc MixRowSamples; diff --git a/OpenAL32/alAuxEffectSlot.cpp b/OpenAL32/alAuxEffectSlot.cpp index 0ebcd3c9..bcf5c967 100644 --- a/OpenAL32/alAuxEffectSlot.cpp +++ b/OpenAL32/alAuxEffectSlot.cpp @@ -25,7 +25,9 @@ #include "AL/al.h" #include "AL/alc.h" + #include "alMain.h" +#include "alcontext.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "alListener.h" diff --git a/OpenAL32/alBuffer.cpp b/OpenAL32/alBuffer.cpp index c04b8664..27e3ddd1 100644 --- a/OpenAL32/alBuffer.cpp +++ b/OpenAL32/alBuffer.cpp @@ -34,6 +34,7 @@ #include <algorithm> #include "alMain.h" +#include "alcontext.h" #include "alu.h" #include "alError.h" #include "alBuffer.h" diff --git a/OpenAL32/alEffect.cpp b/OpenAL32/alEffect.cpp index b9a2623c..4f25b5f4 100644 --- a/OpenAL32/alEffect.cpp +++ b/OpenAL32/alEffect.cpp @@ -26,7 +26,9 @@ #include "AL/al.h" #include "AL/alc.h" + #include "alMain.h" +#include "alcontext.h" #include "alEffect.h" #include "alError.h" diff --git a/OpenAL32/alError.cpp b/OpenAL32/alError.cpp index cf56dd71..6d8ca882 100644 --- a/OpenAL32/alError.cpp +++ b/OpenAL32/alError.cpp @@ -29,7 +29,7 @@ #endif #include "alMain.h" -#include "AL/alc.h" +#include "alcontext.h" #include "alError.h" ALboolean TrapALError = AL_FALSE; diff --git a/OpenAL32/alExtension.cpp b/OpenAL32/alExtension.cpp index bcc21f0f..fff12e01 100644 --- a/OpenAL32/alExtension.cpp +++ b/OpenAL32/alExtension.cpp @@ -24,16 +24,12 @@ #include <string.h> #include <ctype.h> -#include "alError.h" -#include "alMain.h" -#include "alFilter.h" -#include "alEffect.h" -#include "alAuxEffectSlot.h" -#include "alSource.h" -#include "alBuffer.h" #include "AL/al.h" #include "AL/alc.h" +#include "alMain.h" +#include "alcontext.h" +#include "alError.h" AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extName) { diff --git a/OpenAL32/alFilter.cpp b/OpenAL32/alFilter.cpp index a85c5dde..3c78cebf 100644 --- a/OpenAL32/alFilter.cpp +++ b/OpenAL32/alFilter.cpp @@ -23,6 +23,7 @@ #include <stdlib.h> #include "alMain.h" +#include "alcontext.h" #include "alu.h" #include "alFilter.h" #include "alError.h" diff --git a/OpenAL32/alListener.cpp b/OpenAL32/alListener.cpp index 809b0318..f2fdf3c1 100644 --- a/OpenAL32/alListener.cpp +++ b/OpenAL32/alListener.cpp @@ -21,6 +21,7 @@ #include "config.h" #include "alMain.h" +#include "alcontext.h" #include "alu.h" #include "alError.h" #include "alListener.h" diff --git a/OpenAL32/alSource.cpp b/OpenAL32/alSource.cpp index 93b0cd88..f3996cbf 100644 --- a/OpenAL32/alSource.cpp +++ b/OpenAL32/alSource.cpp @@ -27,7 +27,9 @@ #include "AL/al.h" #include "AL/alc.h" + #include "alMain.h" +#include "alcontext.h" #include "alError.h" #include "alSource.h" #include "alBuffer.h" @@ -1465,7 +1467,7 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p return AL_TRUE; case AL_DISTANCE_MODEL: - *values = Source->DistanceModel; + *values = static_cast<int>(Source->DistanceModel); return AL_TRUE; case AL_SOURCE_RESAMPLER_SOFT: @@ -3079,7 +3081,7 @@ static void InitSourceParams(ALsource *Source, ALsizei num_sends) Source->DopplerFactor = 1.0f; Source->HeadRelative = AL_FALSE; Source->Looping = AL_FALSE; - Source->DistanceModel = DefaultDistanceModel; + Source->DistanceModel = DistanceModel::Default; Source->Resampler = ResamplerDefault; Source->DirectChannels = AL_FALSE; Source->Spatialize = SpatializeAuto; diff --git a/OpenAL32/alState.cpp b/OpenAL32/alState.cpp index 6750de1f..c550d2b5 100644 --- a/OpenAL32/alState.cpp +++ b/OpenAL32/alState.cpp @@ -23,14 +23,11 @@ #include "version.h" #include <stdlib.h> + #include "alMain.h" -#include "AL/alc.h" -#include "AL/al.h" -#include "AL/alext.h" +#include "alcontext.h" +#include "alu.h" #include "alError.h" -#include "alListener.h" -#include "alSource.h" -#include "alAuxEffectSlot.h" #include "backends/base.h" @@ -152,7 +149,7 @@ AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum pname) break; case AL_DISTANCE_MODEL: - if(context->DistanceModel == AL_INVERSE_DISTANCE_CLAMPED) + if(context->DistanceModel == DistanceModel::Default) value = AL_TRUE; break; diff --git a/OpenAL32/event.cpp b/OpenAL32/event.cpp index bc3e3178..67a10645 100644 --- a/OpenAL32/event.cpp +++ b/OpenAL32/event.cpp @@ -6,7 +6,9 @@ #include "AL/alc.h" #include "AL/al.h" #include "AL/alext.h" + #include "alMain.h" +#include "alcontext.h" #include "alError.h" #include "alAuxEffectSlot.h" #include "ringbuffer.h" |