Revert "Updated SDL, Bullet and OpenAL soft libs"

This reverts commit 370161cfb1.
This commit is contained in:
AzaezelX 2019-07-08 09:49:44 -05:00
parent 160dc00c07
commit e7ee94428e
1102 changed files with 62741 additions and 204988 deletions

View file

@ -145,8 +145,8 @@ typedef struct ALeffectslot {
* * Channel 3 is OpenAL -Z * sqrt(3)
* Consequently, effects that only want to work with mono input can use
* channel 0 by itself. Effects that want multichannel can process the
* ambisonics signal and make a B-Format source pan for first-order device
* output (FOAOut).
* ambisonics signal and make a B-Format pan (ComputeFirstOrderGains) for
* first-order device output (FOAOut).
*/
alignas(16) ALfloat WetBuffer[MAX_EFFECT_CHANNELS][BUFFERSIZE];
} ALeffectslot;
@ -160,14 +160,12 @@ ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context);
EffectStateFactory *NullStateFactory_getFactory(void);
EffectStateFactory *ReverbStateFactory_getFactory(void);
EffectStateFactory *AutowahStateFactory_getFactory(void);
EffectStateFactory *ChorusStateFactory_getFactory(void);
EffectStateFactory *CompressorStateFactory_getFactory(void);
EffectStateFactory *DistortionStateFactory_getFactory(void);
EffectStateFactory *EchoStateFactory_getFactory(void);
EffectStateFactory *EqualizerStateFactory_getFactory(void);
EffectStateFactory *FlangerStateFactory_getFactory(void);
EffectStateFactory *FshifterStateFactory_getFactory(void);
EffectStateFactory *ModulatorStateFactory_getFactory(void);
EffectStateFactory *PshifterStateFactory_getFactory(void);

View file

@ -12,14 +12,12 @@ struct ALeffect;
enum {
EAXREVERB_EFFECT = 0,
REVERB_EFFECT,
AUTOWAH_EFFECT,
CHORUS_EFFECT,
COMPRESSOR_EFFECT,
DISTORTION_EFFECT,
ECHO_EFFECT,
EQUALIZER_EFFECT,
FLANGER_EFFECT,
FSHIFTER_EFFECT,
MODULATOR_EFFECT,
PSHIFTER_EFFECT,
DEDICATED_EFFECT,
@ -35,7 +33,7 @@ struct EffectList {
int type;
ALenum val;
};
#define EFFECTLIST_SIZE 14
#define EFFECTLIST_SIZE 12
extern const struct EffectList EffectList[EFFECTLIST_SIZE];
@ -61,14 +59,12 @@ const struct ALeffectVtable T##_vtable = { \
extern const struct ALeffectVtable ALeaxreverb_vtable;
extern const struct ALeffectVtable ALreverb_vtable;
extern const struct ALeffectVtable ALautowah_vtable;
extern const struct ALeffectVtable ALchorus_vtable;
extern const struct ALeffectVtable ALcompressor_vtable;
extern const struct ALeffectVtable ALdistortion_vtable;
extern const struct ALeffectVtable ALecho_vtable;
extern const struct ALeffectVtable ALequalizer_vtable;
extern const struct ALeffectVtable ALflanger_vtable;
extern const struct ALeffectVtable ALfshifter_vtable;
extern const struct ALeffectVtable ALmodulator_vtable;
extern const struct ALeffectVtable ALnull_vtable;
extern const struct ALeffectVtable ALpshifter_vtable;
@ -105,13 +101,6 @@ typedef union ALeffectProps {
ALfloat LFReference;
} Reverb;
struct {
ALfloat AttackTime;
ALfloat ReleaseTime;
ALfloat Resonance;
ALfloat PeakGain;
} Autowah;
struct {
ALint Waveform;
ALint Phase;
@ -156,12 +145,6 @@ typedef union ALeffectProps {
ALfloat HighGain;
} Equalizer;
struct {
ALfloat Frequency;
ALint LeftDirection;
ALint RightDirection;
} Fshifter;
struct {
ALfloat Frequency;
ALfloat HighPassCutoff;

View file

@ -115,25 +115,15 @@ typedef ALuint64SOFT ALuint64;
#endif
#endif
#ifndef I64
#if defined(_MSC_VER)
#define I64(x) ((ALint64)(x##i64))
#elif SIZEOF_LONG == 8
#define I64(x) ((ALint64)(x##l))
#elif SIZEOF_LONG_LONG == 8
#define I64(x) ((ALint64)(x##ll))
#endif
#endif
/* Define a CTZ64 macro (count trailing zeros, for 64-bit integers). The result
* is *UNDEFINED* if the value is 0.
*/
#ifdef __GNUC__
#if SIZEOF_LONG == 8
#define CTZ64 __builtin_ctzl
#define CTZ64(x) __builtin_ctzl(x)
#else
#define CTZ64 __builtin_ctzll
#define CTZ64(x) __builtin_ctzll(x)
#endif
#elif defined(HAVE_BITSCANFORWARD64_INTRINSIC)
@ -144,7 +134,7 @@ inline int msvc64_ctz64(ALuint64 v)
_BitScanForward64(&idx, v);
return (int)idx;
}
#define CTZ64 msvc64_ctz64
#define CTZ64(x) msvc64_ctz64(x)
#elif defined(HAVE_BITSCANFORWARD_INTRINSIC)
@ -158,7 +148,7 @@ inline int msvc_ctz64(ALuint64 v)
}
return (int)idx;
}
#define CTZ64 msvc_ctz64
#define CTZ64(x) msvc_ctz64(x)
#else
@ -181,18 +171,14 @@ inline int fallback_ctz64(ALuint64 value)
{
return fallback_popcnt64(~value & (value - 1));
}
#define CTZ64 fallback_ctz64
#define CTZ64(x) fallback_ctz64(x)
#endif
#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__)
#define IS_LITTLE_ENDIAN (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#else
static const union {
ALuint u;
ALubyte b[sizeof(ALuint)];
} EndianTest = { 1 };
#define IS_LITTLE_ENDIAN (EndianTest.b[0] == 1)
#endif
#define COUNTOF(x) (sizeof(x) / sizeof(0[x]))
@ -263,7 +249,7 @@ inline ALint fastf2i(ALfloat f)
#ifdef __SSE_MATH__
__asm__("cvtss2si %1, %0" : "=r"(i) : "x"(f));
#else
__asm__ __volatile__("fistpl %0" : "=m"(i) : "t"(f) : "st");
__asm__("flds %1\n fistps %0" : "=m"(i) : "m"(f));
#endif
return i;
@ -285,85 +271,8 @@ inline ALint fastf2i(ALfloat f)
/* Converts float-to-int using standard behavior (truncation). */
inline int float2int(float f)
{
#if ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__)) && \
!defined(__SSE_MATH__)) || (defined(_MSC_VER) && defined(_M_IX86_FP) && _M_IX86_FP == 0)
ALint sign, shift, mant;
union {
ALfloat f;
ALint i;
} conv;
conv.f = f;
sign = (conv.i>>31) | 1;
shift = ((conv.i>>23)&0xff) - (127+23);
/* Over/underflow */
if(UNLIKELY(shift >= 31 || shift < -23))
return 0;
mant = (conv.i&0x7fffff) | 0x800000;
if(LIKELY(shift < 0))
return (mant >> -shift) * sign;
return (mant << shift) * sign;
#else
/* TODO: Make a more efficient method for x87. */
return (ALint)f;
#endif
}
/* Rounds a float to the nearest integral value, according to the current
* rounding mode. This is essentially an inlined version of rintf, although
* makes fewer promises (e.g. -0 or -0.25 rounded to 0 may result in +0).
*/
inline float fast_roundf(float f)
{
#if (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__)) && \
!defined(__SSE_MATH__)
float out;
__asm__ __volatile__("frndint" : "=t"(out) : "0"(f));
return out;
#else
/* Integral limit, where sub-integral precision is not available for
* floats.
*/
static const float ilim[2] = {
8388608.0f /* 0x1.0p+23 */,
-8388608.0f /* -0x1.0p+23 */
};
ALuint sign, expo;
union {
ALfloat f;
ALuint i;
} conv;
conv.f = f;
sign = (conv.i>>31)&0x01;
expo = (conv.i>>23)&0xff;
if(UNLIKELY(expo >= 150/*+23*/))
{
/* An exponent (base-2) of 23 or higher is incapable of sub-integral
* precision, so it's already an integral value. We don't need to worry
* about infinity or NaN here.
*/
return f;
}
/* Adding the integral limit to the value (with a matching sign) forces a
* result that has no sub-integral precision, and is consequently forced to
* round to an integral value. Removing the integral limit then restores
* the initial value rounded to the integral. The compiler should not
* optimize this out because of non-associative rules on floating-point
* math (as long as you don't use -fassociative-math,
* -funsafe-math-optimizations, -ffast-math, or -Ofast, in which case this
* may break).
*/
f += ilim[sign];
return f - ilim[sign];
#endif
}
@ -582,7 +491,7 @@ typedef struct DistanceComp {
*/
#define BUFFERSIZE 2048
typedef struct MixParams {
typedef struct DryMixParams {
AmbiConfig Ambi;
/* Number of coefficients in each Ambi.Coeffs to mix together (4 for first-
* order, 9 for second-order, etc). If the count is 0, Ambi.Map is used
@ -592,7 +501,17 @@ typedef struct MixParams {
ALfloat (*Buffer)[BUFFERSIZE];
ALsizei NumChannels;
} MixParams;
ALsizei NumChannelsPerOrder[MAX_AMBI_ORDER+1];
} DryMixParams;
typedef struct BFMixParams {
AmbiConfig Ambi;
/* Will only be 4 or 0. */
ALsizei CoeffCount;
ALfloat (*Buffer)[BUFFERSIZE];
ALsizei NumChannels;
} BFMixParams;
typedef struct RealMixParams {
enum Channel ChannelName[MAX_OUTPUT_CHANNELS];
@ -622,8 +541,6 @@ struct ALCdevice_struct {
enum AmbiLayout AmbiLayout;
enum AmbiNorm AmbiScale;
ALCenum LimiterState;
al_string DeviceName;
ATOMIC(ALCenum) LastError;
@ -678,17 +595,15 @@ struct ALCdevice_struct {
ALuint64 ClockBase;
ALuint SamplesDone;
ALuint FixedLatency;
/* Temp storage used for mixer processing. */
alignas(16) ALfloat TempBuffer[4][BUFFERSIZE];
/* The "dry" path corresponds to the main output. */
MixParams Dry;
ALsizei NumChannelsPerOrder[MAX_AMBI_ORDER+1];
DryMixParams Dry;
/* First-order ambisonics output, to be upsampled to the dry buffer if different. */
MixParams FOAOut;
BFMixParams FOAOut;
/* "Real" output, which will be written to the device buffer. May alias the
* dry buffer.
@ -753,35 +668,21 @@ struct ALCdevice_struct {
enum {
/* End event thread processing. */
EventType_KillThread = 0,
/* User event types. */
EventType_SourceStateChange = 1<<0,
EventType_BufferCompleted = 1<<1,
EventType_Error = 1<<2,
EventType_Performance = 1<<3,
EventType_Deprecated = 1<<4,
EventType_Disconnected = 1<<5,
/* Internal events. */
EventType_ReleaseEffectState = 65536,
};
typedef struct AsyncEvent {
unsigned int EnumType;
union {
char dummy;
struct {
ALenum type;
ALuint id;
ALuint param;
ALchar msg[1008];
} user;
struct ALeffectState *EffectState;
} u;
ALenum Type;
ALuint ObjectId;
ALuint Param;
ALchar Message[1008];
} AsyncEvent;
#define ASYNC_EVENT(t) { t, { 0 } }
struct ALCcontext_struct {
RefCount ref;
@ -834,6 +735,7 @@ struct ALCcontext_struct {
ATOMIC(struct ALeffectslotArray*) ActiveAuxSlots;
almtx_t EventThrdLock;
althrd_t EventThread;
alsem_t EventSem;
struct ll_ringbuffer *AsyncEvents;
@ -863,6 +765,9 @@ void ALCcontext_ProcessUpdates(ALCcontext *context);
void AllocateVoices(ALCcontext *context, ALsizei num_voices, ALsizei old_sends);
void AppendAllDevicesList(const ALCchar *name);
void AppendCaptureDeviceList(const ALCchar *name);
extern ALint RTPrioLevel;
void SetRTPriority(void);
@ -908,9 +813,6 @@ inline void UnlockEffectSlotList(ALCcontext *context)
{ almtx_unlock(&context->EffectSlotLock); }
int EventThread(void *arg);
vector_al_string SearchDataFiles(const char *match, const char *subdir);
#ifdef __cplusplus

View file

@ -74,7 +74,7 @@ extern enum Resampler ResamplerDefault;
typedef struct BsincState {
ALfloat sf; /* Scale interpolation factor. */
ALsizei m; /* Coefficient count. */
ALsizei l; /* Left coefficient offset. */
ALint l; /* Left coefficient offset. */
/* Filter coefficients, followed by the scale, phase, and scale-phase
* delta coefficients. Starting at phase index 0, each subsequent phase
* index follows contiguously.
@ -430,35 +430,14 @@ void aluInitEffectPanning(struct ALeffectslot *slot);
void aluSelectPostProcess(ALCdevice *device);
/**
* Calculates ambisonic encoder coefficients using the X, Y, and Z direction
* components, which must represent a normalized (unit length) vector, and the
* spread is the angular width of the sound (0...tau).
*
* NOTE: The components use ambisonic coordinates. As a result:
*
* Ambisonic Y = OpenAL -X
* Ambisonic Z = OpenAL Y
* Ambisonic X = OpenAL -Z
*
* The components are ordered such that OpenAL's X, Y, and Z are the first,
* second, and third parameters respectively -- simply negate X and Z.
*/
void CalcAmbiCoeffs(const ALfloat y, const ALfloat z, const ALfloat x, const ALfloat spread,
ALfloat coeffs[MAX_AMBI_COEFFS]);
/**
* CalcDirectionCoeffs
*
* Calculates ambisonic coefficients based on an OpenAL direction vector. The
* vector must be normalized (unit length), and the spread is the angular width
* of the sound (0...tau).
* Calculates ambisonic coefficients based on a direction vector. The vector
* must be normalized (unit length), and the spread is the angular width of the
* sound (0...tau).
*/
inline void CalcDirectionCoeffs(const ALfloat dir[3], ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS])
{
/* Convert from OpenAL coords to Ambisonics. */
CalcAmbiCoeffs(-dir[0], dir[1], -dir[2], spread, coeffs);
}
void CalcDirectionCoeffs(const ALfloat dir[3], ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]);
/**
* CalcAngleCoeffs
@ -469,40 +448,34 @@ inline void CalcDirectionCoeffs(const ALfloat dir[3], ALfloat spread, ALfloat co
*/
inline void CalcAngleCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS])
{
ALfloat x = -sinf(azimuth) * cosf(elevation);
ALfloat y = sinf(elevation);
ALfloat z = cosf(azimuth) * cosf(elevation);
CalcAmbiCoeffs(x, y, z, spread, coeffs);
ALfloat dir[3] = {
sinf(azimuth) * cosf(elevation),
sinf(elevation),
-cosf(azimuth) * cosf(elevation)
};
CalcDirectionCoeffs(dir, spread, coeffs);
}
/**
* ScaleAzimuthFront
* CalcAnglePairwiseCoeffs
*
* Scales the given azimuth toward the side (+/- pi/2 radians) for positions in
* front.
* Calculates ambisonic coefficients based on azimuth and elevation. The
* azimuth and elevation parameters are in radians, going right and up
* respectively. This pairwise variant warps the result such that +30 azimuth
* is full right, and -30 azimuth is full left.
*/
inline float ScaleAzimuthFront(float azimuth, float scale)
{
ALfloat sign = copysignf(1.0f, azimuth);
if(!(fabsf(azimuth) > F_PI_2))
return minf(fabsf(azimuth) * scale, F_PI_2) * sign;
return azimuth;
}
void CalcAnglePairwiseCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]);
void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, ALsizei numcoeffs, const ALfloat*restrict coeffs, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat*restrict coeffs, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, ALsizei numcoeffs, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
/**
* ComputePanGains
* ComputeDryPanGains
*
* Computes panning gains using the given channel decoder coefficients and the
* pre-calculated direction or angle coefficients. For B-Format sources, the
* coeffs are a 'slice' of a transform matrix for the input channel, used to
* scale and orient the sound samples.
* pre-calculated direction or angle coefficients.
*/
inline void ComputePanGains(const MixParams *dry, const ALfloat*restrict coeffs, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS])
inline void ComputeDryPanGains(const DryMixParams *dry, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS])
{
if(dry->CoeffCount > 0)
ComputePanningGainsMC(dry->Ambi.Coeffs, dry->NumChannels, dry->CoeffCount,
@ -511,6 +484,23 @@ inline void ComputePanGains(const MixParams *dry, const ALfloat*restrict coeffs,
ComputePanningGainsBF(dry->Ambi.Map, dry->NumChannels, coeffs, ingain, gains);
}
void ComputeFirstOrderGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
void ComputeFirstOrderGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
/**
* ComputeFirstOrderGains
*
* Sets channel gains for a first-order ambisonics input channel. The matrix is
* a 1x4 'slice' of a transform matrix for the input channel, used to scale and
* orient the sound samples.
*/
inline void ComputeFirstOrderGains(const BFMixParams *foa, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS])
{
if(foa->CoeffCount > 0)
ComputeFirstOrderGainsMC(foa->Ambi.Coeffs, foa->NumChannels, mtx, ingain, gains);
else
ComputeFirstOrderGainsBF(foa->Ambi.Map, foa->NumChannels, mtx, ingain, gains);
}
ALboolean MixSource(struct ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsizei SamplesToDo);