From 8fe39042da3369acb4aa8e5a8837709c4338d0f0 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 3 Jan 2008 05:36:51 -0800 Subject: Add the Bauer stereophonic-to-binaural DSP (bs2b) code and hooks --- Alc/ALu.c | 49 +++++++++-- Alc/bs2b.c | 201 ++++++++++++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 1 + OpenAL32/Include/alMain.h | 2 + OpenAL32/Include/bs2b.h | 109 +++++++++++++++++++++++++ 5 files changed, 354 insertions(+), 8 deletions(-) create mode 100644 Alc/bs2b.c create mode 100644 OpenAL32/Include/bs2b.h diff --git a/Alc/ALu.c b/Alc/ALu.c index cb79ee56..7f5011a9 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -30,6 +30,7 @@ #include "alBuffer.h" #include "alThunk.h" #include "alListener.h" +#include "bs2b.h" #if defined(HAVE_STDINT_H) #include @@ -746,11 +747,27 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma } break; case AL_FORMAT_STEREO8: - for(i = 0;i < SamplesToDo;i++) + if(ALContext->bs2b) { - ((ALubyte*)buffer)[0] = (ALubyte)((aluF2S(DryBuffer[i][FRONT_LEFT] +WetBuffer[i][FRONT_LEFT])>>8)+128); - ((ALubyte*)buffer)[1] = (ALubyte)((aluF2S(DryBuffer[i][FRONT_RIGHT]+WetBuffer[i][FRONT_RIGHT])>>8)+128); - buffer = ((ALubyte*)buffer) + 2; + for(i = 0;i < SamplesToDo;i++) + { + float samples[2]; + samples[0] = DryBuffer[i][FRONT_LEFT] +WetBuffer[i][FRONT_LEFT]; + samples[1] = DryBuffer[i][FRONT_RIGHT]+WetBuffer[i][FRONT_RIGHT]; + bs2b_cross_feed(ALContext->bs2b, samples); + ((ALubyte*)buffer)[0] = (ALubyte)((aluF2S(samples[0])>>8)+128); + ((ALubyte*)buffer)[1] = (ALubyte)((aluF2S(samples[1])>>8)+128); + buffer = ((ALubyte*)buffer) + 2; + } + } + else + { + for(i = 0;i < SamplesToDo;i++) + { + ((ALubyte*)buffer)[0] = (ALubyte)((aluF2S(DryBuffer[i][FRONT_LEFT] +WetBuffer[i][FRONT_LEFT])>>8)+128); + ((ALubyte*)buffer)[1] = (ALubyte)((aluF2S(DryBuffer[i][FRONT_RIGHT]+WetBuffer[i][FRONT_RIGHT])>>8)+128); + buffer = ((ALubyte*)buffer) + 2; + } } break; case AL_FORMAT_QUAD8: @@ -812,11 +829,27 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma } break; case AL_FORMAT_STEREO16: - for(i = 0;i < SamplesToDo;i++) + if(ALContext->bs2b) { - ((ALshort*)buffer)[0] = aluF2S(DryBuffer[i][FRONT_LEFT] +WetBuffer[i][FRONT_LEFT]); - ((ALshort*)buffer)[1] = aluF2S(DryBuffer[i][FRONT_RIGHT]+WetBuffer[i][FRONT_RIGHT]); - buffer = ((ALshort*)buffer) + 2; + for(i = 0;i < SamplesToDo;i++) + { + float samples[2]; + samples[0] = DryBuffer[i][FRONT_LEFT] +WetBuffer[i][FRONT_LEFT]; + samples[1] = DryBuffer[i][FRONT_RIGHT]+WetBuffer[i][FRONT_RIGHT]; + bs2b_cross_feed(ALContext->bs2b, samples); + ((ALshort*)buffer)[0] = aluF2S(samples[0]); + ((ALshort*)buffer)[1] = aluF2S(samples[1]); + buffer = ((ALshort*)buffer) + 2; + } + } + else + { + for(i = 0;i < SamplesToDo;i++) + { + ((ALshort*)buffer)[0] = aluF2S(DryBuffer[i][FRONT_LEFT] +WetBuffer[i][FRONT_LEFT]); + ((ALshort*)buffer)[1] = aluF2S(DryBuffer[i][FRONT_RIGHT]+WetBuffer[i][FRONT_RIGHT]); + buffer = ((ALshort*)buffer) + 2; + } } break; case AL_FORMAT_QUAD16: diff --git a/Alc/bs2b.c b/Alc/bs2b.c new file mode 100644 index 00000000..069ed614 --- /dev/null +++ b/Alc/bs2b.c @@ -0,0 +1,201 @@ +/*- + * Copyright (c) 2005 Boris Mikhaylov + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include + +#include "bs2b.h" + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +/* Single pole IIR filter. + * O[n] = a0*I[n] + a1*I[n-1] + b1*O[n-1] + */ + +/* Lowpass filter */ +#define lo_filter(in, out_1) (bs2b->a0_lo*(in) + bs2b->b1_lo*(out_1)) + +/* Highboost filter */ +#define hi_filter(in, in_1, out_1) (bs2b->a0_hi*(in) + bs2b->a1_hi*(in_1) + bs2b->b1_hi*(out_1)) + +/* Set up all data. */ +static void init(struct bs2b *bs2b) +{ + double Fc_lo, Fc_hi; + double G_lo, G_hi; + double x; + + if ((bs2b->srate > 192000) || (bs2b->srate < 2000)) + bs2b->srate = BS2B_DEFAULT_SRATE; + + switch(bs2b->level) + { + case BS2B_LOW_CLEVEL: /* Low crossfeed level */ + Fc_lo = 360.0; + Fc_hi = 501.0; + G_lo = 0.398107170553497; + G_hi = 0.205671765275719; + break; + + case BS2B_MIDDLE_CLEVEL: /* Middle crossfeed level */ + Fc_lo = 500.0; + Fc_hi = 711.0; + G_lo = 0.459726988530872; + G_hi = 0.228208484414988; + break; + + case BS2B_HIGH_CLEVEL: /* High crossfeed level (virtual speakers are closer to itself) */ + Fc_lo = 700.0; + Fc_hi = 1021.0; + G_lo = 0.530884444230988; + G_hi = 0.250105790667544; + break; + + case BS2B_LOW_ECLEVEL: /* Low easy crossfeed level */ + Fc_lo = 360.0; + Fc_hi = 494.0; + G_lo = 0.316227766016838; + G_hi = 0.168236228897329; + break; + + case BS2B_MIDDLE_ECLEVEL: /* Middle easy crossfeed level */ + Fc_lo = 500.0; + Fc_hi = 689.0; + G_lo = 0.354813389233575; + G_hi = 0.187169483835901; + break; + + default: /* High easy crossfeed level */ + bs2b->level = BS2B_HIGH_ECLEVEL; + + Fc_lo = 700.0; + Fc_hi = 975.0; + G_lo = 0.398107170553497; + G_hi = 0.205671765275719; + break; + } /* switch */ + + /* $fc = $Fc / $s; + * $d = 1 / 2 / pi / $fc; + * $x = exp(-1 / $d); + */ + + x = exp(-2.0 * M_PI * Fc_lo / bs2b->srate); + bs2b->b1_lo = x; + bs2b->a0_lo = G_lo * (1.0 - x); + + x = exp(-2.0 * M_PI * Fc_hi / bs2b->srate); + bs2b->b1_hi = x; + bs2b->a0_hi = 1.0 - G_hi * (1.0 - x); + bs2b->a1_hi = -x; + + bs2b->gain = 1.0 / (1.0 - G_hi + G_lo); + + bs2b_clear(bs2b); +} /* init */ + +/* Exported functions. + * See descriptions in "bs2b.h" + */ + +void bs2b_set_level(struct bs2b *bs2b, int level) +{ + if(level == bs2b->level) + return; + bs2b->level = level; + init(bs2b); +} /* bs2b_set_level */ + +int bs2b_get_level(struct bs2b *bs2b) +{ + return bs2b->level; +} /* bs2b_get_level */ + +void bs2b_set_srate(struct bs2b *bs2b, int srate) +{ + if (srate == bs2b->srate) + return; + bs2b->srate = srate; + init(bs2b); +} /* bs2b_set_srate */ + +int bs2b_get_srate(struct bs2b *bs2b) +{ + return bs2b->srate; +} /* bs2b_get_srate */ + +void bs2b_clear(struct bs2b *bs2b) +{ + int loopv = sizeof(bs2b->last_sample); + + while (loopv) + { + ((char *)&bs2b->last_sample)[--loopv] = 0; + } +} /* bs2b_clear */ + +int bs2b_is_clear(struct bs2b *bs2b) +{ + int loopv = sizeof(bs2b->last_sample); + + while (loopv) + { + if (((char *)&bs2b->last_sample)[--loopv] != 0) + return 0; + } + return 1; +} /* bs2b_is_clear */ + +void bs2b_cross_feed(struct bs2b *bs2b, float *sample) +{ + /* Lowpass filter */ + bs2b->last_sample.lo[0] = lo_filter(sample[0], bs2b->last_sample.lo[0]); + bs2b->last_sample.lo[1] = lo_filter(sample[1], bs2b->last_sample.lo[1]); + + /* Highboost filter */ + bs2b->last_sample.hi[0] = hi_filter(sample[0], bs2b->last_sample.asis[0], bs2b->last_sample.hi[0]); + bs2b->last_sample.hi[1] = hi_filter(sample[1], bs2b->last_sample.asis[1], bs2b->last_sample.hi[1]); + bs2b->last_sample.asis[0] = sample[0]; + bs2b->last_sample.asis[1] = sample[1]; + + /* Crossfeed */ + sample[0] = bs2b->last_sample.hi[0] + bs2b->last_sample.lo[1]; + sample[1] = bs2b->last_sample.hi[1] + bs2b->last_sample.lo[0]; + + /* Bass boost cause allpass attenuation */ + sample[0] *= bs2b->gain; + sample[1] *= bs2b->gain; + + /* Clipping of overloaded samples */ +#if 0 + if (sample[0] > 1.0) + sample[0] = 1.0; + if (sample[0] < -1.0) + sample[0] = -1.0; + if (sample[1] > 1.0) + sample[1] = 1.0; + if (sample[1] < -1.0) + sample[1] = -1.0; +#endif +} /* bs2b_cross_feed */ diff --git a/CMakeLists.txt b/CMakeLists.txt index d7093fa5..dc73a4bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,6 +179,7 @@ SET(ALC_OBJS Alc/ALc.c Alc/alcConfig.c Alc/alcRing.c Alc/alcThread.c + Alc/bs2b.c ) SET(BACKENDS "") diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 3449b57e..d8611a71 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -180,6 +180,8 @@ struct ALCcontext_struct ALCdevice *Device; ALCchar ExtensionList[1024]; + struct bs2b *bs2b; + ALCcontext *next; }; diff --git a/OpenAL32/Include/bs2b.h b/OpenAL32/Include/bs2b.h new file mode 100644 index 00000000..baf50d0c --- /dev/null +++ b/OpenAL32/Include/bs2b.h @@ -0,0 +1,109 @@ +/*- + * Copyright (c) 2005 Boris Mikhaylov + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef BS2B_H +#define BS2B_H + +/* Number of crossfeed levels */ +#define BS2B_CLEVELS 3 + +/* Normal crossfeed levels */ +#define BS2B_HIGH_CLEVEL 3 +#define BS2B_MIDDLE_CLEVEL 2 +#define BS2B_LOW_CLEVEL 1 + +/* Easy crossfeed levels */ +#define BS2B_HIGH_ECLEVEL BS2B_HIGH_CLEVEL + BS2B_CLEVELS +#define BS2B_MIDDLE_ECLEVEL BS2B_MIDDLE_CLEVEL + BS2B_CLEVELS +#define BS2B_LOW_ECLEVEL BS2B_LOW_CLEVEL + BS2B_CLEVELS + +/* Default crossfeed levels */ +#define BS2B_DEFAULT_CLEVEL BS2B_HIGH_ECLEVEL +/* Default sample rate (Hz) */ +#define BS2B_DEFAULT_SRATE 44100 + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +struct bs2b { + int level; /* Crossfeed level */ + int srate; /* Sample rate (Hz) */ + + /* Lowpass IIR filter coefficients */ + double a0_lo; + double b1_lo; + + /* Highboost IIR filter coefficients */ + double a0_hi; + double a1_hi; + double b1_hi; + + /* Global gain against overloading */ + double gain; + + /* Buffer of last filtered sample. + * [0] - first channel, [1] - second channel + */ + struct t_last_sample { + double asis[2]; + double lo[2]; + double hi[2]; + } last_sample; +}; + +/* Clear buffers and set new coefficients with new crossfeed level value. + * level - crossfeed level of *LEVEL values. + */ +void bs2b_set_level(struct bs2b *bs2b, int level); + +/* Return current crossfeed level value */ +int bs2b_get_level(struct bs2b *bs2b); + +/* Clear buffers and set new coefficients with new sample rate value. + * srate - sample rate by Hz. + */ +void bs2b_set_srate(struct bs2b *bs2b, int srate); + +/* Return current sample rate value */ +int bs2b_get_srate(struct bs2b *bs2b); + +/* Clear buffer */ +void bs2b_clear(struct bs2b *bs2b); + +/* Return 1 if buffer is clear */ +int bs2b_is_clear(struct bs2b *bs2b); + +/* Crossfeeds one stereo sample that are pointed by sample. + * [0] - first channel, [1] - second channel. + * Returns crossfided samle by sample pointer. + */ + +/* sample poits to floats */ +void bs2b_cross_feed(struct bs2b *bs2b, float *sample); + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* BS2B_H */ -- cgit v1.2.3 From 4d5885e27bef05004ab16be8da4e93b458b736a9 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 3 Jan 2008 06:02:06 -0800 Subject: Implement a crossfeed config option --- Alc/ALc.c | 14 ++++++++++++++ openalrc.sample | 11 +++++++++++ 2 files changed, 25 insertions(+) diff --git a/Alc/ALc.c b/Alc/ALc.c index 9bd4086d..1a66dc2a 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -32,6 +32,7 @@ #include "alThunk.h" #include "alSource.h" #include "alExtension.h" +#include "bs2b.h" /////////////////////////////////////////////////////// // DEBUG INFORMATION @@ -329,6 +330,8 @@ ALCvoid ProcessContext(ALCcontext *pContext) */ static ALvoid InitContext(ALCcontext *pContext) { + int level; + //Initialise listener pContext->Listener.Gain = 1.0f; pContext->Listener.Position[0] = 0.0f; @@ -361,6 +364,14 @@ static ALvoid InitContext(ALCcontext *pContext) pContext->lNumMonoSources = pContext->Device->MaxNoOfSources - pContext->lNumStereoSources; strcpy(pContext->ExtensionList, "AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_OFFSET"); + + level = GetConfigValueInt(NULL, "cf_level", 0); + if(level > 0 && level <= 6) + { + pContext->bs2b = calloc(1, sizeof(*pContext->bs2b)); + bs2b_set_srate(pContext->bs2b, pContext->Frequency); + bs2b_set_level(pContext->bs2b, level); + } } @@ -394,6 +405,9 @@ static ALCvoid ExitContext(ALCcontext *pContext) //Invalidate context pContext->LastError = AL_NO_ERROR; pContext->InUse = AL_FALSE; + + free(pContext->bs2b); + pContext->bs2b = NULL; } /////////////////////////////////////////////////////// diff --git a/openalrc.sample b/openalrc.sample index cb4b28dc..0e378a84 100644 --- a/openalrc.sample +++ b/openalrc.sample @@ -23,6 +23,17 @@ format = AL_FORMAT_STEREO16 # Sets the output format. Can be one of: # AL_FORMAT_71CHN16 (16-bit 7.1 output) # Default is AL_FORMAT_STEREO16 +cf_level = 0 # Sets the crossfeed level for stereo output. Valid values are: + # 0 - No crossfeed + # 1 - Low crossfeed + # 2 - Middle crossfeed + # 3 - High crossfeed (virtual speakers are closer to itself) + # 4 - Low easy crossfeed + # 5 - Middle easy crossfeed + # 6 - High easy crossfeed + # Default is 0. Users of headphones may want to try various + # settings. Has no effect on non-stereo modes. + frequency = 44100 # Sets the output frequency. Default is 44100 refresh = 0 # Sets the number of frames-per-update. Default is calculated as -- cgit v1.2.3 From b3badbf97d95d84bb0de655275b00e30948e311f Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 4 Jan 2008 14:15:55 -0800 Subject: Use 6 point spatialization for 6.1 and 7.1 output --- Alc/ALu.c | 49 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/Alc/ALu.c b/Alc/ALu.c index 7f5011a9..0b668b65 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -396,9 +396,6 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource, case 4: /* TODO: Add center/lfe channel in spatial calculations? */ case 6: - /* TODO: Special paths for 6.1 and 7.1 output would be nice */ - case 7: - case 8: // Apply a scalar so each individual speaker has more weight PanningLR = 0.5f + (0.5f*Position[0]*1.41421356f); PanningLR = __min(1.0f, PanningLR); @@ -410,15 +407,49 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource, drysend[FRONT_RIGHT] = ConeVolume * ListenerGain * DryMix * aluSqrt(( PanningLR)*(1.0f-PanningFB)); drysend[BACK_LEFT] = ConeVolume * ListenerGain * DryMix * aluSqrt((1.0f-PanningLR)*( PanningFB)); drysend[BACK_RIGHT] = ConeVolume * ListenerGain * DryMix * aluSqrt(( PanningLR)*( PanningFB)); - drysend[SIDE_LEFT] = 0.0f; - drysend[SIDE_RIGHT] = 0.0f; wetsend[FRONT_LEFT] = ListenerGain * WetMix * aluSqrt((1.0f-PanningLR)*(1.0f-PanningFB)); wetsend[FRONT_RIGHT] = ListenerGain * WetMix * aluSqrt(( PanningLR)*(1.0f-PanningFB)); wetsend[BACK_LEFT] = ListenerGain * WetMix * aluSqrt((1.0f-PanningLR)*( PanningFB)); wetsend[BACK_RIGHT] = ListenerGain * WetMix * aluSqrt(( PanningLR)*( PanningFB)); - wetsend[SIDE_LEFT] = 0.0f; - wetsend[SIDE_RIGHT] = 0.0f; break; + case 7: + case 8: + PanningFB = 1.0f - fabs(Position[2]*1.15470054f); + PanningFB = __min(1.0f, PanningFB); + PanningFB = __max(0.0f, PanningFB); + PanningLR = 0.5f + (0.5*Position[0]*((1.0f-PanningFB)*2.0f)); + PanningLR = __min(1.0f, PanningLR); + PanningLR = __max(0.0f, PanningLR); + if(Position[2] > 0.0f) + { + drysend[BACK_LEFT] = ConeVolume * ListenerGain * DryMix * aluSqrt((1.0f-PanningLR)*(1.0f-PanningFB)); + drysend[BACK_RIGHT] = ConeVolume * ListenerGain * DryMix * aluSqrt(( PanningLR)*(1.0f-PanningFB)); + drysend[SIDE_LEFT] = ConeVolume * ListenerGain * DryMix * aluSqrt((1.0f-PanningLR)*( PanningFB)); + drysend[SIDE_RIGHT] = ConeVolume * ListenerGain * DryMix * aluSqrt(( PanningLR)*( PanningFB)); + drysend[FRONT_LEFT] = 0.0f; + drysend[FRONT_RIGHT] = 0.0f; + wetsend[BACK_LEFT] = ListenerGain * WetMix * aluSqrt((1.0f-PanningLR)*(1.0f-PanningFB)); + wetsend[BACK_RIGHT] = ListenerGain * WetMix * aluSqrt(( PanningLR)*(1.0f-PanningFB)); + wetsend[SIDE_LEFT] = ListenerGain * WetMix * aluSqrt((1.0f-PanningLR)*( PanningFB)); + wetsend[SIDE_RIGHT] = ListenerGain * WetMix * aluSqrt(( PanningLR)*( PanningFB)); + wetsend[FRONT_LEFT] = 0.0f; + wetsend[FRONT_RIGHT] = 0.0f; + } + else + { + drysend[FRONT_LEFT] = ConeVolume * ListenerGain * DryMix * aluSqrt((1.0f-PanningLR)*(1.0f-PanningFB)); + drysend[FRONT_RIGHT] = ConeVolume * ListenerGain * DryMix * aluSqrt(( PanningLR)*(1.0f-PanningFB)); + drysend[SIDE_LEFT] = ConeVolume * ListenerGain * DryMix * aluSqrt((1.0f-PanningLR)*( PanningFB)); + drysend[SIDE_RIGHT] = ConeVolume * ListenerGain * DryMix * aluSqrt(( PanningLR)*( PanningFB)); + drysend[BACK_LEFT] = 0.0f; + drysend[BACK_RIGHT] = 0.0f; + wetsend[FRONT_LEFT] = ListenerGain * WetMix * aluSqrt((1.0f-PanningLR)*(1.0f-PanningFB)); + wetsend[FRONT_RIGHT] = ListenerGain * WetMix * aluSqrt(( PanningLR)*(1.0f-PanningFB)); + wetsend[SIDE_LEFT] = ListenerGain * WetMix * aluSqrt((1.0f-PanningLR)*( PanningFB)); + wetsend[SIDE_RIGHT] = ListenerGain * WetMix * aluSqrt(( PanningLR)*( PanningFB)); + wetsend[BACK_LEFT] = 0.0f; + wetsend[BACK_RIGHT] = 0.0f; + } default: break; } @@ -579,19 +610,15 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma //Direct path final mix buffer and panning DryBuffer[j][FRONT_LEFT] += value*DrySend[FRONT_LEFT]; DryBuffer[j][FRONT_RIGHT] += value*DrySend[FRONT_RIGHT]; -#if 0 /* FIXME: Re-enable when proper 6-channel spatialization is used */ DryBuffer[j][SIDE_LEFT] += value*DrySend[SIDE_LEFT]; DryBuffer[j][SIDE_RIGHT] += value*DrySend[SIDE_RIGHT]; -#endif DryBuffer[j][BACK_LEFT] += value*DrySend[BACK_LEFT]; DryBuffer[j][BACK_RIGHT] += value*DrySend[BACK_RIGHT]; //Room path final mix buffer and panning WetBuffer[j][FRONT_LEFT] += value*WetSend[FRONT_LEFT]; WetBuffer[j][FRONT_RIGHT] += value*WetSend[FRONT_RIGHT]; -#if 0 /* FIXME: Re-enable when proper 6-channel spatialization is used */ WetBuffer[j][SIDE_LEFT] += value*WetSend[SIDE_LEFT]; WetBuffer[j][SIDE_RIGHT] += value*WetSend[SIDE_RIGHT]; -#endif WetBuffer[j][BACK_LEFT] += value*WetSend[BACK_LEFT]; WetBuffer[j][BACK_RIGHT] += value*WetSend[BACK_RIGHT]; } -- cgit v1.2.3