Move the ALCcontext definition to its own header
This commit is contained in:
parent
8f6e0f97ec
commit
fa3c34268d
@ -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;
|
||||
|
180
Alc/alcontext.h
Normal file
180
Alc/alcontext.h
Normal file
@ -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 */
|
15
Alc/alu.cpp
15
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;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "alMain.h"
|
||||
#include "alcontext.h"
|
||||
#include "alAuxEffectSlot.h"
|
||||
#include "alError.h"
|
||||
#include "alu.h"
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "alMain.h"
|
||||
#include "alcontext.h"
|
||||
#include "alAuxEffectSlot.h"
|
||||
#include "alError.h"
|
||||
#include "alu.h"
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "alMain.h"
|
||||
#include "alcontext.h"
|
||||
#include "alAuxEffectSlot.h"
|
||||
#include "alError.h"
|
||||
#include "alu.h"
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "alMain.h"
|
||||
#include "alcontext.h"
|
||||
#include "alFilter.h"
|
||||
#include "alAuxEffectSlot.h"
|
||||
#include "alError.h"
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "alMain.h"
|
||||
#include "alcontext.h"
|
||||
#include "alAuxEffectSlot.h"
|
||||
#include "alError.h"
|
||||
#include "alu.h"
|
||||
|
@ -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"
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "alMain.h"
|
||||
#include "alcontext.h"
|
||||
#include "alAuxEffectSlot.h"
|
||||
#include "alError.h"
|
||||
#include "alu.h"
|
||||
|
@ -4,7 +4,9 @@
|
||||
|
||||
#include "AL/al.h"
|
||||
#include "AL/alc.h"
|
||||
|
||||
#include "alMain.h"
|
||||
#include "alcontext.h"
|
||||
#include "alAuxEffectSlot.h"
|
||||
#include "alError.h"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "alMain.h"
|
||||
#include "alcontext.h"
|
||||
#include "alu.h"
|
||||
#include "alAuxEffectSlot.h"
|
||||
#include "alListener.h"
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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];
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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"
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "alMain.h"
|
||||
#include "alcontext.h"
|
||||
#include "alu.h"
|
||||
#include "alError.h"
|
||||
#include "alBuffer.h"
|
||||
|
@ -26,7 +26,9 @@
|
||||
|
||||
#include "AL/al.h"
|
||||
#include "AL/alc.h"
|
||||
|
||||
#include "alMain.h"
|
||||
#include "alcontext.h"
|
||||
#include "alEffect.h"
|
||||
#include "alError.h"
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#endif
|
||||
|
||||
#include "alMain.h"
|
||||
#include "AL/alc.h"
|
||||
#include "alcontext.h"
|
||||
#include "alError.h"
|
||||
|
||||
ALboolean TrapALError = AL_FALSE;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "alMain.h"
|
||||
#include "alcontext.h"
|
||||
#include "alu.h"
|
||||
#include "alFilter.h"
|
||||
#include "alError.h"
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "alMain.h"
|
||||
#include "alcontext.h"
|
||||
#include "alu.h"
|
||||
#include "alError.h"
|
||||
#include "alListener.h"
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user