diff options
author | Chris Robinson <[email protected]> | 2018-11-14 00:07:50 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-14 00:07:50 -0800 |
commit | b15dcea4bb0a18b1dd5b426a07f237c3c7ff118d (patch) | |
tree | 84476f3deab30700e087201daf897204cad8088a | |
parent | 6ae217d0052bcd1434e573fa16ea325996baf209 (diff) |
Move extern inline declarations to their own C source
-rw-r--r-- | Alc/ALc.c | 19 | ||||
-rw-r--r-- | Alc/ALu.c | 63 | ||||
-rw-r--r-- | Alc/filters/filter.c | 6 | ||||
-rw-r--r-- | Alc/inldefs.c | 122 | ||||
-rw-r--r-- | Alc/mixvoice.c | 3 | ||||
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 3 | ||||
-rw-r--r-- | OpenAL32/alEffect.c | 4 | ||||
-rw-r--r-- | OpenAL32/alFilter.c | 3 |
9 files changed, 123 insertions, 101 deletions
@@ -1304,7 +1304,6 @@ const ALCchar *DevFmtChannelsString(enum DevFmtChannels chans) return "(unknown channels)"; } -extern inline ALsizei FrameSizeFromDevFmt(enum DevFmtChannels chans, enum DevFmtType type, ALsizei ambiorder); ALsizei BytesFromDevFmt(enum DevFmtType type) { switch(type) @@ -1578,24 +1577,6 @@ void SetDefaultChannelOrder(ALCdevice *device) } } -extern inline ALint GetChannelIndex(const enum Channel names[MAX_OUTPUT_CHANNELS], enum Channel chan); -extern inline ALint GetChannelIdxByName(const RealMixParams *real, enum Channel chan); - -/* NOTE: These shouldn't really be here, but C++ (alBuffer.cpp) won't turn - * these extern inline declarations into callable functions. - */ -extern inline void LockBufferList(ALCdevice *device); -extern inline void UnlockBufferList(ALCdevice *device); -extern inline ALsizei FrameSizeFromUserFmt(enum UserFmtChannels chans, enum UserFmtType type); -extern inline ALsizei FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type); - -extern inline ALuint64 GetDeviceClockTime(ALCdevice *device); - -extern inline void alstr_reset(al_string *str); -extern inline size_t alstr_length(const_al_string str); -extern inline ALboolean alstr_empty(const_al_string str); -extern inline const al_string_char_type *alstr_get_cstr(const_al_string str); - /* ALCcontext_DeferUpdates * @@ -49,69 +49,6 @@ #include "backends/base.h" -extern inline ALuint NextPowerOf2(ALuint value); -extern inline size_t RoundUp(size_t value, size_t r); -extern inline ALint fastf2i(ALfloat f); -extern inline int float2int(float f); -extern inline float fast_roundf(float f); -#ifndef __GNUC__ -#if defined(HAVE_BITSCANFORWARD64_INTRINSIC) -extern inline int msvc64_ctz64(ALuint64 v); -#elif defined(HAVE_BITSCANFORWARD_INTRINSIC) -extern inline int msvc_ctz64(ALuint64 v); -#else -extern inline int fallback_popcnt64(ALuint64 v); -extern inline int fallback_ctz64(ALuint64 value); -#endif -#endif - -extern inline ALfloat minf(ALfloat a, ALfloat b); -extern inline ALfloat maxf(ALfloat a, ALfloat b); -extern inline ALfloat clampf(ALfloat val, ALfloat min, ALfloat max); - -extern inline ALdouble mind(ALdouble a, ALdouble b); -extern inline ALdouble maxd(ALdouble a, ALdouble b); -extern inline ALdouble clampd(ALdouble val, ALdouble min, ALdouble max); - -extern inline ALuint minu(ALuint a, ALuint b); -extern inline ALuint maxu(ALuint a, ALuint b); -extern inline ALuint clampu(ALuint val, ALuint min, ALuint max); - -extern inline ALint mini(ALint a, ALint b); -extern inline ALint maxi(ALint a, ALint b); -extern inline ALint clampi(ALint val, ALint min, ALint max); - -extern inline ALint64 mini64(ALint64 a, ALint64 b); -extern inline ALint64 maxi64(ALint64 a, ALint64 b); -extern inline ALint64 clampi64(ALint64 val, ALint64 min, ALint64 max); - -extern inline ALuint64 minu64(ALuint64 a, ALuint64 b); -extern inline ALuint64 maxu64(ALuint64 a, ALuint64 b); -extern inline ALuint64 clampu64(ALuint64 val, ALuint64 min, ALuint64 max); - -extern inline size_t minz(size_t a, size_t b); -extern inline size_t maxz(size_t a, size_t b); -extern inline size_t clampz(size_t val, size_t min, size_t max); - -extern inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu); -extern inline ALfloat cubic(ALfloat val1, ALfloat val2, ALfloat val3, ALfloat val4, ALfloat mu); - -extern inline void aluVectorSet(aluVector *vector, ALfloat x, ALfloat y, ALfloat z, ALfloat w); - -extern inline void aluMatrixfSetRow(aluMatrixf *matrix, ALuint row, - ALfloat m0, ALfloat m1, ALfloat m2, ALfloat m3); -extern inline void aluMatrixfSet(aluMatrixf *matrix, - ALfloat m00, ALfloat m01, ALfloat m02, ALfloat m03, - ALfloat m10, ALfloat m11, ALfloat m12, ALfloat m13, - ALfloat m20, ALfloat m21, ALfloat m22, ALfloat m23, - ALfloat m30, ALfloat m31, ALfloat m32, ALfloat m33); - -extern inline void CalcDirectionCoeffs(const ALfloat dir[3], ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]); -extern inline void CalcAngleCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]); -extern inline float ScaleAzimuthFront(float azimuth, float scale); -extern inline void ComputePanGains(const MixParams *dry, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); - - /* Cone scalar */ ALfloat ConeScale = 1.0f; diff --git a/Alc/filters/filter.c b/Alc/filters/filter.c index d05b0cae..838a9a5d 100644 --- a/Alc/filters/filter.c +++ b/Alc/filters/filter.c @@ -7,12 +7,6 @@ #include "alMain.h" #include "defs.h" -extern inline void BiquadFilter_clear(BiquadFilter *filter); -extern inline void BiquadFilter_copyParams(BiquadFilter *RESTRICT dst, const BiquadFilter *RESTRICT src); -extern inline void BiquadFilter_passthru(BiquadFilter *filter, ALsizei numsamples); -extern inline ALfloat calc_rcpQ_from_slope(ALfloat gain, ALfloat slope); -extern inline ALfloat calc_rcpQ_from_bandwidth(ALfloat f0norm, ALfloat bandwidth); - void BiquadFilter_setParams(BiquadFilter *filter, BiquadType type, ALfloat gain, ALfloat f0norm, ALfloat rcpQ) { diff --git a/Alc/inldefs.c b/Alc/inldefs.c new file mode 100644 index 00000000..dd66da13 --- /dev/null +++ b/Alc/inldefs.c @@ -0,0 +1,122 @@ + +#include "config.h" + +#include "alMain.h" +#include "alu.h" +#include "filters/defs.h" +#include "mixer/defs.h" +#include "alBuffer.h" +#include "alEffect.h" +#include "alstring.h" + +#include "backends/base.h" + +/* This is a place to dump inline function instantiations, to generate function + * bodies for calls that can't be inlined. C++ does not have a way to do this + * explicitly, so as long as there is C code calling inline functions, a body + * must be explicitly instantiated in case of non-inlined calls. + * + * This just makes it easier to keep track of everything, while things are + * converted to C++. + */ + +extern inline ALsizei FrameSizeFromDevFmt(enum DevFmtChannels chans, enum DevFmtType type, ALsizei ambiorder); + +extern inline ALint GetChannelIndex(const enum Channel names[MAX_OUTPUT_CHANNELS], enum Channel chan); +extern inline ALint GetChannelIdxByName(const RealMixParams *real, enum Channel chan); + +extern inline void LockBufferList(ALCdevice *device); +extern inline void UnlockBufferList(ALCdevice *device); +extern inline ALsizei FrameSizeFromUserFmt(enum UserFmtChannels chans, enum UserFmtType type); +extern inline ALsizei FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type); + +extern inline ALuint64 GetDeviceClockTime(ALCdevice *device); + + +extern inline void alstr_reset(al_string *str); +extern inline size_t alstr_length(const_al_string str); +extern inline ALboolean alstr_empty(const_al_string str); +extern inline const al_string_char_type *alstr_get_cstr(const_al_string str); + + +extern inline ALuint NextPowerOf2(ALuint value); +extern inline size_t RoundUp(size_t value, size_t r); +extern inline ALint fastf2i(ALfloat f); +extern inline int float2int(float f); +extern inline float fast_roundf(float f); +#ifndef __GNUC__ +#if defined(HAVE_BITSCANFORWARD64_INTRINSIC) +extern inline int msvc64_ctz64(ALuint64 v); +#elif defined(HAVE_BITSCANFORWARD_INTRINSIC) +extern inline int msvc_ctz64(ALuint64 v); +#else +extern inline int fallback_popcnt64(ALuint64 v); +extern inline int fallback_ctz64(ALuint64 value); +#endif +#endif + +extern inline ALfloat minf(ALfloat a, ALfloat b); +extern inline ALfloat maxf(ALfloat a, ALfloat b); +extern inline ALfloat clampf(ALfloat val, ALfloat min, ALfloat max); + +extern inline ALdouble mind(ALdouble a, ALdouble b); +extern inline ALdouble maxd(ALdouble a, ALdouble b); +extern inline ALdouble clampd(ALdouble val, ALdouble min, ALdouble max); + +extern inline ALuint minu(ALuint a, ALuint b); +extern inline ALuint maxu(ALuint a, ALuint b); +extern inline ALuint clampu(ALuint val, ALuint min, ALuint max); + +extern inline ALint mini(ALint a, ALint b); +extern inline ALint maxi(ALint a, ALint b); +extern inline ALint clampi(ALint val, ALint min, ALint max); + +extern inline ALint64 mini64(ALint64 a, ALint64 b); +extern inline ALint64 maxi64(ALint64 a, ALint64 b); +extern inline ALint64 clampi64(ALint64 val, ALint64 min, ALint64 max); + +extern inline ALuint64 minu64(ALuint64 a, ALuint64 b); +extern inline ALuint64 maxu64(ALuint64 a, ALuint64 b); +extern inline ALuint64 clampu64(ALuint64 val, ALuint64 min, ALuint64 max); + +extern inline size_t minz(size_t a, size_t b); +extern inline size_t maxz(size_t a, size_t b); +extern inline size_t clampz(size_t val, size_t min, size_t max); + +extern inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu); +extern inline ALfloat cubic(ALfloat val1, ALfloat val2, ALfloat val3, ALfloat val4, ALfloat mu); + +extern inline void aluVectorSet(aluVector *vector, ALfloat x, ALfloat y, ALfloat z, ALfloat w); + +extern inline void aluMatrixfSetRow(aluMatrixf *matrix, ALuint row, + ALfloat m0, ALfloat m1, ALfloat m2, ALfloat m3); +extern inline void aluMatrixfSet(aluMatrixf *matrix, + ALfloat m00, ALfloat m01, ALfloat m02, ALfloat m03, + ALfloat m10, ALfloat m11, ALfloat m12, ALfloat m13, + ALfloat m20, ALfloat m21, ALfloat m22, ALfloat m23, + ALfloat m30, ALfloat m31, ALfloat m32, ALfloat m33); + +extern inline void CalcDirectionCoeffs(const ALfloat dir[3], ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]); +extern inline void CalcAngleCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]); +extern inline float ScaleAzimuthFront(float azimuth, float scale); +extern inline void ComputePanGains(const MixParams *dry, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); + +extern inline void BiquadFilter_clear(BiquadFilter *filter); +extern inline void BiquadFilter_copyParams(BiquadFilter *RESTRICT dst, const BiquadFilter *RESTRICT src); +extern inline void BiquadFilter_passthru(BiquadFilter *filter, ALsizei numsamples); +extern inline ALfloat calc_rcpQ_from_slope(ALfloat gain, ALfloat slope); +extern inline ALfloat calc_rcpQ_from_bandwidth(ALfloat f0norm, ALfloat bandwidth); + + +extern inline void LockFilterList(ALCdevice *device); +extern inline void UnlockFilterList(ALCdevice *device); + +extern inline void LockEffectList(ALCdevice *device); +extern inline void UnlockEffectList(ALCdevice *device); +extern inline ALboolean IsReverbEffect(ALenum type); + +extern inline void LockEffectSlotList(ALCcontext *context); +extern inline void UnlockEffectSlotList(ALCcontext *context); + + +extern inline void InitiatePositionArrays(ALsizei frac, ALint increment, ALsizei *RESTRICT frac_arr, ALsizei *RESTRICT pos_arr, ALsizei size); diff --git a/Alc/mixvoice.c b/Alc/mixvoice.c index 587f4a6b..ffbcdb25 100644 --- a/Alc/mixvoice.c +++ b/Alc/mixvoice.c @@ -45,9 +45,6 @@ static_assert((INT_MAX>>FRACTIONBITS)/MAX_PITCH > BUFFERSIZE, "MAX_PITCH and/or BUFFERSIZE are too large for FRACTIONBITS!"); -extern inline void InitiatePositionArrays(ALsizei frac, ALint increment, ALsizei *RESTRICT frac_arr, ALsizei *RESTRICT pos_arr, ALsizei size); - - /* BSinc24 requires up to 23 extra samples before the current position, and 24 after. */ static_assert(MAX_RESAMPLE_PADDING >= 24, "MAX_RESAMPLE_PADDING must be at least 24!"); diff --git a/CMakeLists.txt b/CMakeLists.txt index a822bc0f..11cf7da6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -846,6 +846,7 @@ SET(ALC_OBJS Alc/bs2b.c Alc/converter.c Alc/converter.h + Alc/inldefs.c Alc/inprogext.h Alc/mastering.c Alc/mastering.h diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index 4758646f..297aa1b6 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -35,9 +35,6 @@ #include "almalloc.h" -extern inline void LockEffectSlotList(ALCcontext *context); -extern inline void UnlockEffectSlotList(ALCcontext *context); - static void AddActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *context); static void RemoveActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *context); diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index 05a6c0a3..67214957 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -31,10 +31,6 @@ #include "alError.h" -extern inline void LockEffectList(ALCdevice *device); -extern inline void UnlockEffectList(ALCdevice *device); -extern inline ALboolean IsReverbEffect(ALenum type); - const struct EffectList EffectList[EFFECTLIST_SIZE] = { { "eaxreverb", EAXREVERB_EFFECT, AL_EFFECT_EAXREVERB }, { "reverb", REVERB_EFFECT, AL_EFFECT_REVERB }, diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c index 01da4008..3803fae6 100644 --- a/OpenAL32/alFilter.c +++ b/OpenAL32/alFilter.c @@ -31,9 +31,6 @@ #define FILTER_MIN_GAIN 0.0f #define FILTER_MAX_GAIN 4.0f /* +12dB */ -extern inline void LockFilterList(ALCdevice *device); -extern inline void UnlockFilterList(ALCdevice *device); - static ALfilter *AllocFilter(ALCcontext *context); static void FreeFilter(ALCdevice *device, ALfilter *filter); static void InitFilterParams(ALfilter *filter, ALenum type); |