zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
alcReverb.c File Reference
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "alMain.h"
#include "alu.h"
#include "alAuxEffectSlot.h"
#include "alEffect.h"
#include "alFilter.h"
#include "alError.h"

Go to the source code of this file.

Typedefs

typedef struct ALverbState ALverbState
 
typedef struct DelayLine DelayLine
 

Functions

static ALboolean AllocLines (ALuint frequency, ALverbState *State)
 
static __inline ALfloat AllpassInOut (DelayLine *Delay, ALuint outOffset, ALuint inOffset, ALfloat in, ALfloat feedCoeff, ALfloat coeff)
 
static __inline ALfloat AttenuatedDelayLineOut (DelayLine *Delay, ALuint offset, ALfloat coeff)
 
static __inline ALfloat CalcDampingCoeff (ALfloat hfRatio, ALfloat length, ALfloat decayTime, ALfloat decayCoeff, ALfloat cw)
 
static __inline ALfloat CalcDecayCoeff (ALfloat length, ALfloat decayTime)
 
static __inline ALfloat CalcDecayLength (ALfloat coeff, ALfloat decayTime)
 
static __inline ALfloat CalcDensityGain (ALfloat a)
 
static __inline ALfloat CalcI3DL2HFreq (ALfloat hfRef, ALuint frequency)
 
static ALfloat CalcLimitedHfRatio (ALfloat hfRatio, ALfloat airAbsorptionGainHF, ALfloat decayTime)
 
static ALuint CalcLineLength (ALfloat length, ALintptrEXT offset, ALuint frequency, DelayLine *Delay)
 
static __inline ALvoid CalcMatrixCoeffs (ALfloat diffusion, ALfloat *x, ALfloat *y)
 
static __inline ALvoid DelayLineIn (DelayLine *Delay, ALuint offset, ALfloat in)
 
static __inline ALfloat DelayLineOut (DelayLine *Delay, ALuint offset)
 
static __inline ALfloat EarlyDelayLineOut (ALverbState *State, ALuint index)
 
static __inline ALvoid EarlyReflection (ALverbState *State, ALfloat in, ALfloat *RESTRICT out)
 
static __inline ALvoid EAXEcho (ALverbState *State, ALfloat in, ALfloat *RESTRICT late)
 
static __inline ALfloat EAXModulation (ALverbState *State, ALfloat in)
 
static __inline ALvoid EAXVerbPass (ALverbState *State, ALfloat in, ALfloat *RESTRICT early, ALfloat *RESTRICT late)
 
static ALvoid EAXVerbProcess (ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat(*RESTRICT SamplesOut)[BUFFERSIZE])
 
static __inline ALfloat LateAllPassInOut (ALverbState *State, ALuint index, ALfloat in)
 
static __inline ALfloat LateDelayLineOut (ALverbState *State, ALuint index)
 
static __inline ALfloat LateLowPassInOut (ALverbState *State, ALuint index, ALfloat in)
 
static __inline ALvoid LateReverb (ALverbState *State, const ALfloat *RESTRICT in, ALfloat *RESTRICT out)
 
static __inline ALvoid RealizeLineOffset (ALfloat *sampleBuffer, DelayLine *Delay)
 
ALeffectStateReverbCreate (void)
 
static ALvoid ReverbDestroy (ALeffectState *effect)
 
static ALboolean ReverbDeviceUpdate (ALeffectState *effect, ALCdevice *Device)
 
static ALvoid ReverbUpdate (ALeffectState *effect, ALCdevice *Device, const ALeffectslot *Slot)
 
static ALvoid Update3DPanning (const ALCdevice *Device, const ALfloat *ReflectionsPan, const ALfloat *LateReverbPan, ALfloat Gain, ALverbState *State)
 
static ALvoid UpdateDecorrelator (ALfloat density, ALuint frequency, ALverbState *State)
 
static ALvoid UpdateDelayLine (ALfloat earlyDelay, ALfloat lateDelay, ALuint frequency, ALverbState *State)
 
static ALvoid UpdateEarlyLines (ALfloat reverbGain, ALfloat earlyGain, ALfloat lateDelay, ALverbState *State)
 
static ALvoid UpdateEchoLine (ALfloat reverbGain, ALfloat lateGain, ALfloat echoTime, ALfloat decayTime, ALfloat diffusion, ALfloat echoDepth, ALfloat hfRatio, ALfloat cw, ALuint frequency, ALverbState *State)
 
static ALvoid UpdateLateLines (ALfloat reverbGain, ALfloat lateGain, ALfloat xMix, ALfloat density, ALfloat decayTime, ALfloat diffusion, ALfloat hfRatio, ALfloat cw, ALuint frequency, ALverbState *State)
 
static ALvoid UpdateModulator (ALfloat modTime, ALfloat modDepth, ALuint frequency, ALverbState *State)
 
static __inline ALvoid VerbPass (ALverbState *State, ALfloat in, ALfloat *RESTRICT out)
 
static ALvoid VerbProcess (ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat(*RESTRICT SamplesOut)[BUFFERSIZE])
 

Variables

static const ALfloat ALLPASS_LINE_LENGTH [4]
 
static const ALfloat DECO_FRACTION = 0.15f
 
static const ALfloat DECO_MULTIPLIER = 2.0f
 
static const ALfloat EARLY_LINE_LENGTH [4]
 
static const ALfloat ECHO_ALLPASS_LENGTH = 0.0133f
 
ALboolean EmulateEAXReverb = AL_FALSE
 
static const ALfloat LATE_LINE_LENGTH [4]
 
static const ALfloat LATE_LINE_MULTIPLIER = 4.0f
 
static const ALfloat MODULATION_DEPTH_COEFF = 0.1f
 
static const ALfloat MODULATION_FILTER_COEFF = 0.048f
 
static const ALfloat MODULATION_FILTER_CONST = 100000.0f
 
ALfloat ReverbBoost = 1.0f
 

Typedef Documentation

typedef struct ALverbState ALverbState
typedef struct DelayLine DelayLine

Reverb for the OpenAL cross platform audio library Copyright (C) 2008-2009 by Christopher Fitzgerald. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Or go to http://www.gnu.org/copyleft/lgpl.html

Function Documentation

static __inline ALfloat AllpassInOut ( DelayLine Delay,
ALuint  outOffset,
ALuint  inOffset,
ALfloat  in,
ALfloat  feedCoeff,
ALfloat  coeff 
)
static

Definition at line 242 of file alcReverb.c.

References DelayLineIn(), and DelayLineOut().

Referenced by EAXEcho(), and LateAllPassInOut().

static __inline ALfloat AttenuatedDelayLineOut ( DelayLine Delay,
ALuint  offset,
ALfloat  coeff 
)
static

Definition at line 236 of file alcReverb.c.

Referenced by EarlyDelayLineOut(), EAXEcho(), and LateDelayLineOut().

static __inline ALfloat CalcDampingCoeff ( ALfloat  hfRatio,
ALfloat  length,
ALfloat  decayTime,
ALfloat  decayCoeff,
ALfloat  cw 
)
static

Definition at line 838 of file alcReverb.c.

References CalcDecayCoeff(), lpCoeffCalc(), and minf().

Referenced by UpdateEchoLine(), and UpdateLateLines().

static __inline ALfloat CalcDecayCoeff ( ALfloat  length,
ALfloat  decayTime 
)
static

Definition at line 763 of file alcReverb.c.

Referenced by CalcDampingCoeff(), UpdateEarlyLines(), UpdateEchoLine(), and UpdateLateLines().

static __inline ALfloat CalcDecayLength ( ALfloat  coeff,
ALfloat  decayTime 
)
static

Definition at line 770 of file alcReverb.c.

Referenced by CalcLimitedHfRatio().

static __inline ALfloat CalcDensityGain ( ALfloat  a)
static

Definition at line 784 of file alcReverb.c.

Referenced by UpdateEchoLine(), and UpdateLateLines().

static __inline ALfloat CalcI3DL2HFreq ( ALfloat  hfRef,
ALuint  frequency 
)
static

Definition at line 777 of file alcReverb.c.

References F_PI.

Referenced by ReverbUpdate().

static ALfloat CalcLimitedHfRatio ( ALfloat  hfRatio,
ALfloat  airAbsorptionGainHF,
ALfloat  decayTime 
)
static

Definition at line 819 of file alcReverb.c.

References CalcDecayLength(), clampf(), and SPEEDOFSOUNDMETRESPERSEC.

Referenced by ReverbUpdate().

static ALuint CalcLineLength ( ALfloat  length,
ALintptrEXT  offset,
ALuint  frequency,
DelayLine Delay 
)
static

Definition at line 619 of file alcReverb.c.

References fastf2u(), and NextPowerOf2().

Referenced by AllocLines().

static __inline ALvoid CalcMatrixCoeffs ( ALfloat  diffusion,
ALfloat x,
ALfloat y 
)
static

Definition at line 803 of file alcReverb.c.

Referenced by ReverbUpdate().

static __inline ALvoid DelayLineIn ( DelayLine Delay,
ALuint  offset,
ALfloat  in 
)
static
static __inline ALfloat DelayLineOut ( DelayLine Delay,
ALuint  offset 
)
static

Definition at line 225 of file alcReverb.c.

Referenced by AllpassInOut(), EAXModulation(), EAXVerbPass(), and VerbPass().

static __inline ALfloat EarlyDelayLineOut ( ALverbState State,
ALuint  index 
)
static

Definition at line 295 of file alcReverb.c.

References AttenuatedDelayLineOut().

Referenced by EarlyReflection().

static __inline ALvoid EarlyReflection ( ALverbState State,
ALfloat  in,
ALfloat *RESTRICT  out 
)
static

Definition at line 304 of file alcReverb.c.

References d, DelayLineIn(), and EarlyDelayLineOut().

Referenced by EAXVerbPass(), and VerbPass().

static __inline ALvoid EAXEcho ( ALverbState State,
ALfloat  in,
ALfloat *RESTRICT  late 
)
static

Definition at line 446 of file alcReverb.c.

References AllpassInOut(), AttenuatedDelayLineOut(), DelayLineIn(), and lerp().

Referenced by EAXVerbPass().

static __inline ALfloat EAXModulation ( ALverbState State,
ALfloat  in 
)
static

Definition at line 258 of file alcReverb.c.

References DelayLineIn(), DelayLineOut(), F_PI, fastf2u(), and lerp().

Referenced by EAXVerbPass().

static __inline ALvoid EAXVerbPass ( ALverbState State,
ALfloat  in,
ALfloat *RESTRICT  early,
ALfloat *RESTRICT  late 
)
static
static ALvoid EAXVerbProcess ( ALeffectState effect,
ALuint  SamplesToDo,
const ALfloat *RESTRICT  SamplesIn,
ALfloat(*)  SamplesOut[BUFFERSIZE] 
)
static

Definition at line 581 of file alcReverb.c.

References EAXVerbPass(), and MaxChannels.

Referenced by ReverbUpdate().

static __inline ALfloat LateAllPassInOut ( ALverbState State,
ALuint  index,
ALfloat  in 
)
static

Definition at line 349 of file alcReverb.c.

References AllpassInOut().

Referenced by LateReverb().

static __inline ALfloat LateDelayLineOut ( ALverbState State,
ALuint  index 
)
static

Definition at line 358 of file alcReverb.c.

References AttenuatedDelayLineOut().

Referenced by LateReverb().

static __inline ALfloat LateLowPassInOut ( ALverbState State,
ALuint  index,
ALfloat  in 
)
static

Definition at line 366 of file alcReverb.c.

References lerp().

Referenced by LateReverb().

static __inline ALvoid LateReverb ( ALverbState State,
const ALfloat *RESTRICT  in,
ALfloat *RESTRICT  out 
)
static

Definition at line 375 of file alcReverb.c.

References d, DelayLineIn(), LateAllPassInOut(), LateDelayLineOut(), and LateLowPassInOut().

Referenced by EAXVerbPass(), and VerbPass().

static __inline ALvoid RealizeLineOffset ( ALfloat sampleBuffer,
DelayLine Delay 
)
static

Definition at line 613 of file alcReverb.c.

Referenced by AllocLines().

ALeffectState* ReverbCreate ( void  )
static ALvoid ReverbDestroy ( ALeffectState effect)
static

Definition at line 1175 of file alcReverb.c.

References free, and NULL.

Referenced by ReverbCreate().

static ALvoid Update3DPanning ( const ALCdevice Device,
const ALfloat ReflectionsPan,
const ALfloat LateReverbPan,
ALfloat  Gain,
ALverbState State 
)
static

Definition at line 1031 of file alcReverb.c.

References ComputeAngleGains(), F_PI, lerp(), MaxChannels, minf(), ALCdevice_struct::NumChan, and ReverbBoost.

Referenced by ReverbUpdate().

static ALvoid UpdateDecorrelator ( ALfloat  density,
ALuint  frequency,
ALverbState State 
)
static

Definition at line 920 of file alcReverb.c.

References DECO_FRACTION, DECO_MULTIPLIER, fastf2u(), LATE_LINE_LENGTH, and LATE_LINE_MULTIPLIER.

Referenced by ReverbUpdate().

static ALvoid UpdateDelayLine ( ALfloat  earlyDelay,
ALfloat  lateDelay,
ALuint  frequency,
ALverbState State 
)
static

Definition at line 895 of file alcReverb.c.

References fastf2u().

Referenced by ReverbUpdate().

static ALvoid UpdateEarlyLines ( ALfloat  reverbGain,
ALfloat  earlyGain,
ALfloat  lateDelay,
ALverbState State 
)
static

Definition at line 903 of file alcReverb.c.

References CalcDecayCoeff(), and EARLY_LINE_LENGTH.

Referenced by ReverbUpdate().

static ALvoid UpdateEchoLine ( ALfloat  reverbGain,
ALfloat  lateGain,
ALfloat  echoTime,
ALfloat  decayTime,
ALfloat  diffusion,
ALfloat  echoDepth,
ALfloat  hfRatio,
ALfloat  cw,
ALuint  frequency,
ALverbState State 
)
static

Definition at line 999 of file alcReverb.c.

References CalcDampingCoeff(), CalcDecayCoeff(), CalcDensityGain(), ECHO_ALLPASS_LENGTH, and fastf2u().

Referenced by ReverbUpdate().

static ALvoid UpdateLateLines ( ALfloat  reverbGain,
ALfloat  lateGain,
ALfloat  xMix,
ALfloat  density,
ALfloat  decayTime,
ALfloat  diffusion,
ALfloat  hfRatio,
ALfloat  cw,
ALuint  frequency,
ALverbState State 
)
static
static ALvoid UpdateModulator ( ALfloat  modTime,
ALfloat  modDepth,
ALuint  frequency,
ALverbState State 
)
static

Definition at line 865 of file alcReverb.c.

References fastf2u(), maxu(), and MODULATION_DEPTH_COEFF.

Referenced by ReverbUpdate().

static __inline ALvoid VerbPass ( ALverbState State,
ALfloat  in,
ALfloat *RESTRICT  out 
)
static

Definition at line 480 of file alcReverb.c.

References DelayLineIn(), DelayLineOut(), EarlyReflection(), LateReverb(), and lpFilter2P().

Referenced by VerbProcess().

static ALvoid VerbProcess ( ALeffectState effect,
ALuint  SamplesToDo,
const ALfloat *RESTRICT  SamplesIn,
ALfloat(*)  SamplesOut[BUFFERSIZE] 
)
static

Definition at line 558 of file alcReverb.c.

References MaxChannels, and VerbPass().

Referenced by ReverbCreate(), and ReverbUpdate().

Variable Documentation

const ALfloat ALLPASS_LINE_LENGTH[4]
static
Initial value:
=
{
0.0151f, 0.0167f, 0.0183f, 0.0200f,
}

Definition at line 208 of file alcReverb.c.

Referenced by AllocLines(), ReverbDeviceUpdate(), and UpdateLateLines().

const ALfloat DECO_FRACTION = 0.15f
static

Definition at line 196 of file alcReverb.c.

Referenced by AllocLines(), and UpdateDecorrelator().

const ALfloat DECO_MULTIPLIER = 2.0f
static

Definition at line 197 of file alcReverb.c.

Referenced by AllocLines(), and UpdateDecorrelator().

const ALfloat EARLY_LINE_LENGTH[4]
static
Initial value:
=
{
0.0015f, 0.0045f, 0.0135f, 0.0405f
}

Definition at line 202 of file alcReverb.c.

Referenced by AllocLines(), ReverbDeviceUpdate(), and UpdateEarlyLines().

const ALfloat ECHO_ALLPASS_LENGTH = 0.0133f
static

Definition at line 191 of file alcReverb.c.

Referenced by AllocLines(), ReverbDeviceUpdate(), and UpdateEchoLine().

ALboolean EmulateEAXReverb = AL_FALSE

Definition at line 171 of file alcReverb.c.

Referenced by alc_initconfig(), and ReverbUpdate().

const ALfloat LATE_LINE_LENGTH[4]
static
Initial value:
=
{
0.0211f, 0.0311f, 0.0461f, 0.0680f
}

Definition at line 214 of file alcReverb.c.

Referenced by AllocLines(), UpdateDecorrelator(), and UpdateLateLines().

const ALfloat LATE_LINE_MULTIPLIER = 4.0f
static

Definition at line 221 of file alcReverb.c.

Referenced by AllocLines(), UpdateDecorrelator(), and UpdateLateLines().

const ALfloat MODULATION_DEPTH_COEFF = 0.1f
static

Definition at line 179 of file alcReverb.c.

Referenced by AllocLines(), and UpdateModulator().

const ALfloat MODULATION_FILTER_COEFF = 0.048f
static

Definition at line 186 of file alcReverb.c.

Referenced by ReverbDeviceUpdate().

const ALfloat MODULATION_FILTER_CONST = 100000.0f
static

Definition at line 187 of file alcReverb.c.

Referenced by ReverbDeviceUpdate().

ALfloat ReverbBoost = 1.0f

Definition at line 168 of file alcReverb.c.

Referenced by alc_initconfig(), ReverbUpdate(), and Update3DPanning().