aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixer.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-11-27 00:32:53 -0800
committerChris Robinson <[email protected]>2010-11-27 00:32:53 -0800
commit2a123a4760d853eb300c684a6e3fc14efa86fe57 (patch)
tree6030c7ef916b0df2dec7f9ece405bfa9d790ac73 /Alc/mixer.c
parent4689ffb72d4b068a374901ff5fbfff205b9aa70f (diff)
Support 64-bit double buffers directly
Diffstat (limited to 'Alc/mixer.c')
-rw-r--r--Alc/mixer.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c
index 187ccbe7..6f2bf005 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -37,6 +37,14 @@
#include "bs2b.h"
+static __inline ALdouble point64(const ALdouble *vals, ALint step, ALint frac)
+{ return vals[0]; (void)step; (void)frac; }
+static __inline ALdouble lerp64(const ALdouble *vals, ALint step, ALint frac)
+{ return lerp(vals[0], vals[step], frac * (1.0/FRACTIONONE)); }
+static __inline ALdouble cubic64(const ALdouble *vals, ALint step, ALint frac)
+{ return cubic(vals[-step], vals[0], vals[step], vals[step+step],
+ frac * (1.0/FRACTIONONE)); }
+
static __inline ALdouble point32(const ALfloat *vals, ALint step, ALint frac)
{ return vals[0]; (void)step; (void)frac; }
static __inline ALdouble lerp32(const ALfloat *vals, ALint step, ALint frac)
@@ -195,6 +203,10 @@ static void Mix_##T##_Mono_##sampler(ALsource *Source, ALCdevice *Device, \
*DataPosFrac = frac; \
}
+DECL_TEMPLATE(ALdouble, point64)
+DECL_TEMPLATE(ALdouble, lerp64)
+DECL_TEMPLATE(ALdouble, cubic64)
+
DECL_TEMPLATE(ALfloat, point32)
DECL_TEMPLATE(ALfloat, lerp32)
DECL_TEMPLATE(ALfloat, cubic32)
@@ -348,6 +360,10 @@ static void Mix_##T##_Stereo_##sampler(ALsource *Source, ALCdevice *Device, \
*DataPosFrac = frac; \
}
+DECL_TEMPLATE(ALdouble, point64)
+DECL_TEMPLATE(ALdouble, lerp64)
+DECL_TEMPLATE(ALdouble, cubic64)
+
DECL_TEMPLATE(ALfloat, point32)
DECL_TEMPLATE(ALfloat, lerp32)
DECL_TEMPLATE(ALfloat, cubic32)
@@ -492,6 +508,10 @@ static void Mix_##T##_##chans##_##sampler(ALsource *Source, ALCdevice *Device,\
static const Channel QuadChans[] = { FRONT_LEFT, FRONT_RIGHT,
BACK_LEFT, BACK_RIGHT };
+DECL_TEMPLATE(ALdouble, QuadChans, point64)
+DECL_TEMPLATE(ALdouble, QuadChans, lerp64)
+DECL_TEMPLATE(ALdouble, QuadChans, cubic64)
+
DECL_TEMPLATE(ALfloat, QuadChans, point32)
DECL_TEMPLATE(ALfloat, QuadChans, lerp32)
DECL_TEMPLATE(ALfloat, QuadChans, cubic32)
@@ -508,6 +528,10 @@ DECL_TEMPLATE(ALubyte, QuadChans, cubic8)
static const Channel X51Chans[] = { FRONT_LEFT, FRONT_RIGHT,
FRONT_CENTER, LFE,
BACK_LEFT, BACK_RIGHT };
+DECL_TEMPLATE(ALdouble, X51Chans, point64)
+DECL_TEMPLATE(ALdouble, X51Chans, lerp64)
+DECL_TEMPLATE(ALdouble, X51Chans, cubic64)
+
DECL_TEMPLATE(ALfloat, X51Chans, point32)
DECL_TEMPLATE(ALfloat, X51Chans, lerp32)
DECL_TEMPLATE(ALfloat, X51Chans, cubic32)
@@ -525,6 +549,10 @@ static const Channel X61Chans[] = { FRONT_LEFT, FRONT_RIGHT,
FRONT_CENTER, LFE,
BACK_CENTER,
SIDE_LEFT, SIDE_RIGHT };
+DECL_TEMPLATE(ALdouble, X61Chans, point64)
+DECL_TEMPLATE(ALdouble, X61Chans, lerp64)
+DECL_TEMPLATE(ALdouble, X61Chans, cubic64)
+
DECL_TEMPLATE(ALfloat, X61Chans, point32)
DECL_TEMPLATE(ALfloat, X61Chans, lerp32)
DECL_TEMPLATE(ALfloat, X61Chans, cubic32)
@@ -542,6 +570,10 @@ static const Channel X71Chans[] = { FRONT_LEFT, FRONT_RIGHT,
FRONT_CENTER, LFE,
BACK_LEFT, BACK_RIGHT,
SIDE_LEFT, SIDE_RIGHT };
+DECL_TEMPLATE(ALdouble, X71Chans, point64)
+DECL_TEMPLATE(ALdouble, X71Chans, lerp64)
+DECL_TEMPLATE(ALdouble, X71Chans, cubic64)
+
DECL_TEMPLATE(ALfloat, X71Chans, point32)
DECL_TEMPLATE(ALfloat, X71Chans, lerp32)
DECL_TEMPLATE(ALfloat, X71Chans, cubic32)
@@ -598,6 +630,10 @@ static void Mix_##T##_##sampler(ALsource *Source, ALCdevice *Device, \
} \
}
+DECL_TEMPLATE(ALdouble, point64)
+DECL_TEMPLATE(ALdouble, lerp64)
+DECL_TEMPLATE(ALdouble, cubic64)
+
DECL_TEMPLATE(ALfloat, point32)
DECL_TEMPLATE(ALfloat, lerp32)
DECL_TEMPLATE(ALfloat, cubic32)
@@ -638,6 +674,12 @@ static void Mix_##sampler(ALsource *Source, ALCdevice *Device, \
Data, DataPosInt, DataPosFrac, \
OutPos, SamplesToDo, BufferSize); \
break; \
+ \
+ case FmtDouble: \
+ Mix_ALdouble_##sampler##64(Source, Device, FmtChannels, \
+ Data, DataPosInt, DataPosFrac, \
+ OutPos, SamplesToDo, BufferSize); \
+ break; \
} \
}