aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-11-04 13:44:46 -0800
committerChris Robinson <[email protected]>2013-11-04 13:44:46 -0800
commitd3c70e63b4a42c92f8229f3c9e7f21a2048b6b9d (patch)
tree31b5ca98a42f4d1e51d0fd76bf7040a1c2e8da44 /OpenAL32
parent551f893ae910c2b1b72c0a22aeab1ede75d3e5ed (diff)
Use C99 inline in more places
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alMain.h34
-rw-r--r--OpenAL32/Include/alu.h36
-rw-r--r--OpenAL32/alAuxEffectSlot.c3
-rw-r--r--OpenAL32/alBuffer.c2
-rw-r--r--OpenAL32/alEffect.c2
-rw-r--r--OpenAL32/alFilter.c2
-rw-r--r--OpenAL32/alSource.c3
7 files changed, 47 insertions, 35 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 78528e6e..13e11446 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -145,8 +145,8 @@ struct Hrtf;
#define MIN_OUTPUT_RATE (8000)
-// Find the next power-of-2 for non-power-of-2 numbers.
-static inline ALuint NextPowerOf2(ALuint value)
+/* Find the next power-of-2 for non-power-of-2 numbers. */
+inline ALuint NextPowerOf2(ALuint value)
{
if(value > 0)
{
@@ -162,7 +162,7 @@ static inline ALuint NextPowerOf2(ALuint value)
/* Fast float-to-int conversion. Assumes the FPU is already in round-to-zero
* mode. */
-static inline ALint fastf2i(ALfloat f)
+inline ALint fastf2i(ALfloat f)
{
#ifdef HAVE_LRINTF
return lrintf(f);
@@ -178,7 +178,7 @@ static inline ALint fastf2i(ALfloat f)
/* Fast float-to-uint conversion. Assumes the FPU is already in round-to-zero
* mode. */
-static inline ALuint fastf2u(ALfloat f)
+inline ALuint fastf2u(ALfloat f)
{ return fastf2i(f); }
@@ -304,7 +304,7 @@ enum DevFmtChannels {
ALuint BytesFromDevFmt(enum DevFmtType type);
ALuint ChannelsFromDevFmt(enum DevFmtChannels chans);
-static inline ALuint FrameSizeFromDevFmt(enum DevFmtChannels chans, enum DevFmtType type)
+inline ALuint FrameSizeFromDevFmt(enum DevFmtChannels chans, enum DevFmtType type)
{
return ChannelsFromDevFmt(chans) * BytesFromDevFmt(type);
}
@@ -432,18 +432,18 @@ struct ALCdevice_struct
#define MIXER_THREAD_NAME "alsoft-mixer"
-static inline struct ALbuffer *LookupBuffer(ALCdevice *device, ALuint id)
+inline struct ALbuffer *LookupBuffer(ALCdevice *device, ALuint id)
{ return (struct ALbuffer*)LookupUIntMapKey(&device->BufferMap, id); }
-static inline struct ALeffect *LookupEffect(ALCdevice *device, ALuint id)
+inline struct ALeffect *LookupEffect(ALCdevice *device, ALuint id)
{ return (struct ALeffect*)LookupUIntMapKey(&device->EffectMap, id); }
-static inline struct ALfilter *LookupFilter(ALCdevice *device, ALuint id)
+inline struct ALfilter *LookupFilter(ALCdevice *device, ALuint id)
{ return (struct ALfilter*)LookupUIntMapKey(&device->FilterMap, id); }
-static inline struct ALbuffer *RemoveBuffer(ALCdevice *device, ALuint id)
+inline struct ALbuffer *RemoveBuffer(ALCdevice *device, ALuint id)
{ return (struct ALbuffer*)RemoveUIntMapKey(&device->BufferMap, id); }
-static inline struct ALeffect *RemoveEffect(ALCdevice *device, ALuint id)
+inline struct ALeffect *RemoveEffect(ALCdevice *device, ALuint id)
{ return (struct ALeffect*)RemoveUIntMapKey(&device->EffectMap, id); }
-static inline struct ALfilter *RemoveFilter(ALCdevice *device, ALuint id)
+inline struct ALfilter *RemoveFilter(ALCdevice *device, ALuint id)
{ return (struct ALfilter*)RemoveUIntMapKey(&device->FilterMap, id); }
@@ -482,14 +482,14 @@ struct ALCcontext_struct
ALCcontext *volatile next;
};
-static inline struct ALsource *LookupSource(ALCcontext *context, ALuint id)
+inline struct ALsource *LookupSource(ALCcontext *context, ALuint id)
{ return (struct ALsource*)LookupUIntMapKey(&context->SourceMap, id); }
-static inline struct ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id)
+inline struct ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id)
{ return (struct ALeffectslot*)LookupUIntMapKey(&context->EffectSlotMap, id); }
-static inline struct ALsource *RemoveSource(ALCcontext *context, ALuint id)
+inline struct ALsource *RemoveSource(ALCcontext *context, ALuint id)
{ return (struct ALsource*)RemoveUIntMapKey(&context->SourceMap, id); }
-static inline struct ALeffectslot *RemoveEffectSlot(ALCcontext *context, ALuint id)
+inline struct ALeffectslot *RemoveEffectSlot(ALCcontext *context, ALuint id)
{ return (struct ALeffectslot*)RemoveUIntMapKey(&context->EffectSlotMap, id); }
@@ -509,10 +509,10 @@ void ALCdevice_Lock(ALCdevice *device);
void ALCdevice_Unlock(ALCdevice *device);
ALint64 ALCdevice_GetLatency(ALCdevice *device);
-static inline void LockContext(ALCcontext *context)
+inline void LockContext(ALCcontext *context)
{ ALCdevice_Lock(context->Device); }
-static inline void UnlockContext(ALCcontext *context)
+inline void UnlockContext(ALCcontext *context)
{ ALCdevice_Unlock(context->Device); }
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 55b8edd1..075d5569 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -57,47 +57,47 @@ typedef ALvoid (*WetMixerFunc)(const struct SendParams *params,
#define FRACTIONMASK (FRACTIONONE-1)
-static inline ALfloat minf(ALfloat a, ALfloat b)
+inline ALfloat minf(ALfloat a, ALfloat b)
{ return ((a > b) ? b : a); }
-static inline ALfloat maxf(ALfloat a, ALfloat b)
+inline ALfloat maxf(ALfloat a, ALfloat b)
{ return ((a > b) ? a : b); }
-static inline ALfloat clampf(ALfloat val, ALfloat min, ALfloat max)
+inline ALfloat clampf(ALfloat val, ALfloat min, ALfloat max)
{ return minf(max, maxf(min, val)); }
-static inline ALuint minu(ALuint a, ALuint b)
+inline ALuint minu(ALuint a, ALuint b)
{ return ((a > b) ? b : a); }
-static inline ALuint maxu(ALuint a, ALuint b)
+inline ALuint maxu(ALuint a, ALuint b)
{ return ((a > b) ? a : b); }
-static inline ALuint clampu(ALuint val, ALuint min, ALuint max)
+inline ALuint clampu(ALuint val, ALuint min, ALuint max)
{ return minu(max, maxu(min, val)); }
-static inline ALint mini(ALint a, ALint b)
+inline ALint mini(ALint a, ALint b)
{ return ((a > b) ? b : a); }
-static inline ALint maxi(ALint a, ALint b)
+inline ALint maxi(ALint a, ALint b)
{ return ((a > b) ? a : b); }
-static inline ALint clampi(ALint val, ALint min, ALint max)
+inline ALint clampi(ALint val, ALint min, ALint max)
{ return mini(max, maxi(min, val)); }
-static inline ALint64 mini64(ALint64 a, ALint64 b)
+inline ALint64 mini64(ALint64 a, ALint64 b)
{ return ((a > b) ? b : a); }
-static inline ALint64 maxi64(ALint64 a, ALint64 b)
+inline ALint64 maxi64(ALint64 a, ALint64 b)
{ return ((a > b) ? a : b); }
-static inline ALint64 clampi64(ALint64 val, ALint64 min, ALint64 max)
+inline ALint64 clampi64(ALint64 val, ALint64 min, ALint64 max)
{ return mini64(max, maxi64(min, val)); }
-static inline ALuint64 minu64(ALuint64 a, ALuint64 b)
+inline ALuint64 minu64(ALuint64 a, ALuint64 b)
{ return ((a > b) ? b : a); }
-static inline ALuint64 maxu64(ALuint64 a, ALuint64 b)
+inline ALuint64 maxu64(ALuint64 a, ALuint64 b)
{ return ((a > b) ? a : b); }
-static inline ALuint64 clampu64(ALuint64 val, ALuint64 min, ALuint64 max)
+inline ALuint64 clampu64(ALuint64 val, ALuint64 min, ALuint64 max)
{ return minu64(max, maxu64(min, val)); }
-static inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu)
+inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu)
{
return val1 + (val2-val1)*mu;
}
-static inline ALfloat cubic(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALfloat mu)
+inline ALfloat cubic(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALfloat mu)
{
ALfloat mu2 = mu*mu;
ALfloat a0 = -0.5f*val0 + 1.5f*val1 + -1.5f*val2 + 0.5f*val3;
@@ -124,7 +124,7 @@ void ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat hwidth, A
*
* Helper to set the appropriate channels to the specified gain.
*/
-static inline void SetGains(const ALCdevice *device, ALfloat ingain, ALfloat gains[MaxChannels])
+inline void SetGains(const ALCdevice *device, ALfloat ingain, ALfloat gains[MaxChannels])
{
ComputeAngleGains(device, 0.0f, F_PI, ingain, gains);
}
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index c55637a4..aa071de2 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -32,6 +32,9 @@
#include "alSource.h"
+extern inline struct ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id);
+extern inline struct ALeffectslot *RemoveEffectSlot(ALCcontext *context, ALuint id);
+
static ALenum AddEffectSlotArray(ALCcontext *Context, ALsizei count, const ALuint *slots);
static ALvoid RemoveEffectSlotArray(ALCcontext *Context, ALeffectslot *slot);
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c
index 51e9cc7c..d9c91c2f 100644
--- a/OpenAL32/alBuffer.c
+++ b/OpenAL32/alBuffer.c
@@ -32,6 +32,8 @@
#include "alThunk.h"
+extern inline struct ALbuffer *LookupBuffer(ALCdevice *device, ALuint id);
+extern inline struct ALbuffer *RemoveBuffer(ALCdevice *device, ALuint id);
extern inline ALuint FrameSizeFromUserFmt(enum UserFmtChannels chans, enum UserFmtType type);
extern inline ALuint FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type);
diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c
index 1413ef6e..c9e5928f 100644
--- a/OpenAL32/alEffect.c
+++ b/OpenAL32/alEffect.c
@@ -34,6 +34,8 @@
ALboolean DisabledEffects[MAX_EFFECTS];
+extern inline struct ALeffect *LookupEffect(ALCdevice *device, ALuint id);
+extern inline struct ALeffect *RemoveEffect(ALCdevice *device, ALuint id);
extern inline ALboolean IsReverbEffect(ALenum type);
static void InitEffectParams(ALeffect *effect, ALenum type);
diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c
index 85d411f0..692109f5 100644
--- a/OpenAL32/alFilter.c
+++ b/OpenAL32/alFilter.c
@@ -29,6 +29,8 @@
#include "alError.h"
+extern inline struct ALfilter *LookupFilter(ALCdevice *device, ALuint id);
+extern inline struct ALfilter *RemoveFilter(ALCdevice *device, ALuint id);
extern inline ALfloat ALfilterState_processSingle(ALfilterState *filter, ALfloat sample);
extern inline ALfloat ALfilterState_processSingleC(const ALfilterState *filter, ALfloat sample);
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index cae60cc2..57ff0090 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -47,6 +47,9 @@ const ALsizei ResamplerPrePadding[ResamplerMax] = {
};
+extern inline struct ALsource *LookupSource(ALCcontext *context, ALuint id);
+extern inline struct ALsource *RemoveSource(ALCcontext *context, ALuint id);
+
static ALvoid InitSourceParams(ALsource *Source);
static ALint64 GetSourceOffset(const ALsource *Source);
static ALdouble GetSourceSecOffset(const ALsource *Source);