zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
alu.h File Reference
#include "alMain.h"
#include <limits.h>
#include <math.h>

Go to the source code of this file.

Macros

#define AIRABSORBGAINHF   (0.99426f) /* -0.05dB */
 
#define F_PI   (3.14159265358979323846f) /* pi */
 
#define F_PI_2   (1.57079632679489661923f) /* pi/2 */
 
#define FLT_EPSILON   (1.19209290e-07f)
 
#define FRACTIONBITS   (14)
 
#define FRACTIONMASK   (FRACTIONONE-1)
 
#define FRACTIONONE   (1<<FRACTIONBITS)
 
#define SPEEDOFSOUNDMETRESPERSEC   (343.3f)
 

Typedefs

typedef ALvoid(* DryMixerFunc )(const struct DirectParams *params, const ALfloat *RESTRICT data, ALuint srcchan, ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize)
 
typedef void(* ResamplerFunc )(const ALfloat *src, ALuint frac, ALuint increment, ALfloat *RESTRICT dst, ALuint dstlen)
 
typedef ALvoid(* WetMixerFunc )(const struct SendParams *params, const ALfloat *RESTRICT data, ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize)
 

Functions

ALvoid aluHandleDisconnect (ALCdevice *device)
 
ALvoid aluInitPanning (ALCdevice *Device)
 
ALvoid aluMixData (ALCdevice *device, ALvoid *buffer, ALsizei size)
 
ALvoid CalcNonAttnSourceParams (struct ALsource *ALSource, const ALCcontext *ALContext)
 
ALvoid CalcSourceParams (struct ALsource *ALSource, const ALCcontext *ALContext)
 
static __inline ALfloat clampf (ALfloat val, ALfloat min, ALfloat max)
 
static __inline ALint clampi (ALint val, ALint min, ALint max)
 
static __inline ALint64 clampi64 (ALint64 val, ALint64 min, ALint64 max)
 
static __inline ALuint clampu (ALuint val, ALuint min, ALuint max)
 
static __inline ALuint64 clampu64 (ALuint64 val, ALuint64 min, ALuint64 max)
 
ALvoid ComputeAngleGains (const ALCdevice *device, ALfloat angle, ALfloat hwidth, ALfloat ingain, ALfloat *gains)
 
static __inline ALfloat cubic (ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALfloat mu)
 
static __inline ALfloat lerp (ALfloat val1, ALfloat val2, ALfloat mu)
 
static __inline ALfloat maxf (ALfloat a, ALfloat b)
 
static __inline ALint maxi (ALint a, ALint b)
 
static __inline ALint64 maxi64 (ALint64 a, ALint64 b)
 
static __inline ALuint maxu (ALuint a, ALuint b)
 
static __inline ALuint64 maxu64 (ALuint64 a, ALuint64 b)
 
static __inline ALfloat minf (ALfloat a, ALfloat b)
 
static __inline ALint mini (ALint a, ALint b)
 
static __inline ALint64 mini64 (ALint64 a, ALint64 b)
 
static __inline ALuint minu (ALuint a, ALuint b)
 
static __inline ALuint64 minu64 (ALuint64 a, ALuint64 b)
 
ALvoid MixSource (struct ALsource *Source, ALCdevice *Device, ALuint SamplesToDo)
 

Variables

ALfloat ConeScale
 
ALfloat ZScale
 

Macro Definition Documentation

#define AIRABSORBGAINHF   (0.99426f) /* -0.05dB */

Definition at line 47 of file alu.h.

Referenced by CalcSourceParams().

#define F_PI_2   (1.57079632679489661923f) /* pi/2 */

Definition at line 17 of file alu.h.

Referenced by CalcEvIndices().

#define FLT_EPSILON   (1.19209290e-07f)

Definition at line 20 of file alu.h.

Referenced by CalcSourceParams().

#define FRACTIONBITS   (14)
#define FRACTIONMASK   (FRACTIONONE-1)

Definition at line 51 of file alu.h.

Referenced by MixSource().

#define SPEEDOFSOUNDMETRESPERSEC   (343.3f)

Definition at line 46 of file alu.h.

Referenced by CalcLimitedHfRatio(), CalcSourceParams(), and InitContext().

Typedef Documentation

typedef ALvoid(* DryMixerFunc)(const struct DirectParams *params, const ALfloat *RESTRICT data, ALuint srcchan, ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize)

Definition at line 36 of file alu.h.

typedef void(* ResamplerFunc)(const ALfloat *src, ALuint frac, ALuint increment, ALfloat *RESTRICT dst, ALuint dstlen)

Definition at line 33 of file alu.h.

typedef ALvoid(* WetMixerFunc)(const struct SendParams *params, const ALfloat *RESTRICT data, ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize)

Definition at line 40 of file alu.h.

Function Documentation

ALvoid CalcNonAttnSourceParams ( struct ALsource ALSource,
const ALCcontext ALContext 
)

Definition at line 193 of file ALu.c.

References AL_EFFECT_NULL, AL_FALSE, BackCenter, BackLeft, BackRight, ALbufferlistitem::buffer, BUFFERSIZE, clampf(), DirectParams::ClickRemoval, FILTER::coeff, ComputeAngleGains(), HrtfState::Counter, ALCdevice_struct::DefaultSlot, HrtfParams::Delay, DevFmtStereo, ALCcontext_struct::Device, DEVICE_WIDE_STEREO, ALsource::Direct, ALsource::DirectChannels, ALsource::DirectGain, ALsource::DirectGainHF, ALsource::DryMix, ALeffectslot::effect, F_PI, fastf2i(), ALCdevice_struct::Flags, ALbuffer::FmtChannels, ALCdevice_struct::FmtChans, FmtMono, FmtQuad, FmtRear, FmtStereo, FmtX51, FmtX61, FmtX71, FRACTIONBITS, FRACTIONONE, ALbuffer::Frequency, ALCdevice_struct::Frequency, FrontCenter, FrontLeft, FrontRight, ALlistener::Gain, ALsource::Gain, ALsource::GainHF, DirectParams::Gains, GetHrtfIrSize(), GetLerpedHrtfCoeffs(), HRIR_LENGTH, DirectParams::Hrtf, ALsource::Hrtf, ALCdevice_struct::Hrtf, i, DirectParams::iirFilter, HrtfParams::IrSize, lerp(), LFE, ALCcontext_struct::Listener, LOWPASSFREQREF, lpCoeffCalc(), MAX_SENDS, MaxChannels, ALsource::MaxGain, ALsource::MinGain, mini(), ALbufferlistitem::next, NULL, ALCdevice_struct::NumAuxSends, ALCdevice_struct::NumChan, DirectParams::OutBuffer, DirectParams::Params, ALsource::Params, DirectParams::PendingClicks, ALsource::Pitch, ALsource::queue, ALsource::Resample, ALsource::Resampler, ResamplerPadding, ResamplerPrePadding, SelectDirectMixer(), SelectHrtfMixer(), SelectResampler(), SelectSendMixer(), ALsource::Send, SideLeft, SideRight, ALsource::Slot, ALCdevice_struct::Speaker2Chan, DirectParams::State, ALsource::Step, ALeffect::type, and ALsource::WetMix.

Referenced by alSourceQueueBuffers(), and SetSourceiv().

ALvoid CalcSourceParams ( struct ALsource ALSource,
const ALCcontext ALContext 
)

Definition at line 470 of file ALu.c.

References AIRABSORBGAINHF, ALsource::AirAbsorptionFactor, ALeffect::AirAbsorptionGainHF, AL_EFFECT_NULL, AL_FALSE, AL_TRUE, aluDotproduct(), aluMatrixVector(), aluNormalize(), ALeffectslot::AuxSendAuto, ALbufferlistitem::buffer, BUFFERSIZE, CalcHrtfDelta(), clampf(), DirectParams::ClickRemoval, FILTER::coeff, ComputeAngleGains(), ConeScale, HrtfState::Counter, ALeffect::DecayTime, ALCdevice_struct::DefaultSlot, HrtfParams::Delay, HrtfParams::DelayStep, ALCcontext_struct::Device, HrtfParams::Dir, ALsource::Direct, ALsource::DirectGain, ALsource::DirectGainHF, DisableDistance, ALsource::DistanceModel, ALCcontext_struct::DistanceModel, ALsource::DopplerFactor, ALCcontext_struct::DopplerFactor, ALCcontext_struct::DopplerVelocity, ALsource::DryGainHFAuto, ALsource::DryMix, ALeffectslot::effect, ExponentDistance, ExponentDistanceClamped, F_PI, fastf2i(), FLT_EPSILON, FRACTIONBITS, FRACTIONONE, ALbuffer::Frequency, ALCdevice_struct::Frequency, ALlistener::Gain, HrtfParams::Gain, ALsource::Gain, ALsource::GainHF, DirectParams::Gains, GetHrtfIrSize(), GetLerpedHrtfCoeffs(), GetMovingHrtfCoeffs(), ALsource::HeadRelative, DirectParams::Hrtf, ALsource::Hrtf, ALCdevice_struct::Hrtf, i, DirectParams::iirFilter, ALsource::InnerAngle, InverseDistance, InverseDistanceClamped, HrtfParams::IrSize, IsReverbEffect(), j, lerp(), LinearDistance, LinearDistanceClamped, ALCcontext_struct::Listener, LOWPASSFREQREF, lpCoeffCalc(), ALlistener::Matrix, MAX_SENDS, MaxChannels, ALsource::MaxDistance, maxf(), ALsource::MaxGain, ALlistener::MetersPerUnit, ALsource::MinGain, mini(), HrtfState::Moving, ALbufferlistitem::next, NULL, ALCdevice_struct::NumAuxSends, ALCdevice_struct::NumChan, ALsource::Orientation, DirectParams::OutBuffer, ALsource::OuterAngle, ALsource::OuterGain, ALsource::OuterGainHF, ALlistener::Params, DirectParams::Params, ALsource::Params, DirectParams::PendingClicks, ALsource::Pitch, ALsource::Position, ALsource::queue, ALsource::RefDistance, ALsource::Resample, ALsource::Resampler, ResamplerPadding, ResamplerPrePadding, ALeffect::Reverb, ALsource::RollOffFactor, ALeffect::RoomRolloffFactor, ALsource::RoomRolloffFactor, SelectDirectMixer(), SelectHrtfMixer(), SelectResampler(), SelectSendMixer(), ALsource::Send, ALsource::Slot, ALCcontext_struct::SourceDistanceModel, ALCdevice_struct::Speaker2Chan, ALCcontext_struct::SpeedOfSound, SPEEDOFSOUNDMETRESPERSEC, DirectParams::State, ALsource::Step, ALeffect::type, ALlistener::Velocity, ALsource::Velocity, ALsource::WetGainAuto, ALsource::WetGainHFAuto, ALsource::WetMix, and ZScale.

Referenced by alSourceQueueBuffers(), and SetSourceiv().

static __inline ALfloat clampf ( ALfloat  val,
ALfloat  min,
ALfloat  max 
)
static

Definition at line 58 of file alu.h.

References maxf(), and minf().

Referenced by CalcLimitedHfRatio(), CalcNonAttnSourceParams(), and CalcSourceParams().

static __inline ALint clampi ( ALint  val,
ALint  min,
ALint  max 
)
static

Definition at line 72 of file alu.h.

References maxi(), and mini().

Referenced by DecodeIMA4Block(), and EncodeIMA4Block().

static __inline ALint64 clampi64 ( ALint64  val,
ALint64  min,
ALint64  max 
)
static

Definition at line 79 of file alu.h.

References maxi64(), and mini64().

static __inline ALuint clampu ( ALuint  val,
ALuint  min,
ALuint  max 
)
static

Definition at line 65 of file alu.h.

References maxu(), and minu().

Referenced by alcOpenDevice().

static __inline ALuint64 clampu64 ( ALuint64  val,
ALuint64  min,
ALuint64  max 
)
static

Definition at line 86 of file alu.h.

References maxu64(), and minu64().

ALvoid ComputeAngleGains ( const ALCdevice device,
ALfloat  angle,
ALfloat  hwidth,
ALfloat  ingain,
ALfloat gains 
)

ComputeAngleGains

Sets channel gains based on a given source's angle and its half-width. The angle and hwidth parameters are in radians.

Definition at line 149 of file panning.c.

References F_PI, i, lerp(), MaxChannels, ALCdevice_struct::NumChan, ALCdevice_struct::Speaker2Chan, and ALCdevice_struct::SpeakerAngle.

Referenced by CalcNonAttnSourceParams(), CalcSourceParams(), DedicatedUpdate(), EchoUpdate(), and Update3DPanning().

static __inline ALfloat cubic ( ALfloat  val0,
ALfloat  val1,
ALfloat  val2,
ALfloat  val3,
ALfloat  mu 
)
static

Definition at line 94 of file alu.h.

Referenced by cubic32().

static __inline ALfloat lerp ( ALfloat  val1,
ALfloat  val2,
ALfloat  mu 
)
static
static __inline ALfloat maxf ( ALfloat  a,
ALfloat  b 
)
static

Definition at line 56 of file alu.h.

Referenced by CalcHrtfDelta(), CalcSourceParams(), clampf(), GetMovingHrtfCoeffs(), and lpCoeffCalc().

static __inline ALint maxi ( ALint  a,
ALint  b 
)
static

Definition at line 70 of file alu.h.

Referenced by clampi(), EncodeALaw(), and EncodeMuLaw().

static __inline ALint64 maxi64 ( ALint64  a,
ALint64  b 
)
static

Definition at line 77 of file alu.h.

Referenced by alsa_get_latency(), and clampi64().

static __inline ALuint maxu ( ALuint  a,
ALuint  b 
)
static
static __inline ALuint64 maxu64 ( ALuint64  a,
ALuint64  b 
)
static

Definition at line 84 of file alu.h.

Referenced by clampu64().

static __inline ALfloat minf ( ALfloat  a,
ALfloat  b 
)
static

Definition at line 54 of file alu.h.

Referenced by CalcDampingCoeff(), CalcHrtfDelta(), clampf(), and Update3DPanning().

static __inline ALint mini ( ALint  a,
ALint  b 
)
static
static __inline ALint64 mini64 ( ALint64  a,
ALint64  b 
)
static

Definition at line 75 of file alu.h.

Referenced by clampi64(), and MixSource().

static __inline ALuint minu ( ALuint  a,
ALuint  b 
)
static
static __inline ALuint64 minu64 ( ALuint64  a,
ALuint64  b 
)
static

Definition at line 82 of file alu.h.

Referenced by clampu64(), and GetSourceOffset().

Variable Documentation

ALfloat ConeScale

Definition at line 46 of file ALu.c.

Referenced by alc_init(), and CalcSourceParams().

ALfloat ZScale

Definition at line 49 of file ALu.c.

Referenced by alc_init(), and CalcSourceParams().