zenilib: zenilib/jni/external/openal-soft/Alc/ALu.c File Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Macros | Functions | Variables
ALu.c File Reference
`#include "config.h"`
`#include <math.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <ctype.h>`
`#include <assert.h>`
`#include "alMain.h"`
`#include "alSource.h"`
`#include "alBuffer.h"`
`#include "alListener.h"`
`#include "alAuxEffectSlot.h"`
`#include "alu.h"`
`#include "bs2b.h"`
`#include "mixer_defs.h"`

Go to the source code of this file.

## Macros

#define | DECL_TEMPLATE(T, func)

## Functions

static __inline void | aluCrossproduct (const ALfloat *inVector1, const ALfloat *inVector2, ALfloat *outVector)
static __inline ALfloat | aluDotproduct (const ALfloat *inVector1, const ALfloat *inVector2)
static __inline ALbyte | aluF2B (ALfloat val)
static __inline ALfloat | aluF2F (ALfloat val)
static __inline ALint | aluF2I (ALfloat val)
static __inline ALshort | aluF2S (ALfloat val)
static __inline ALubyte | aluF2UB (ALfloat val)
static __inline ALuint | aluF2UI (ALfloat val)
static __inline ALushort | aluF2US (ALfloat val)
ALvoid | aluHandleDisconnect (ALCdevice *device)
static __inline ALvoid | aluMatrixVector (ALfloat *vector, ALfloat w, ALfloat(*RESTRICT matrix)[4])
ALvoid | aluMixData (ALCdevice *device, ALvoid *buffer, ALsizei size)
static __inline void | aluNormalize (ALfloat *inVector)
static ALvoid | CalcListenerParams (ALlistener *Listener)
ALvoid | CalcNonAttnSourceParams (ALsource *ALSource, const ALCcontext *ALContext)
ALvoid | CalcSourceParams (ALsource *ALSource, const ALCcontext *ALContext)
static DryMixerFunc | SelectDirectMixer (void)
static DryMixerFunc | SelectHrtfMixer (void)
static ResamplerFunc | SelectResampler (enum Resampler Resampler, ALuint increment)
static WetMixerFunc | SelectSendMixer (void)

## Variables

ALfloat | ConeScale = 1.0f
ALfloat | ZScale = 1.0f

## Macro Definition Documentation

#define DECL_TEMPLATE | ( |  | T,
|  |  | func
| ) |  |

Value:
static int Write_##T(ALCdevice *device, T *RESTRICT buffer, \
ALuint SamplesToDo) \
{ \
ALfloat (*RESTRICT DryBuffer)[BUFFERSIZE] = device->DryBuffer; \
ALuint numchans = ChannelsFromDevFmt(device->FmtChans); \
const ALuint *offsets = device->ChannelOffsets; \
ALuint i, j; \
\
for(j = 0;j < MaxChannels;j++) \
{ \
T *RESTRICT out; \
\
if(offsets[j] == INVALID_OFFSET) \
continue; \
\
out = buffer + offsets[j]; \
for(i = 0;i < SamplesToDo;i++) \
out[i*numchans] = func(DryBuffer[j][i]); \
} \
return SamplesToDo*numchans*sizeof(T); \
}
return
return
Definition: pngrutil.c:1266
INVALID_OFFSET
#define INVALID_OFFSET
Definition: alMain.h:664
offsets
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glew.h:4750
ALCdevice_struct
Definition: alMain.h:560
j
int32_t j
Definition: e_log.c:102
if
if(!yyg->yy_init)
Definition: glslang_lex.cpp:1037
func
GLenum func
Definition: SDL_opengl.h:5654
ALfloat
float ALfloat
Definition: al.h:68
buffer
EGLContext EGLenum EGLClientBuffer buffer
Definition: eglext.h:87
for
for(;;)
Definition: glslang_tab.cpp:4773
ALuint
unsigned int ALuint
Definition: al.h:59
const
#define const
Definition: zconf.h:91
i
int i
Definition: pngrutil.c:1377
BUFFERSIZE
#define BUFFERSIZE
Definition: alMain.h:556
MaxChannels
Definition: alMain.h:491
ChannelsFromDevFmt
ALuint ChannelsFromDevFmt(enum DevFmtChannels chans)
Definition: ALc.c:1179

Definition at line 936 of file ALu.c.

## Function Documentation

static __inline void aluCrossproduct | ( | const ALfloat * | inVector1,
|  | const ALfloat * | inVector2,
|  | ALfloat * | outVector
| ) |  |

static

Definition at line 108 of file ALu.c.

Referenced by CalcListenerParams().

static __inline ALfloat aluDotproduct | ( | const ALfloat * | inVector1,
|  | const ALfloat * | inVector2
| ) |  |

static

Definition at line 115 of file ALu.c.

Referenced by aluNormalize(), and CalcSourceParams().

static __inline ALbyte aluF2B | ( | ALfloat | val | ) |

static

Definition at line 931 of file ALu.c.

References aluF2I().

Referenced by aluF2UB().

static __inline ALfloat aluF2F | ( | ALfloat | val | ) |

static

Definition at line 915 of file ALu.c.

static __inline ALint aluF2I | ( | ALfloat | val | ) |

static

Definition at line 917 of file ALu.c.

References fastf2i().

Referenced by aluF2B(), aluF2S(), and aluF2UI().

static __inline ALshort aluF2S | ( | ALfloat | val | ) |

static

Definition at line 927 of file ALu.c.

References aluF2I().

Referenced by aluF2US().

static __inline ALubyte aluF2UB | ( | ALfloat | val | ) |

static

Definition at line 933 of file ALu.c.

References aluF2B().

static __inline ALuint aluF2UI | ( | ALfloat | val | ) |

static

Definition at line 925 of file ALu.c.

References aluF2I(), and u.

static __inline ALushort aluF2US | ( | ALfloat | val | ) |

static

Definition at line 929 of file ALu.c.

References aluF2S().

ALvoid aluHandleDisconnect | ( | ALCdevice * | device | ) |

Definition at line 1176 of file ALu.c.

References ALCcontext_struct::ActiveSourceCount, ALCcontext_struct::ActiveSources, AL_PLAYING, AL_STOPPED, ALC_FALSE, ALCdevice_struct::Connected, ALCdevice_struct::ContextList, and ALCcontext_struct::next.

Referenced by alcCreateContext(), alsa_available_samples(), alsa_capture_samples(), alsa_start_capture(), ALSANoMMapProc(), ALSAProc(), DSoundAvailableSamples(), DSoundPlaybackProc(), DSoundStartCapture(), DSoundStopCapture(), MMDevApiProc(), OSSCaptureProc(), OSSProc(), sndio_proc(), SolarisProc(), and WaveProc().

static __inline ALvoid aluMatrixVector | ( | ALfloat * | vector,
|  | ALfloat | w,
|  | ALfloat(*) | matrix[4]
| ) |  |

static

Definition at line 133 of file ALu.c.

Referenced by CalcListenerParams(), and CalcSourceParams().

ALvoid aluMixData | ( | ALCdevice * | device,
|  | ALvoid * | buffer,
|  | ALsizei | size
| ) |  |

Definition at line 970 of file ALu.c.

References ALCcontext_struct::ActiveEffectSlotCount, ALCcontext_struct::ActiveEffectSlots, ALCcontext_struct::ActiveSourceCount, ALCcontext_struct::ActiveSources, AL_FALSE, AL_PLAYING, ALCdevice_Lock, ALCdevice_Unlock, ALeffectState_Process, ALeffectState_Update, ALsource_Update, ALCdevice_struct::Bs2b, bs2b_cross_feed(), BUFFERSIZE, CalcListenerParams(), ALeffectslot::ClickRemoval, ALCdevice_struct::ContextList, ALCdevice_struct::DefaultSlot, ALCcontext_struct::DeferUpdates, DevFmtByte, DevFmtFloat, DevFmtInt, DevFmtMono, DevFmtShort, DevFmtStereo, DevFmtUByte, DevFmtUInt, DevFmtUShort, ALCdevice_struct::FmtChans, ALCdevice_struct::FmtType, FrontCenter, FrontLeft, FrontRight, i, ALCcontext_struct::Listener, MaxChannels, memset, minu(), MixSource(), ALCcontext_struct::next, NULL, RestoreFPUMode(), SetMixerFPUMode(), and ALCcontext_struct::UpdateSources.

Referenced by alcRenderSamplesSOFT(), ALSANoMMapProc(), ALSAProc(), ca_callback(), DSoundPlaybackProc(), MMDevApiProc(), NullProc(), opensl_callback(), OSSProc(), pa_callback(), PlaybackThreadProc(), sndio_proc(), SolarisProc(), and WaveProc().

static __inline void aluNormalize | ( | ALfloat * | inVector | ) |

static

Definition at line 121 of file ALu.c.

References aluDotproduct().

Referenced by CalcListenerParams(), and CalcSourceParams().

static ALvoid CalcListenerParams | ( | ALlistener * | Listener | ) |

static

Definition at line 145 of file ALu.c.

References aluCrossproduct(), aluMatrixVector(), aluNormalize(), ALlistener::Forward, ALlistener::Matrix, ALlistener::Params, ALlistener::Position, ALlistener::Up, and ALlistener::Velocity.

Referenced by aluMixData().

ALvoid CalcNonAttnSourceParams | ( | 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 | ( | 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 DryMixerFunc SelectDirectMixer | ( | void |  | ) |

static

Definition at line 87 of file ALu.c.

References CPU_CAP_SSE, CPUCapFlags, MixDirect_C(), and MixDirect_SSE().

Referenced by CalcNonAttnSourceParams(), and CalcSourceParams().

static DryMixerFunc SelectHrtfMixer | ( | void |  | ) |

static

Definition at line 73 of file ALu.c.

References CPU_CAP_NEON, CPU_CAP_SSE, CPUCapFlags, MixDirect_Hrtf_C(), MixDirect_Hrtf_Neon(), and MixDirect_Hrtf_SSE().

Referenced by CalcNonAttnSourceParams(), and CalcSourceParams().

static ResamplerFunc SelectResampler | ( | enum Resampler | Resampler,
|  | ALuint | increment
| ) |  |

static

Definition at line 52 of file ALu.c.

References CubicResampler, FRACTIONONE, LinearResampler, PointResampler, Resample_copy32_C(), Resample_cubic32_C(), Resample_lerp32_C(), Resample_point32_C(), and ResamplerMax.

Referenced by CalcNonAttnSourceParams(), and CalcSourceParams().

static WetMixerFunc SelectSendMixer | ( | void |  | ) |

static

Definition at line 97 of file ALu.c.

References CPU_CAP_SSE, CPUCapFlags, MixSend_C(), and MixSend_SSE().

Referenced by CalcNonAttnSourceParams(), and CalcSourceParams().

## Variable Documentation

ALfloat ConeScale = 1.0f

Definition at line 46 of file ALu.c.

Referenced by alc_init(), and CalcSourceParams().

ALfloat ZScale = 1.0f

Definition at line 49 of file ALu.c.

Referenced by alc_init(), and CalcSourceParams().