aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-01-16 12:18:59 -0800
committerChris Robinson <[email protected]>2018-01-16 12:18:59 -0800
commite80b016cbedd500bec7119005537bdc92231e667 (patch)
tree63ee233e7c454d45581e0e5e0d940819a7bafd52
parent8c19497340951aceb88d4f91038cafece6f00d7c (diff)
Use a global RowMixerFunc
-rw-r--r--Alc/bformatdec.c25
-rw-r--r--Alc/effects/reverb.c10
-rw-r--r--Alc/mixer.c4
-rw-r--r--OpenAL32/Include/alu.h2
4 files changed, 10 insertions, 31 deletions
diff --git a/Alc/bformatdec.c b/Alc/bformatdec.c
index ae1f7381..0e79fd3f 100644
--- a/Alc/bformatdec.c
+++ b/Alc/bformatdec.c
@@ -185,17 +185,6 @@ static const ALfloat Ambi3DDecoder[8][FB_Max][MAX_AMBI_COEFFS] = {
};
-static RowMixerFunc MixMatrixRow = MixRow_C;
-
-
-static alonce_flag bformatdec_inited = AL_ONCE_FLAG_INIT;
-
-static void init_bformatdec(void)
-{
- MixMatrixRow = SelectRowMixer();
-}
-
-
/* NOTE: BandSplitter filters are unused with single-band decoding */
typedef struct BFormatDec {
ALboolean Enabled[MAX_OUTPUT_CHANNELS];
@@ -225,7 +214,6 @@ typedef struct BFormatDec {
BFormatDec *bformatdec_alloc()
{
- alcall_once(&bformatdec_inited, init_bformatdec);
return al_calloc(16, sizeof(BFormatDec));
}
@@ -432,10 +420,10 @@ void bformatdec_process(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BU
continue;
memset(dec->ChannelMix, 0, SamplesToDo*sizeof(ALfloat));
- MixMatrixRow(dec->ChannelMix, dec->Matrix.Dual[chan][FB_HighFreq],
+ MixRowSamples(dec->ChannelMix, dec->Matrix.Dual[chan][FB_HighFreq],
dec->SamplesHF, dec->NumChannels, 0, SamplesToDo
);
- MixMatrixRow(dec->ChannelMix, dec->Matrix.Dual[chan][FB_LowFreq],
+ MixRowSamples(dec->ChannelMix, dec->Matrix.Dual[chan][FB_LowFreq],
dec->SamplesLF, dec->NumChannels, 0, SamplesToDo
);
@@ -451,8 +439,8 @@ void bformatdec_process(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BU
continue;
memset(dec->ChannelMix, 0, SamplesToDo*sizeof(ALfloat));
- MixMatrixRow(dec->ChannelMix, dec->Matrix.Single[chan], InSamples,
- dec->NumChannels, 0, SamplesToDo);
+ MixRowSamples(dec->ChannelMix, dec->Matrix.Single[chan], InSamples,
+ dec->NumChannels, 0, SamplesToDo);
for(i = 0;i < SamplesToDo;i++)
OutBuffer[chan][i] += dec->ChannelMix[i];
@@ -486,7 +474,7 @@ void bformatdec_upSample(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[B
);
/* Now write each band to the output. */
- MixMatrixRow(OutBuffer[i], dec->UpSampler[i].Gains,
+ MixRowSamples(OutBuffer[i], dec->UpSampler[i].Gains,
dec->Samples, FB_Max, 0, SamplesToDo
);
}
@@ -517,7 +505,6 @@ typedef struct AmbiUpsampler {
AmbiUpsampler *ambiup_alloc()
{
- alcall_once(&bformatdec_inited, init_bformatdec);
return al_calloc(16, sizeof(AmbiUpsampler));
}
@@ -601,7 +588,7 @@ void ambiup_process(struct AmbiUpsampler *ambiup, ALfloat (*restrict OutBuffer)[
);
for(j = 0;j < OutChannels;j++)
- MixMatrixRow(OutBuffer[j], ambiup->Gains[i][j],
+ MixRowSamples(OutBuffer[j], ambiup->Gains[i][j],
ambiup->Samples, FB_Max, 0, SamplesToDo
);
}
diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c
index 85f55880..7729caec 100644
--- a/Alc/effects/reverb.c
+++ b/Alc/effects/reverb.c
@@ -57,14 +57,6 @@ ALfloat ReverbBoost = 1.0f;
#define NUM_LINES 4
-static RowMixerFunc MixRowSamples = MixRow_C;
-
-static alonce_flag mixfunc_inited = AL_ONCE_FLAG_INIT;
-static void init_mixfunc(void)
-{
- MixRowSamples = SelectRowMixer();
-}
-
/* The B-Format to A-Format conversion matrix. The arrangement of rows is
* deliberately chosen to align the resulting lines to their spatial opposites
* (0:above front left <-> 3:above back right, 1:below front right <-> 2:below
@@ -1760,8 +1752,6 @@ static ALeffectState *ALreverbStateFactory_create(ALreverbStateFactory* UNUSED(f
{
ALreverbState *state;
- alcall_once(&mixfunc_inited, init_mixfunc);
-
NEW_OBJ0(state, ALreverbState)();
if(!state) return NULL;
diff --git a/Alc/mixer.c b/Alc/mixer.c
index 76e5f759..a63bd909 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -53,6 +53,7 @@ static_assert(MAX_RESAMPLE_PADDING >= 24, "MAX_RESAMPLE_PADDING must be at least
enum Resampler ResamplerDefault = LinearResampler;
MixerFunc MixSamples = Mix_C;
+RowMixerFunc MixRowSamples = MixRow_C;
static HrtfMixerFunc MixHrtfSamples = MixHrtf_C;
static HrtfMixerBlendFunc MixHrtfBlendSamples = MixHrtfBlend_C;
@@ -69,7 +70,7 @@ static MixerFunc SelectMixer(void)
return Mix_C;
}
-RowMixerFunc SelectRowMixer(void)
+static RowMixerFunc SelectRowMixer(void)
{
#ifdef HAVE_NEON
if((CPUCapFlags&CPU_CAP_NEON))
@@ -187,6 +188,7 @@ void aluInitMixer(void)
MixHrtfBlendSamples = SelectHrtfBlendMixer();
MixHrtfSamples = SelectHrtfMixer();
MixSamples = SelectMixer();
+ MixRowSamples = SelectRowMixer();
}
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index a6e0efa8..f6462cd4 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -418,7 +418,6 @@ void aluInit(void);
void aluInitMixer(void);
-RowMixerFunc SelectRowMixer(void);
ResamplerFunc SelectResampler(enum Resampler resampler);
/* aluInitRenderer
@@ -526,6 +525,7 @@ void aluHandleDisconnect(ALCdevice *device);
void UpdateContextProps(ALCcontext *context);
extern MixerFunc MixSamples;
+extern RowMixerFunc MixRowSamples;
extern ALfloat ConeScale;
extern ALfloat ZScale;