aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixer_c.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-09-16 08:14:26 -0700
committerChris Robinson <[email protected]>2012-09-16 08:14:26 -0700
commita240abb6c85189ab9099326e5301b1c640a6398d (patch)
treec7644d811d6b95008af730dcb899dc6b3de4335a /Alc/mixer_c.c
parentdd9d30e2489d938d5ec0d75702c82b943a1b3efa (diff)
Avoid building redundant mixers
Diffstat (limited to 'Alc/mixer_c.c')
-rw-r--r--Alc/mixer_c.c66
1 files changed, 63 insertions, 3 deletions
diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c
index f3e416a0..baef411d 100644
--- a/Alc/mixer_c.c
+++ b/Alc/mixer_c.c
@@ -1,9 +1,9 @@
#include "config.h"
-#include "AL/al.h"
-#include "AL/alc.h"
#include "alMain.h"
#include "alu.h"
+#include "alSource.h"
+#include "alAuxEffectSlot.h"
static __inline ALfloat point32(const ALfloat *vals, ALint step, ALint frac)
@@ -72,7 +72,67 @@ static __inline void ApplyCoeffs(ALuint Offset, ALfloat (*RESTRICT Values)[2],
}
}
-
#define SUFFIX C
#include "mixer_inc.c"
#undef SUFFIX
+
+
+void MixDirect_C(ALsource *Source, ALCdevice *Device, DirectParams *params,
+ const ALfloat *RESTRICT data, ALuint srcchan,
+ ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize)
+{
+ ALfloat (*RESTRICT DryBuffer)[BUFFERSIZE] = Device->DryBuffer;
+ ALfloat *RESTRICT ClickRemoval = Device->ClickRemoval;
+ ALfloat *RESTRICT PendingClicks = Device->PendingClicks;
+ ALfloat DrySend[MaxChannels];
+ ALuint pos;
+ ALuint c;
+ (void)Source;
+
+ for(c = 0;c < MaxChannels;c++)
+ DrySend[c] = params->Gains[srcchan][c];
+
+ pos = 0;
+ if(OutPos == 0)
+ {
+ for(c = 0;c < MaxChannels;c++)
+ ClickRemoval[c] -= data[pos]*DrySend[c];
+ }
+ for(c = 0;c < MaxChannels;c++)
+ {
+ for(pos = 0;pos < BufferSize;pos++)
+ DryBuffer[c][OutPos+pos] += data[pos]*DrySend[c];
+ }
+ if(OutPos+pos == SamplesToDo)
+ {
+ for(c = 0;c < MaxChannels;c++)
+ PendingClicks[c] += data[pos]*DrySend[c];
+ }
+}
+
+
+void MixSend_C(SendParams *params, const ALfloat *RESTRICT data,
+ ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize)
+{
+ ALeffectslot *Slot = params->Slot;
+ ALfloat *WetBuffer = Slot->WetBuffer;
+ ALfloat *WetClickRemoval = Slot->ClickRemoval;
+ ALfloat *WetPendingClicks = Slot->PendingClicks;
+ ALfloat WetSend = params->Gain;
+ ALuint pos;
+
+ pos = 0;
+ if(OutPos == 0)
+ {
+ WetClickRemoval[0] -= data[pos] * WetSend;
+ }
+ for(pos = 0;pos < BufferSize;pos++)
+ {
+ WetBuffer[OutPos] += data[pos] * WetSend;
+ OutPos++;
+ }
+ if(OutPos == SamplesToDo)
+ {
+ WetPendingClicks[0] += data[pos] * WetSend;
+ }
+}