chai3d::cAudioDevice Class Reference

This class implements an audio device context. More...

#include <CAudioDevice.h>

Public Member Functions

 cAudioDevice (bool a_createAudioContext=true)
 Constructor of cAudioDevice. More...
 
virtual ~cAudioDevice ()
 Destructor of cAudioDevice. More...
 
bool setListenerPos (const cVector3d &a_listenerPos)
 This method sets the position of the listener in world coordinates. More...
 
cVector3d getListenerPos ()
 This method returns the position of the listener in world coordinates. More...
 
bool setListenerRot (const cMatrix3d &a_listenerRot)
 This method sets the orientation of the listener in world coordinates. More...
 
bool setListenerRot (const cVector3d &a_lookAt, const cVector3d &a_up)
 This method sets orientation of the listener in world coordinates. More...
 
cMatrix3d getListenerRot ()
 This method returns the position of the listener in world coordinates. More...
 
bool setListenerVel (const cVector3d &a_listenerVel)
 This method sets the linear velocity of the listener in world coordinates. More...
 
cVector3d getListenerVel ()
 This method sets the linear velocity of the listener in world coordinates. More...
 

Protected Member Functions

bool open ()
 This method opens this audio device context. More...
 
bool close ()
 This method closes this audio device context. More...
 
bool checkError ()
 This method checks for any OpenAL errors. More...
 

Protected Attributes

void * m_device
 Audio device (of type ALCdevice*). More...
 
void * m_context
 Audio context (of type ALCcontext*). More...
 
cVector3d m_listenerPos
 Position of listener in world coordinates. More...
 
cMatrix3d m_listenerRot
 Orientation of listener in world coordinates. More...
 
cVector3d m_listenerVel
 Linear velocity of listener in world coordinates. More...
 
bool m_active
 Flag that indicates if the connection to audio device was opened successfully by calling method open(). More...
 
bool m_createAudioContext
 Flag which indicates if this audio device has created an audio context. More...
 

Detailed Description

This class implements an audio display context for outputting sounds to loud speakers. Optionally, 3D spatial sound is modeled by defining the position and orientation of a listener placed inside the virtual world (cWorld)

Constructor & Destructor Documentation

chai3d::cAudioDevice::cAudioDevice ( bool  a_createAudioContext = true)

Constructor of cAudioDevice. The constructor takes a parameter which indicates if an audio context must be create. In principle this option should be set to true unless you are already using a movie player or any other component that is already creating an audio context under OpenAL. Creating multiple contexts is not recommended as the behavior is not predictable across different operating systems.

Parameters
a_createAudioContextIndicates if audio contexts should be created.
chai3d::cAudioDevice::~cAudioDevice ( )
virtual

Destructor of cAudioDevice.

Member Function Documentation

bool chai3d::cAudioDevice::setListenerPos ( const cVector3d a_listenerPos)

This method sets the position of the listener in world coordinates.

Parameters
a_listenerPosPosition of listener in world coordinates.
Returns
true if no errors occurred, false otherwise.
cVector3d chai3d::cAudioDevice::getListenerPos ( )
inline
bool chai3d::cAudioDevice::setListenerRot ( const cMatrix3d a_listenerRot)

This method sets the orientation of the listener in world coordinates.

Parameters
a_listenerRotOrientation of the listener in world coordinates.
Returns
true if no errors occurred, false otherwise.
bool chai3d::cAudioDevice::setListenerRot ( const cVector3d a_lookAt,
const cVector3d a_up 
)

This method sets the orientation of the listener in world coordinates.

Parameters
a_lookAtLook at position of listener.
a_upUp vector of listener.
Returns
true if no errors occurred, false otherwise.
cMatrix3d chai3d::cAudioDevice::getListenerRot ( )
inline
bool chai3d::cAudioDevice::setListenerVel ( const cVector3d a_listenerVel)

This method sets the linear velocity of the listener in world coordinates.

Parameters
a_listenerVelLinear velocity of listener in world coordinates.
Returns
true if no errors occurred, false otherwise.
cVector3d chai3d::cAudioDevice::getListenerVel ( )
inline
bool chai3d::cAudioDevice::open ( )
protected

This method opens this audio device context.

Returns
true if no errors occurred, false otherwise.
bool chai3d::cAudioDevice::close ( )
protected

This method closes this audio device context.

Returns
true if no errors occurred, false otherwise.
bool chai3d::cAudioDevice::checkError ( )
protected

This method checks for any OpenAL errors.

Returns
true if no errors occurred, false otherwise.

Member Data Documentation

void* chai3d::cAudioDevice::m_device
protected
void* chai3d::cAudioDevice::m_context
protected
cVector3d chai3d::cAudioDevice::m_listenerPos
protected
cMatrix3d chai3d::cAudioDevice::m_listenerRot
protected
cVector3d chai3d::cAudioDevice::m_listenerVel
protected
bool chai3d::cAudioDevice::m_active
protected
bool chai3d::cAudioDevice::m_createAudioContext
protected

The documentation for this class was generated from the following files: