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 /OpenAL32/Include | |
parent | 8f6e0f97ec5543de8ae49f12046b5c893565778e (diff) |
Move the ALCcontext definition to its own header
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r-- | OpenAL32/Include/alListener.h | 11 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 146 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 4 |
3 files changed, 2 insertions, 159 deletions
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; |