zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
hrtf.c File Reference
#include "config.h"
#include <stdlib.h>
#include <ctype.h>
#include "AL/al.h"
#include "AL/alc.h"
#include "alMain.h"
#include "alSource.h"
#include "alu.h"
#include "hrtf_tables.inc"

Go to the source code of this file.

Macros

#define MAX_AZ_COUNT   (128)
 
#define MAX_EV_COUNT   (128)
 
#define MAX_IR_SIZE   (128)
 
#define MIN_AZ_COUNT   (1)
 
#define MIN_EV_COUNT   (5)
 
#define MIN_IR_SIZE   (8)
 
#define MOD_IR_SIZE   (8)
 
#define PATH_MAX   4096
 

Functions

static void CalcAzIndices (const struct Hrtf *Hrtf, ALuint evidx, ALfloat az, ALuint *azidx, ALfloat *azmu)
 
static void CalcEvIndices (const struct Hrtf *Hrtf, ALfloat ev, ALuint *evidx, ALfloat *evmu)
 
ALfloat CalcHrtfDelta (ALfloat oldGain, ALfloat newGain, const ALfloat olddir[3], const ALfloat newdir[3])
 
void FreeHrtfs (void)
 
struct Hrtf * GetHrtf (ALCdevice *device)
 
ALuint GetHrtfIrSize (const struct Hrtf *Hrtf)
 
void GetLerpedHrtfCoeffs (const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat gain, ALfloat(*coeffs)[2], ALuint *delays)
 
ALuint GetMovingHrtfCoeffs (const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat gain, ALfloat delta, ALint counter, ALfloat(*coeffs)[2], ALuint *delays, ALfloat(*coeffStep)[2], ALint *delayStep)
 
static struct Hrtf * LoadHrtf (ALuint deviceRate)
 
static struct Hrtf * LoadHrtf00 (FILE *f, ALuint deviceRate)
 
static struct Hrtf * LoadHrtf01 (FILE *f, ALuint deviceRate)
 

Variables

static struct Hrtf * LoadedHrtfs = NULL
 
static const ALchar magicMarker00 [8] = "MinPHR00"
 
static const ALchar magicMarker01 [8] = "MinPHR01"
 

Macro Definition Documentation

#define MAX_AZ_COUNT   (128)

Definition at line 47 of file hrtf.c.

Referenced by LoadHrtf00(), and LoadHrtf01().

#define MAX_EV_COUNT   (128)

Definition at line 44 of file hrtf.c.

Referenced by LoadHrtf00(), and LoadHrtf01().

#define MAX_IR_SIZE   (128)

Definition at line 40 of file hrtf.c.

Referenced by LoadHrtf00(), and LoadHrtf01().

#define MIN_AZ_COUNT   (1)

Definition at line 46 of file hrtf.c.

Referenced by LoadHrtf00(), and LoadHrtf01().

#define MIN_EV_COUNT   (5)

Definition at line 43 of file hrtf.c.

Referenced by LoadHrtf00(), and LoadHrtf01().

#define MIN_IR_SIZE   (8)

Definition at line 39 of file hrtf.c.

Referenced by LoadHrtf00(), and LoadHrtf01().

#define MOD_IR_SIZE   (8)

Definition at line 41 of file hrtf.c.

Referenced by LoadHrtf00(), and LoadHrtf01().

#define PATH_MAX   4096

OpenAL cross platform audio library Copyright (C) 2011 by Chris Robinson 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

Definition at line 34 of file hrtf.c.

Referenced by LoadHrtf(), and SDL_RWFromFile().

Function Documentation

static void CalcAzIndices ( const struct Hrtf *  Hrtf,
ALuint  evidx,
ALfloat  az,
ALuint azidx,
ALfloat azmu 
)
static

Definition at line 93 of file hrtf.c.

References F_PI, and fastf2u().

Referenced by GetLerpedHrtfCoeffs(), and GetMovingHrtfCoeffs().

static void CalcEvIndices ( const struct Hrtf *  Hrtf,
ALfloat  ev,
ALuint evidx,
ALfloat evmu 
)
static

Definition at line 81 of file hrtf.c.

References F_PI, F_PI_2, fastf2u(), and minu().

Referenced by GetLerpedHrtfCoeffs(), and GetMovingHrtfCoeffs().

ALfloat CalcHrtfDelta ( ALfloat  oldGain,
ALfloat  newGain,
const ALfloat  olddir[3],
const ALfloat  newdir[3] 
)

Definition at line 106 of file hrtf.c.

References F_PI, maxf(), and minf().

Referenced by CalcSourceParams().

void FreeHrtfs ( void  )

Definition at line 786 of file hrtf.c.

References free, and NULL.

Referenced by alc_deinit_safe().

struct Hrtf* GetHrtf ( ALCdevice device)
ALuint GetHrtfIrSize ( const struct Hrtf *  Hrtf)

Definition at line 801 of file hrtf.c.

Referenced by CalcNonAttnSourceParams(), and CalcSourceParams().

void GetLerpedHrtfCoeffs ( const struct Hrtf *  Hrtf,
ALfloat  elevation,
ALfloat  azimuth,
ALfloat  gain,
ALfloat(*)  coeffs[2],
ALuint delays 
)

Definition at line 140 of file hrtf.c.

References CalcAzIndices(), CalcEvIndices(), fastf2u(), HRTFDELAY_BITS, and i.

Referenced by CalcNonAttnSourceParams(), and CalcSourceParams().

ALuint GetMovingHrtfCoeffs ( const struct Hrtf *  Hrtf,
ALfloat  elevation,
ALfloat  azimuth,
ALfloat  gain,
ALfloat  delta,
ALint  counter,
ALfloat(*)  coeffs[2],
ALuint delays,
ALfloat(*)  coeffStep[2],
ALint delayStep 
)

Definition at line 232 of file hrtf.c.

References CalcAzIndices(), CalcEvIndices(), fastf2i(), fastf2u(), HRIR_LENGTH, HRTFDELAY_BITS, i, and maxf().

Referenced by CalcSourceParams().

static struct Hrtf* LoadHrtf ( ALuint  deviceRate)
static
static struct Hrtf* LoadHrtf00 ( FILE *  f,
ALuint  deviceRate 
)
static
static struct Hrtf* LoadHrtf01 ( FILE *  f,
ALuint  deviceRate 
)
static

Variable Documentation

struct Hrtf* LoadedHrtfs = NULL
static

Definition at line 75 of file hrtf.c.

Referenced by GetHrtf(), and LoadHrtf().

const ALchar magicMarker00[8] = "MinPHR00"
static

Definition at line 62 of file hrtf.c.

Referenced by LoadHrtf().

const ALchar magicMarker01[8] = "MinPHR01"
static

Definition at line 63 of file hrtf.c.

Referenced by LoadHrtf().