aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-05-20 09:36:36 -0700
committerChris Robinson <[email protected]>2011-05-20 09:36:36 -0700
commit35a0430c8134c6a13768cd6bf7b252d24ac9e2aa (patch)
treeddc1e3d248e7a257c4534bfc12943766e2d5d38c /Alc
parent1b5caa4112bf76d6b046d33a65d29d94daf03f43 (diff)
Store the separate effect parameters in a union
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALu.c6
-rw-r--r--Alc/alcDedicated.c4
-rw-r--r--Alc/alcEcho.c10
-rw-r--r--Alc/alcModulator.c11
-rw-r--r--Alc/alcReverb.c76
5 files changed, 55 insertions, 52 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 45caad16..e0546a27 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -423,7 +423,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
if(ALSource->Send[i].Slot &&
(ALSource->Send[i].Slot->effect.type == AL_EFFECT_REVERB ||
ALSource->Send[i].Slot->effect.type == AL_EFFECT_EAXREVERB))
- RoomRolloff[i] += ALSource->Send[i].Slot->effect.Reverb.RoomRolloffFactor;
+ RoomRolloff[i] += ALSource->Send[i].Slot->effect.Params.Reverb.RoomRolloffFactor;
}
switch(ALContext->SourceDistanceModel ? ALSource->DistanceModel :
@@ -570,10 +570,10 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
*/
WetGain[i] *= aluPow(10.0f, EffectiveDist /
(SPEEDOFSOUNDMETRESPERSEC *
- Slot->effect.Reverb.DecayTime) *
+ Slot->effect.Params.Reverb.DecayTime) *
(-60.0/20.0));
- WetGainHF[i] *= aluPow(Slot->effect.Reverb.AirAbsorptionGainHF,
+ WetGainHF[i] *= aluPow(Slot->effect.Params.Reverb.AirAbsorptionGainHF,
AirAbsorptionFactor * EffectiveDist);
}
}
diff --git a/Alc/alcDedicated.c b/Alc/alcDedicated.c
index 4ffc6534..f6fd0f2d 100644
--- a/Alc/alcDedicated.c
+++ b/Alc/alcDedicated.c
@@ -62,7 +62,7 @@ static ALvoid DedicatedDLGUpdate(ALeffectState *effect, ALCcontext *Context, con
SpeakerGain = &device->PanningLUT[MAXCHANNELS * pos];
for(s = 0;s < MAXCHANNELS;s++)
- state->gains[s] = SpeakerGain[s] * Effect->Dedicated.Gain;
+ state->gains[s] = SpeakerGain[s] * Effect->Params.Dedicated.Gain;
}
static ALvoid DedicatedLFEUpdate(ALeffectState *effect, ALCcontext *Context, const ALeffect *Effect)
@@ -73,7 +73,7 @@ static ALvoid DedicatedLFEUpdate(ALeffectState *effect, ALCcontext *Context, con
for(s = 0;s < MAXCHANNELS;s++)
state->gains[s] = 0.0f;
- state->gains[LFE] = Effect->Dedicated.Gain;
+ state->gains[LFE] = Effect->Params.Dedicated.Gain;
}
static ALvoid DedicatedProcess(ALeffectState *effect, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[MAXCHANNELS])
diff --git a/Alc/alcEcho.c b/Alc/alcEcho.c
index 35b94a90..aea2b00a 100644
--- a/Alc/alcEcho.c
+++ b/Alc/alcEcho.c
@@ -107,18 +107,18 @@ static ALvoid EchoUpdate(ALeffectState *effect, ALCcontext *Context, const ALeff
ALuint frequency = Context->Device->Frequency;
ALfloat lrpan, cw, g;
- state->Tap[0].delay = (ALuint)(Effect->Echo.Delay * frequency) + 1;
- state->Tap[1].delay = (ALuint)(Effect->Echo.LRDelay * frequency);
+ state->Tap[0].delay = (ALuint)(Effect->Params.Echo.Delay * frequency) + 1;
+ state->Tap[1].delay = (ALuint)(Effect->Params.Echo.LRDelay * frequency);
state->Tap[1].delay += state->Tap[0].delay;
- lrpan = Effect->Echo.Spread*0.5f + 0.5f;
+ lrpan = Effect->Params.Echo.Spread*0.5f + 0.5f;
state->GainL = aluSqrt( lrpan);
state->GainR = aluSqrt(1.0f-lrpan);
- state->FeedGain = Effect->Echo.Feedback;
+ state->FeedGain = Effect->Params.Echo.Feedback;
cw = cos(2.0*M_PI * LOWPASSFREQCUTOFF / frequency);
- g = 1.0f - Effect->Echo.Damping;
+ g = 1.0f - Effect->Params.Echo.Damping;
state->iirFilter.coeff = lpCoeffCalc(g, cw);
}
diff --git a/Alc/alcModulator.c b/Alc/alcModulator.c
index 11bb7d48..4224ecb4 100644
--- a/Alc/alcModulator.c
+++ b/Alc/alcModulator.c
@@ -108,19 +108,20 @@ static ALvoid ModulatorUpdate(ALeffectState *effect, ALCcontext *Context, const
ALmodulatorState *state = (ALmodulatorState*)effect;
ALfloat cw, a = 0.0f;
- if(Effect->Modulator.Waveform == AL_RING_MODULATOR_SINUSOID)
+ if(Effect->Params.Modulator.Waveform == AL_RING_MODULATOR_SINUSOID)
state->Waveform = SINUSOID;
- else if(Effect->Modulator.Waveform == AL_RING_MODULATOR_SAWTOOTH)
+ else if(Effect->Params.Modulator.Waveform == AL_RING_MODULATOR_SAWTOOTH)
state->Waveform = SAWTOOTH;
- else if(Effect->Modulator.Waveform == AL_RING_MODULATOR_SQUARE)
+ else if(Effect->Params.Modulator.Waveform == AL_RING_MODULATOR_SQUARE)
state->Waveform = SQUARE;
- state->step = Effect->Modulator.Frequency*(1<<WAVEFORM_FRACBITS) /
+ state->step = Effect->Params.Modulator.Frequency*(1<<WAVEFORM_FRACBITS) /
Context->Device->Frequency;
if(!state->step)
state->step = 1;
- cw = cos(2.0*M_PI * Effect->Modulator.HighPassCutoff / Context->Device->Frequency);
+ cw = cos(2.0*M_PI * Effect->Params.Modulator.HighPassCutoff /
+ Context->Device->Frequency);
a = (2.0f-cw) - aluSqrt(aluPow(2.0f-cw, 2.0f) - 1.0f);
state->iirFilter.coeff = a;
}
diff --git a/Alc/alcReverb.c b/Alc/alcReverb.c
index 95b84fdd..4ecf615e 100644
--- a/Alc/alcReverb.c
+++ b/Alc/alcReverb.c
@@ -1070,37 +1070,38 @@ static ALvoid VerbUpdate(ALeffectState *effect, ALCcontext *Context, const ALeff
ALfloat cw, x, y, hfRatio;
// Calculate the master low-pass filter (from the master effect HF gain).
- cw = CalcI3DL2HFreq(Effect->Reverb.HFReference, frequency);
+ cw = CalcI3DL2HFreq(Effect->Params.Reverb.HFReference, frequency);
// This is done with 2 chained 1-pole filters, so no need to square g.
- State->LpFilter.coeff = lpCoeffCalc(Effect->Reverb.GainHF, cw);
+ State->LpFilter.coeff = lpCoeffCalc(Effect->Params.Reverb.GainHF, cw);
// Update the initial effect delay.
- UpdateDelayLine(Effect->Reverb.ReflectionsDelay,
- Effect->Reverb.LateReverbDelay, frequency, State);
+ UpdateDelayLine(Effect->Params.Reverb.ReflectionsDelay,
+ Effect->Params.Reverb.LateReverbDelay, frequency, State);
// Update the early lines.
- UpdateEarlyLines(Effect->Reverb.Gain, Effect->Reverb.ReflectionsGain,
- Effect->Reverb.LateReverbDelay, State);
+ UpdateEarlyLines(Effect->Params.Reverb.Gain, Effect->Params.Reverb.ReflectionsGain,
+ Effect->Params.Reverb.LateReverbDelay, State);
// Update the decorrelator.
- UpdateDecorrelator(Effect->Reverb.Density, frequency, State);
+ UpdateDecorrelator(Effect->Params.Reverb.Density, frequency, State);
// Get the mixing matrix coefficients (x and y).
- CalcMatrixCoeffs(Effect->Reverb.Diffusion, &x, &y);
+ CalcMatrixCoeffs(Effect->Params.Reverb.Diffusion, &x, &y);
// Then divide x into y to simplify the matrix calculation.
State->Late.MixCoeff = y / x;
// If the HF limit parameter is flagged, calculate an appropriate limit
// based on the air absorption parameter.
- hfRatio = Effect->Reverb.DecayHFRatio;
- if(Effect->Reverb.DecayHFLimit && Effect->Reverb.AirAbsorptionGainHF < 1.0f)
- hfRatio = CalcLimitedHfRatio(hfRatio, Effect->Reverb.AirAbsorptionGainHF,
- Effect->Reverb.DecayTime);
+ hfRatio = Effect->Params.Reverb.DecayHFRatio;
+ if(Effect->Params.Reverb.DecayHFLimit &&
+ Effect->Params.Reverb.AirAbsorptionGainHF < 1.0f)
+ hfRatio = CalcLimitedHfRatio(hfRatio, Effect->Params.Reverb.AirAbsorptionGainHF,
+ Effect->Params.Reverb.DecayTime);
// Update the late lines.
- UpdateLateLines(Effect->Reverb.Gain, Effect->Reverb.LateReverbGain,
- x, Effect->Reverb.Density, Effect->Reverb.DecayTime,
- Effect->Reverb.Diffusion, hfRatio, cw, frequency, State);
+ UpdateLateLines(Effect->Params.Reverb.Gain, Effect->Params.Reverb.LateReverbGain,
+ x, Effect->Params.Reverb.Density, Effect->Params.Reverb.DecayTime,
+ Effect->Params.Reverb.Diffusion, hfRatio, cw, frequency, State);
}
// This updates the EAX reverb state. This is called any time the EAX reverb
@@ -1112,51 +1113,52 @@ static ALvoid EAXVerbUpdate(ALeffectState *effect, ALCcontext *Context, const AL
ALfloat cw, x, y, hfRatio;
// Calculate the master low-pass filter (from the master effect HF gain).
- cw = CalcI3DL2HFreq(Effect->Reverb.HFReference, frequency);
+ cw = CalcI3DL2HFreq(Effect->Params.Reverb.HFReference, frequency);
// This is done with 2 chained 1-pole filters, so no need to square g.
- State->LpFilter.coeff = lpCoeffCalc(Effect->Reverb.GainHF, cw);
+ State->LpFilter.coeff = lpCoeffCalc(Effect->Params.Reverb.GainHF, cw);
// Update the modulator line.
- UpdateModulator(Effect->Reverb.ModulationTime,
- Effect->Reverb.ModulationDepth, frequency, State);
+ UpdateModulator(Effect->Params.Reverb.ModulationTime,
+ Effect->Params.Reverb.ModulationDepth, frequency, State);
// Update the initial effect delay.
- UpdateDelayLine(Effect->Reverb.ReflectionsDelay,
- Effect->Reverb.LateReverbDelay, frequency, State);
+ UpdateDelayLine(Effect->Params.Reverb.ReflectionsDelay,
+ Effect->Params.Reverb.LateReverbDelay, frequency, State);
// Update the early lines.
- UpdateEarlyLines(Effect->Reverb.Gain, Effect->Reverb.ReflectionsGain,
- Effect->Reverb.LateReverbDelay, State);
+ UpdateEarlyLines(Effect->Params.Reverb.Gain, Effect->Params.Reverb.ReflectionsGain,
+ Effect->Params.Reverb.LateReverbDelay, State);
// Update the decorrelator.
- UpdateDecorrelator(Effect->Reverb.Density, frequency, State);
+ UpdateDecorrelator(Effect->Params.Reverb.Density, frequency, State);
// Get the mixing matrix coefficients (x and y).
- CalcMatrixCoeffs(Effect->Reverb.Diffusion, &x, &y);
+ CalcMatrixCoeffs(Effect->Params.Reverb.Diffusion, &x, &y);
// Then divide x into y to simplify the matrix calculation.
State->Late.MixCoeff = y / x;
// If the HF limit parameter is flagged, calculate an appropriate limit
// based on the air absorption parameter.
- hfRatio = Effect->Reverb.DecayHFRatio;
- if(Effect->Reverb.DecayHFLimit && Effect->Reverb.AirAbsorptionGainHF < 1.0f)
- hfRatio = CalcLimitedHfRatio(hfRatio, Effect->Reverb.AirAbsorptionGainHF,
- Effect->Reverb.DecayTime);
+ hfRatio = Effect->Params.Reverb.DecayHFRatio;
+ if(Effect->Params.Reverb.DecayHFLimit &&
+ Effect->Params.Reverb.AirAbsorptionGainHF < 1.0f)
+ hfRatio = CalcLimitedHfRatio(hfRatio, Effect->Params.Reverb.AirAbsorptionGainHF,
+ Effect->Params.Reverb.DecayTime);
// Update the late lines.
- UpdateLateLines(Effect->Reverb.Gain, Effect->Reverb.LateReverbGain,
- x, Effect->Reverb.Density, Effect->Reverb.DecayTime,
- Effect->Reverb.Diffusion, hfRatio, cw, frequency, State);
+ UpdateLateLines(Effect->Params.Reverb.Gain, Effect->Params.Reverb.LateReverbGain,
+ x, Effect->Params.Reverb.Density, Effect->Params.Reverb.DecayTime,
+ Effect->Params.Reverb.Diffusion, hfRatio, cw, frequency, State);
// Update the echo line.
- UpdateEchoLine(Effect->Reverb.Gain, Effect->Reverb.LateReverbGain,
- Effect->Reverb.EchoTime, Effect->Reverb.DecayTime,
- Effect->Reverb.Diffusion, Effect->Reverb.EchoDepth,
+ UpdateEchoLine(Effect->Params.Reverb.Gain, Effect->Params.Reverb.LateReverbGain,
+ Effect->Params.Reverb.EchoTime, Effect->Params.Reverb.DecayTime,
+ Effect->Params.Reverb.Diffusion, Effect->Params.Reverb.EchoDepth,
hfRatio, cw, frequency, State);
// Update early and late 3D panning.
- Update3DPanning(Context->Device, Effect->Reverb.ReflectionsPan,
- Effect->Reverb.LateReverbPan, State);
+ Update3DPanning(Context->Device, Effect->Params.Reverb.ReflectionsPan,
+ Effect->Params.Reverb.LateReverbPan, State);
}
// This processes the reverb state, given the input samples and an output