From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a02766.html | 865 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 865 insertions(+) create mode 100644 docs/doxygen/nel/a02766.html (limited to 'docs/doxygen/nel/a02766.html') diff --git a/docs/doxygen/nel/a02766.html b/docs/doxygen/nel/a02766.html new file mode 100644 index 00000000..3e7d5c17 --- /dev/null +++ b/docs/doxygen/nel/a02766.html @@ -0,0 +1,865 @@ + + +NeL: NLSOUND::CListenerAL class Reference + + + +
+

NLSOUND::CListenerAL Class Reference

#include <listener_al.h> +

+

Inheritance diagram for NLSOUND::CListenerAL: +

+ +NLSOUND::IListener + +

Detailed Description

+OpenAL sound listener.

+For arguments as 3D vectors, use the NeL vector coordinate system (not OpenAL/OpenGL's one).

+

Author:
Olivier Cado

+Nevrax France

+
Date:
2001
+ +

+ +

+Definition at line 46 of file listener_al.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

 CListenerAL ()
 Constructor.

virtual ~CListenerAL ()
 Destructor.

Listener properties
virtual float getGain () const
 Get the gain.

virtual void getOrientation (NLMISC::CVector &front, NLMISC::CVector &up) const
 Get the orientation vectors.

virtual const NLMISC::CVectorgetPos () const
virtual void getVelocity (NLMISC::CVector &vel) const
 Get the velocity vector.

virtual void setGain (float gain)
virtual void setOrientation (const NLMISC::CVector &front, const NLMISC::CVector &up)
 Set the orientation vectors (3D mode only) (default: (0,1,0), (0,0,1)).

virtual void setPos (const NLMISC::CVector &pos)
 Set the position vector (default: (0,0,0)) (3D mode only).

virtual void setVelocity (const NLMISC::CVector &vel)
 Set the velocity vector (3D mode only) (default: (0,0,0)).

Global properties
virtual void setDopplerFactor (float f)
 Set the doppler factor (default: 1) to exaggerate or not the doppler effect.

virtual void setEAXProperty (uint prop, void *value, uint valuesize)
 Set any EAX listener property if EAX available.

virtual void setEnvironment (uint env, float size=7.5f)
 Set DSPROPERTY_EAXLISTENER_ENVIRONMENT and DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE if EAX available (see EAX listener properties).

virtual void setRolloffFactor (float f)
 Set the rolloff factor (default: 1) to scale the distance attenuation effect.


Static Public Member Functions

CListenerALinstance ()
 Return the instance of the singleton.


Private Attributes

NLMISC::CVector _Pos

Static Private Attributes

CListenerAL_Instance = NULL
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NLSOUND::CListenerAL::CListenerAL  ) 
+
+ + + + + +
+   + + +

+Constructor. +

+ +

+Definition at line 45 of file listener_al.cpp. +

+References nlerror. +

+

00045                          : IListener()
+00046 {
+00047         if ( _Instance == NULL )
+00048         {
+00049                 _Instance = this;
+00050         }
+00051         else
+00052         {
+00053                 nlerror( "Listener singleton instanciated twice" );
+00054         }
+00055 }
+
+

+ + + + +
+ + + + + + + + + +
virtual NLSOUND::CListenerAL::~CListenerAL  )  [inline, virtual]
+
+ + + + + +
+   + + +

+Destructor. +

+ +

+Definition at line 96 of file listener_al.h. +

+

00096 { _Instance = NULL; }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + +
float NLSOUND::CListenerAL::getGain  )  const [virtual]
+
+ + + + + +
+   + + +

+Get the gain. +

+ +

+Implements NLSOUND::IListener. +

+Definition at line 177 of file listener_al.cpp. +

+References TestALError. +

+

00178 {
+00179         ALfloat gain;
+00180 #ifdef NL_OS_WINDOWS
+00181         alGetListenerf( AL_GAIN, &gain );
+00182 #else
+00183         alGetListenerfv( AL_GAIN, &gain );
+00184 #endif
+00185         TestALError();
+00186         return gain;
+00187 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLSOUND::CListenerAL::getOrientation NLMISC::CVector front,
NLMISC::CVector up
const [virtual]
+
+ + + + + +
+   + + +

+Get the orientation vectors. +

+ +

+Implements NLSOUND::IListener. +

+Definition at line 149 of file listener_al.cpp. +

+References NLMISC::CVector::set(), TestALError, and v. +

+

00150 {
+00151         // Forward then up
+00152         ALfloat v[6];
+00153         alGetListenerfv( AL_ORIENTATION, v );
+00154         TestALError();
+00155         // Coordsys conversion
+00156         front.set( v[0], -v[2], v[1] );
+00157         up.set( v[3], -v[5], v[4] );
+00158 }
+
+

+ + + + +
+ + + + + + + + + +
const NLMISC::CVector & NLSOUND::CListenerAL::getPos  )  const [virtual]
+
+ + + + + +
+   + + +

+Get the position vector. See setPos() for details. +

+Implements NLSOUND::IListener. +

+Definition at line 73 of file listener_al.cpp. +

+

00074 {
+00075         return _Pos;
+00076 
+00077 // Currently, the OpenAL headers are different between Windows and Linux versions !
+00078 // alGetListener3f() is part of the spec, though.
+00079 /*
+00080 #ifdef NL_OS_WINDOWS
+00081         // Coordsys conversion
+00082         float glposz;
+00083         alGetListener3f( AL_POSITION, &pos.x, &pos.z, &glposz );
+00084         pos.y = -glposz;
+00085 #else
+00086         float posarray [3];
+00087         alGetListenerfv( AL_POSITION, posarray );
+00088         // Coordsys conversion
+00089         pos.set( posarray[0], -posarray[2], posarray[1] );
+00090 #endif
+00091         TestALError();
+00092 */
+00093 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLSOUND::CListenerAL::getVelocity NLMISC::CVector vel  )  const [virtual]
+
+ + + + + +
+   + + +

+Get the velocity vector. +

+ +

+Implements NLSOUND::IListener. +

+Definition at line 110 of file listener_al.cpp. +

+References NLMISC::CVector::set(), TestALError, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z. +

+

00111 {
+00112 #ifdef NL_OS_WINDOWS
+00113         // Coordsys conversion
+00114         float glposz;
+00115         alGetListener3f( AL_VELOCITY, &vel.x, &vel.z, &glposz );
+00116         vel.y = - glposz;
+00117 #else
+00118         float velarray [3];
+00119         alGetListenerfv( AL_VELOCITY, velarray );
+00120         // Coordsys conversion
+00121         vel.set( velarray[0], -velarray[2], velarray[1] );
+00122 #endif
+00123         TestALError();
+00124 }
+
+

+ + + + +
+ + + + + + + + + +
CListenerAL* NLSOUND::CListenerAL::instance  )  [inline, static]
+
+ + + + + +
+   + + +

+Return the instance of the singleton. +

+ +

+Definition at line 54 of file listener_al.h. +

+

00054 { return _Instance; }
+
+

+ + + + +
+ + + + + + + + + + +
void NLSOUND::CListenerAL::setDopplerFactor float  f  )  [virtual]
+
+ + + + + +
+   + + +

+Set the doppler factor (default: 1) to exaggerate or not the doppler effect. +

+ +

+Implements NLSOUND::IListener. +

+Definition at line 193 of file listener_al.cpp. +

+References TestALError. +

+

00194 {
+00195         alDopplerFactor( f );
+00196         TestALError();
+00197 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NLSOUND::CListenerAL::setEAXProperty uint  prop,
void *  value,
uint  valuesize
[virtual]
+
+ + + + + +
+   + + +

+Set any EAX listener property if EAX available. +

+ +

+Implements NLSOUND::IListener. +

+Definition at line 228 of file listener_al.cpp. +

+References uint, and value. +

+

00229 {
+00230 #if EAX_AVAILABLE == 1
+00231         if ( EAXSetProp != NULL )
+00232         {
+00233                 EAXSetProp( &DSPROPSETID_EAX_ListenerProperties, prop, 0, value, valuesize );
+00234         }
+00235 #endif
+00236 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLSOUND::CListenerAL::setEnvironment uint  env,
float  size = 7.5f
[virtual]
+
+ + + + + +
+   + + +

+Set DSPROPERTY_EAXLISTENER_ENVIRONMENT and DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE if EAX available (see EAX listener properties). +

+ +

+Implements NLSOUND::IListener. +

+Definition at line 213 of file listener_al.cpp. +

+References size, and uint. +

+

00214 {
+00215 #if EAX_AVAILABLE == 1
+00216         if ( EAXSetProp != NULL )
+00217         {
+00218                 EAXSetProp( &DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_ENVIRONMENT, 0, &env, sizeof(unsigned long) );
+00219                 EAXSetProp( &DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE, 0, &size, sizeof(float) );
+00220         }
+00221 #endif
+00222 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLSOUND::CListenerAL::setGain float  gain  )  [virtual]
+
+ + + + + +
+   + + +

+Set the gain (volume value inside [0 , 1]). (default: 1) 0.0 -> silence 0.5 -> -6dB 1.0 -> no attenuation values > 1 (amplification) not supported by most drivers +

+Implements NLSOUND::IListener. +

+Definition at line 167 of file listener_al.cpp. +

+References TestALError. +

+

00168 {
+00169         alListenerf( AL_GAIN, gain );
+00170         TestALError();
+00171 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLSOUND::CListenerAL::setOrientation const NLMISC::CVector front,
const NLMISC::CVector up
[virtual]
+
+ + + + + +
+   + + +

+Set the orientation vectors (3D mode only) (default: (0,1,0), (0,0,1)). +

+ +

+Implements NLSOUND::IListener. +

+Definition at line 130 of file listener_al.cpp. +

+References TestALError, v, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z. +

+

00131 {
+00132         // Forward then up
+00133         ALfloat v[6];
+00134         // Coordsys conversion
+00135         v[0] = front.x;
+00136         v[1] = front.z;
+00137         v[2] = -front.y;
+00138         v[3] = up.x;
+00139         v[4] = up.z;
+00140         v[5] = -up.y;
+00141         alListenerfv( AL_ORIENTATION, v );
+00142         TestALError();
+00143 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLSOUND::CListenerAL::setPos const NLMISC::CVector pos  )  [virtual]
+
+ + + + + +
+   + + +

+Set the position vector (default: (0,0,0)) (3D mode only). +

+ +

+Implements NLSOUND::IListener. +

+Definition at line 61 of file listener_al.cpp. +

+References TestALError. +

+

00062 {
+00063         _Pos = pos;
+00064         // Coordinate system: conversion from NeL to OpenAL/GL:
+00065         alListener3f( AL_POSITION, pos.x, pos.z, -pos.y );
+00066         TestALError();
+00067 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLSOUND::CListenerAL::setRolloffFactor float  f  )  [virtual]
+
+ + + + + +
+   + + +

+Set the rolloff factor (default: 1) to scale the distance attenuation effect. +

+ +

+Implements NLSOUND::IListener. +

+Definition at line 203 of file listener_al.cpp. +

+References nlassert. +

+

00204 {
+00205         nlassert( CSoundDriverAL::instance() != NULL );
+00206         CSoundDriverAL::instance()->applyRolloffFactor( f );
+00207 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLSOUND::CListenerAL::setVelocity const NLMISC::CVector vel  )  [virtual]
+
+ + + + + +
+   + + +

+Set the velocity vector (3D mode only) (default: (0,0,0)). +

+ +

+Implements NLSOUND::IListener. +

+Definition at line 99 of file listener_al.cpp. +

+References TestALError, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z. +

+

00100 {
+00101         // Coordsys conversion
+00102         alListener3f( AL_VELOCITY, vel.x, vel.z, -vel.y );
+00103         TestALError();
+00104 }
+
+


Field Documentation

+

+ + + + +
+ + +
CListenerAL * NLSOUND::CListenerAL::_Instance = NULL [static, private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 39 of file listener_al.cpp.

+

+ + + + +
+ + +
NLMISC::CVector NLSOUND::CListenerAL::_Pos [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 103 of file listener_al.h.

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 14:39:01 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1