From f843b7e2e362d3fc521771cdf8847de0a6f3a8d0 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 2 May 2011 02:22:30 -0700 Subject: Implement HRTF mixers for multi-channel sources --- OpenAL32/Include/alSource.h | 4 ++-- OpenAL32/alSource.c | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'OpenAL32') diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index 30b949db..ee342f92 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -87,7 +87,7 @@ typedef struct ALsource ALint lSourceType; /* HRTF info */ - ALfloat HrtfHistory[HRTF_LENGTH]; + ALfloat HrtfHistory[MAXCHANNELS][HRTF_LENGTH]; ALuint HrtfOffset; // Current target parameters used for mixing @@ -95,7 +95,7 @@ typedef struct ALsource struct { ALint Step; - ALfloat HrtfCoeffs[HRTF_LENGTH][2]; + ALfloat HrtfCoeffs[MAXCHANNELS][HRTF_LENGTH][2]; /* A mixing matrix. First subscript is the channel number of the input * data (regardless of channel configuration) and the second is the diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 14beb85f..d6e9b18a 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -1349,8 +1349,12 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources) Source->Buffer = Source->queue->buffer; - for(j = 0;j < HRTF_LENGTH;j++) - Source->HrtfHistory[j] = 0.0f; + for(j = 0;j < MAXCHANNELS;j++) + { + ALuint k; + for(k = 0;k < HRTF_LENGTH;k++) + Source->HrtfHistory[j][k] = 0.0f; + } Source->HrtfOffset = 0; } else -- cgit v1.2.3