aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-09-26 01:15:27 -0700
committerChris Robinson <[email protected]>2010-09-26 01:15:27 -0700
commit9fbd6c6c3f0e4c486cdf37823369959e43ac88c3 (patch)
treea0a4480d2b088e26fbf48a7dedcd68bd455a64fe
parent08fdc5fa98c96035b4c2c1c873bfa15895542ef2 (diff)
Make the SourceMix function a method of the ALsource struct
-rw-r--r--Alc/mixer.c13
-rw-r--r--OpenAL32/Include/alSource.h7
-rw-r--r--OpenAL32/Include/alu.h4
-rw-r--r--OpenAL32/alSource.c6
4 files changed, 21 insertions, 9 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c
index 0b25c4d4..8504d388 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -601,9 +601,9 @@ static __inline ALfloat cos_lerp16(ALfloat val1, ALfloat val2, ALint frac)
} while(0)
-static ALvoid MixSource(ALsource *Source, ALfloat (*DryBuffer)[OUTPUTCHANNELS],
- ALuint SamplesToDo, ALfloat *ClickRemoval,
- ALfloat *PendingClicks)
+ALvoid MixSource(ALsource *Source, ALuint SamplesToDo,
+ ALfloat (*DryBuffer)[OUTPUTCHANNELS],
+ ALfloat *ClickRemoval, ALfloat *PendingClicks)
{
ALbufferlistitem *BufferListItem;
ALint64 DataSize64,DataPos64;
@@ -749,9 +749,6 @@ static ALvoid MixSource(ALsource *Source, ALfloat (*DryBuffer)[OUTPUTCHANNELS],
Source->Buffer = BufferListItem->buffer;
}
-#undef DO_MIX_MC
-#undef DO_MIX_STEREO
-#undef DO_MIX_MONO
ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
{
@@ -809,8 +806,8 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
(*src)->NeedsUpdate = AL_FALSE;
}
- MixSource(*src, DryBuffer, SamplesToDo,
- device->ClickRemoval, device->PendingClicks);
+ ALsource_Mix(*src, SamplesToDo, DryBuffer,
+ device->ClickRemoval, device->PendingClicks);
src++;
}
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index dbbc445f..448c9acc 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -96,12 +96,17 @@ typedef struct ALsource
FILTER iirFilter;
ALfloat history[OUTPUTCHANNELS*2];
} Params;
+
ALvoid (*Update)(struct ALsource *self, const ALCcontext *context);
+ ALvoid (*Mix)(struct ALsource *self, ALuint SamplesToDo,
+ ALfloat (*DryBuffer)[OUTPUTCHANNELS],
+ ALfloat *ClickRemoval, ALfloat *PendingClicks);
// Index to itself
ALuint source;
} ALsource;
-#define ALsource_Update(s,a) ((s)->Update(s,a))
+#define ALsource_Update(s,a) ((s)->Update(s,a))
+#define ALsource_Mix(s,a,b,c,d) ((s)->Mix(s,a,b,c,d))
ALvoid ReleaseALSources(ALCcontext *Context);
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index c77a0129..9f742e24 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -189,6 +189,10 @@ ALvoid aluInitPanning(ALCdevice *Device);
ALvoid CalcSourceParams(struct ALsource *ALSource, const ALCcontext *ALContext);
ALvoid CalcNonAttnSourceParams(struct ALsource *ALSource, const ALCcontext *ALContext);
+ALvoid MixSource(struct ALsource *Source, ALuint SamplesToDo,
+ ALfloat (*DryBuffer)[OUTPUTCHANNELS],
+ ALfloat *ClickRemoval, ALfloat *PendingClicks);
+
ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size);
ALvoid aluHandleDisconnect(ALCdevice *device);
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 3b877926..f64bf9e6 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -563,6 +563,8 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue)
else
Source->Update = CalcNonAttnSourceParams;
+ Source->Mix = MixSource;
+
// Increment reference counter for buffer
buffer->refcount++;
}
@@ -1593,10 +1595,14 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A
{
Frequency = buffer->frequency;
Format = buffer->eOriginalFormat;
+
if(aluChannelsFromFormat(buffer->format) == 1)
Source->Update = CalcSourceParams;
else
Source->Update = CalcNonAttnSourceParams;
+
+ Source->Mix = MixSource;
+
Source->NeedsUpdate = AL_TRUE;
}
else if(Frequency != buffer->frequency || Format != buffer->eOriginalFormat)