aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALu.c24
-rw-r--r--Alc/panning.c40
-rw-r--r--OpenAL32/Include/alAuxEffectSlot.h2
-rw-r--r--OpenAL32/Include/alMain.h4
-rw-r--r--OpenAL32/Include/alu.h2
5 files changed, 47 insertions, 25 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index b679b3ca..5823bd5f 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -537,8 +537,8 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A
for(c = 0;c < num_channels;c++)
{
const ALeffectslot *Slot = SendSlots[i];
- ComputeFirstOrderGains(Slot->AmbiCoeffs, Slot->NumChannels, matrix.m[c],
- WetGain[i], voice->Send[i].Gains[c].Target);
+ ComputeFirstOrderGainsBF(Slot->ChanMap, Slot->NumChannels, matrix.m[c],
+ WetGain[i], voice->Send[i].Gains[c].Target);
}
}
}
@@ -579,8 +579,8 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A
else
{
const ALeffectslot *Slot = SendSlots[i];
- ComputePanningGains(Slot->AmbiCoeffs, Slot->NumChannels, coeffs,
- WetGain[i], voice->Send[i].Gains[c].Target);
+ ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs,
+ WetGain[i], voice->Send[i].Gains[c].Target);
}
}
}
@@ -636,8 +636,8 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A
else
{
const ALeffectslot *Slot = SendSlots[i];
- ComputePanningGains(Slot->AmbiCoeffs, Slot->NumChannels, coeffs,
- WetGain[i], voice->Send[i].Gains[c].Target);
+ ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs,
+ WetGain[i], voice->Send[i].Gains[c].Target);
}
}
}
@@ -697,8 +697,8 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A
else
{
const ALeffectslot *Slot = SendSlots[i];
- ComputePanningGains(Slot->AmbiCoeffs, Slot->NumChannels, coeffs,
- WetGain[i], voice->Send[i].Gains[c].Target);
+ ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs,
+ WetGain[i], voice->Send[i].Gains[c].Target);
}
}
}
@@ -1136,8 +1136,8 @@ ALvoid CalcSourceParams(ALvoice *voice, const ALsource *ALSource, const ALCconte
else
{
const ALeffectslot *Slot = SendSlots[i];
- ComputePanningGains(Slot->AmbiCoeffs, Slot->NumChannels, coeffs,
- WetGain[i], voice->Send[i].Gains[0].Target);
+ ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs,
+ WetGain[i], voice->Send[i].Gains[0].Target);
}
}
@@ -1198,8 +1198,8 @@ ALvoid CalcSourceParams(ALvoice *voice, const ALsource *ALSource, const ALCconte
else
{
const ALeffectslot *Slot = SendSlots[i];
- ComputePanningGains(Slot->AmbiCoeffs, Slot->NumChannels, coeffs,
- WetGain[i], voice->Send[i].Gains[0].Target);
+ ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs,
+ WetGain[i], voice->Send[i].Gains[0].Target);
}
}
diff --git a/Alc/panning.c b/Alc/panning.c
index fb707b2e..9248bb86 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -179,6 +179,16 @@ void ComputePanningGains(const ChannelConfig *chancoeffs, ALuint numchans, const
gains[i] = 0.0f;
}
+void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALuint numchans, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS])
+{
+ ALuint i;
+
+ for(i = 0;i < numchans;i++)
+ gains[i] = chanmap[i].Scale * coeffs[chanmap[i].Index] * ingain;
+ for(;i < MAX_OUTPUT_CHANNELS;i++)
+ gains[i] = 0.0f;
+}
+
void ComputeFirstOrderGains(const ChannelConfig *chancoeffs, ALuint numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS])
{
ALuint i, j;
@@ -194,6 +204,16 @@ void ComputeFirstOrderGains(const ChannelConfig *chancoeffs, ALuint numchans, co
gains[i] = 0.0f;
}
+void ComputeFirstOrderGainsBF(const BFChannelConfig *chanmap, ALuint numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS])
+{
+ ALuint i;
+
+ for(i = 0;i < numchans;i++)
+ gains[i] = chanmap[i].Scale * mtx[chanmap[i].Index] * ingain;
+ for(;i < MAX_OUTPUT_CHANNELS;i++)
+ gains[i] = 0.0f;
+}
+
DECL_CONST static inline const char *GetLabelFromChannel(enum Channel channel)
{
@@ -936,19 +956,15 @@ no_hrtf:
void aluInitEffectPanning(ALeffectslot *slot)
{
- static const ChannelMap FirstOrderN3D[4] = {
- { Aux0, { 1.0f, 0.0f, 0.0f, 0.0f } },
- { Aux1, { 0.0f, 1.0f, 0.0f, 0.0f } },
- { Aux2, { 0.0f, 0.0f, 1.0f, 0.0f } },
- { Aux3, { 0.0f, 0.0f, 0.0f, 1.0f } },
- };
- static const enum Channel AmbiChannels[MAX_OUTPUT_CHANNELS] = {
- Aux0, Aux1, Aux2, Aux3, InvalidChannel
- };
+ ALuint i;
- memset(slot->AmbiCoeffs, 0, sizeof(slot->AmbiCoeffs));
+ memset(slot->ChanMap, 0, sizeof(slot->ChanMap));
slot->NumChannels = 0;
- SetChannelMap(AmbiChannels, slot->AmbiCoeffs, FirstOrderN3D, COUNTOF(FirstOrderN3D),
- &slot->NumChannels, AL_FALSE);
+ for(i = 0;i < MAX_EFFECT_CHANNELS;i++)
+ {
+ slot->ChanMap[i].Scale = 1.0f;
+ slot->ChanMap[i].Index = i;
+ }
+ slot->NumChannels = i;
}
diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h
index 2c9a83e5..7c939efb 100644
--- a/OpenAL32/Include/alAuxEffectSlot.h
+++ b/OpenAL32/Include/alAuxEffectSlot.h
@@ -86,7 +86,7 @@ typedef struct ALeffectslot {
ALuint id;
ALuint NumChannels;
- ChannelConfig AmbiCoeffs[MAX_EFFECT_CHANNELS];
+ BFChannelConfig ChanMap[MAX_EFFECT_CHANNELS];
/* Wet buffer configuration is ACN channel order with N3D scaling:
* * Channel 0 is the unattenuated mono signal.
* * Channel 1 is OpenAL -X
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 909c42cd..9ba6d050 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -407,6 +407,10 @@ enum RenderMode {
#define MAX_AMBI_COEFFS ((MAX_AMBI_ORDER+1) * (MAX_AMBI_ORDER+1))
typedef ALfloat ChannelConfig[MAX_AMBI_COEFFS];
+typedef struct BFChannelConfig {
+ ALfloat Scale;
+ ALuint Index;
+} BFChannelConfig;
#define HRTF_HISTORY_BITS (6)
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 81f1cb77..2869722b 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -338,6 +338,7 @@ void ComputeAmbientGains(const ChannelConfig *chancoeffs, ALuint numchans, ALflo
* pre-calculated direction or angle coefficients.
*/
void ComputePanningGains(const ChannelConfig *chancoeffs, ALuint numchans, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
+void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALuint numchans, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
/**
* ComputeFirstOrderGains
@@ -347,6 +348,7 @@ void ComputePanningGains(const ChannelConfig *chancoeffs, ALuint numchans, const
* orient the sound samples.
*/
void ComputeFirstOrderGains(const ChannelConfig *chancoeffs, ALuint numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
+void ComputeFirstOrderGainsBF(const BFChannelConfig *chanmap, ALuint numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
ALvoid UpdateContextSources(ALCcontext *context);