# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NLSOUND::CSourceAL Class Reference

OpenAL sound source. More...

#include <source_al.h>

Inheritance diagram for NLSOUND::CSourceAL:

NLSOUND::ISource List of all members.

Public Methods

 CSourceAL (ALuint sourcename=AL_NONE)
 Constructor. More...

virtual ~CSourceAL ()
 Destructor. More...

ALuint sourceName ()
 Return the OpenAL source name. More...

Initialization
virtual void setStaticBuffer (IBuffer *buffer)
 Set the buffer that will be played (no streaming) If the buffer is stereo, the source mode becomes stereo and the source relative mode is on, otherwise the source is considered as a 3D source. More...

Playback control
virtual void setLooping (bool l)
 Set looping on/off for future playbacks (default: off). More...

virtual bool getLooping () const
 Return the looping state. More...

virtual bool play ()
 Play the static buffer (or stream in and play). More...

virtual void stop ()
 Stop playing. More...

virtual void pause ()
 Pause. Call play() to resume. More...

virtual bool isPlaying () const
 Return the playing state. More...

virtual bool isStopped () const
 Return true if playing is finished or stop() has been called. More...

virtual void update ()
 Update the source (e.g. continue to stream the data in). More...

Source properties
virtual void setPos (const NLMISC::CVector &pos)
 Set the position vector (default: (0,0,0)). More...

virtual const NLMISC::CVectorgetPos () const
 Get the position vector. More...

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

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

virtual void setDirection (const NLMISC::CVector &dir)
 Set the direction vector (3D mode only) (default: (0,0,0) as non-directional). More...

virtual void getDirection (NLMISC::CVector &dir) const
 Get the direction vector. More...

virtual void setGain (float gain)
 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. More...

virtual float getGain () const
 Get the gain. More...

virtual void setPitch (float pitch)
 Shift the frequency. More...

virtual float getPitch () const
 Get the pitch. More...

virtual void setSourceRelativeMode (bool mode)
 Set the source relative mode. If true, positions are interpreted relative to the listener position (default: false). More...

virtual bool getSourceRelativeMode () const
 Get the source relative mode. More...

virtual void setMinMaxDistances (float mindist, float maxdist, bool deferred)
 Set the min and max distances (default: 1, MAX_FLOAT) (3D mode only). More...

virtual void getMinMaxDistances (float &mindist, float &maxdist) const
 Get the min and max distances. More...

virtual void setCone (float innerAngle, float outerAngle, float outerGain)
 Set the cone angles (in radian) and gain (in [0 , 1]) (default: 2PI, 2PI, 0) (3D mode only). More...

virtual void getCone (float &innerAngle, float &outerAngle, float &outerGain) const
 Get the cone angles (in radian). More...

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


Private Attributes

ALuint _SourceName
NLMISC::CVector _Pos

Detailed Description

OpenAL sound source.

Note: the creation/deletion of sources and the setting of their rolloff factor are done in CSoundDriverAL.

The EAX extensions are not available on all sound cards, and currently not at all on Linux.

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 53 of file source_al.h.


Constructor & Destructor Documentation

NLSOUND::CSourceAL::CSourceAL ALuint    sourcename = AL_NONE
 

Constructor.

Definition at line 46 of file source_al.cpp.

NLSOUND::CSourceAL::~CSourceAL   [virtual]
 

Destructor.

Definition at line 53 of file source_al.cpp.


Member Function Documentation

void NLSOUND::CSourceAL::getCone float &    innerAngle,
float &    outerAngle,
float &    outerGain
const [virtual]
 

Get the cone angles (in radian).

Implements NLSOUND::ISource.

Definition at line 396 of file source_al.cpp.

References _SourceName, NLMISC::degToRad, and TestALError.

void NLSOUND::CSourceAL::getDirection NLMISC::CVector   dir const [virtual]
 

Get the direction vector.

Implements NLSOUND::ISource.

Definition at line 276 of file source_al.cpp.

References _SourceName, NLMISC::CVector::set, TestALError, and v.

float NLSOUND::CSourceAL::getGain   const [virtual]
 

Get the gain.

Implements NLSOUND::ISource.

Definition at line 303 of file source_al.cpp.

References _SourceName, and TestALError.

bool NLSOUND::CSourceAL::getLooping   const [virtual]
 

Return the looping state.

Implements NLSOUND::ISource.

Definition at line 103 of file source_al.cpp.

References _SourceName, and TestALError.

void NLSOUND::CSourceAL::getMinMaxDistances float &    mindist,
float &    maxdist
const [virtual]
 

Get the min and max distances.

Implements NLSOUND::ISource.

Definition at line 372 of file source_al.cpp.

References _SourceName, and TestALError.

float NLSOUND::CSourceAL::getPitch   const [virtual]
 

Get the pitch.

Implements NLSOUND::ISource.

Definition at line 326 of file source_al.cpp.

References _SourceName, and TestALError.

const NLMISC::CVector & NLSOUND::CSourceAL::getPos   const [virtual]
 

Get the position vector.

See setPos() for details.

Implements NLSOUND::ISource.

Definition at line 225 of file source_al.cpp.

References _Pos.

bool NLSOUND::CSourceAL::getSourceRelativeMode   const [virtual]
 

Get the source relative mode.

Implements NLSOUND::ISource.

Definition at line 348 of file source_al.cpp.

References _SourceName, and TestALError.

void NLSOUND::CSourceAL::getVelocity NLMISC::CVector   vel const [virtual]
 

Get the velocity vector.

Implements NLSOUND::ISource.

Definition at line 252 of file source_al.cpp.

References _SourceName, NLMISC::CVector::set, TestALError, and v.

bool NLSOUND::CSourceAL::isPlaying   const [virtual]
 

Return the playing state.

Implements NLSOUND::ISource.

Definition at line 178 of file source_al.cpp.

References _SourceName, and TestALError.

bool NLSOUND::CSourceAL::isStopped   const [virtual]
 

Return true if playing is finished or stop() has been called.

Implements NLSOUND::ISource.

Definition at line 190 of file source_al.cpp.

References _SourceName, and TestALError.

void NLSOUND::CSourceAL::pause   [virtual]
 

Pause. Call play() to resume.

Implements NLSOUND::ISource.

Definition at line 158 of file source_al.cpp.

References NLSOUND::ISource::_Buffer, _SourceName, nlstop, nlwarning, and TestALError.

bool NLSOUND::CSourceAL::play   [virtual]
 

Play the static buffer (or stream in and play).

Implements NLSOUND::ISource.

Definition at line 115 of file source_al.cpp.

References NLSOUND::ISource::_Buffer, _SourceName, nlstop, nlwarning, and TestALError.

void NLSOUND::CSourceAL::setCone float    innerAngle,
float    outerAngle,
float    outerGain
[virtual]
 

Set the cone angles (in radian) and gain (in [0 , 1]) (default: 2PI, 2PI, 0) (3D mode only).

Implements NLSOUND::ISource.

Definition at line 383 of file source_al.cpp.

References _SourceName, nlassert, NLMISC::radToDeg, and TestALError.

void NLSOUND::CSourceAL::setDirection const NLMISC::CVector   dir [virtual]
 

Set the direction vector (3D mode only) (default: (0,0,0) as non-directional).

Implements NLSOUND::ISource.

Definition at line 265 of file source_al.cpp.

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

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

Set any EAX source property if EAX available.

Implements NLSOUND::ISource.

Definition at line 411 of file source_al.cpp.

References _SourceName, and value.

void NLSOUND::CSourceAL::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::ISource.

Definition at line 292 of file source_al.cpp.

References _SourceName, nlassert, and TestALError.

void NLSOUND::CSourceAL::setLooping bool    l [virtual]
 

Set looping on/off for future playbacks (default: off).

Implements NLSOUND::ISource.

Definition at line 93 of file source_al.cpp.

References _SourceName, NLAISCRIPT::l, and TestALError.

void NLSOUND::CSourceAL::setMinMaxDistances float    mindist,
float    maxdist,
bool    deferred
[virtual]
 

Set the min and max distances (default: 1, MAX_FLOAT) (3D mode only).

Implements NLSOUND::ISource.

Definition at line 360 of file source_al.cpp.

References _SourceName, nlassert, and TestALError.

void NLSOUND::CSourceAL::setPitch float    pitch [virtual]
 

Shift the frequency.

1.0f equals identity, each reduction of 50% equals a pitch shift of one octave. 0 is not a legal value.

Implements NLSOUND::ISource.

Definition at line 315 of file source_al.cpp.

References _SourceName, nlassert, and TestALError.

void NLSOUND::CSourceAL::setPos const NLMISC::CVector   pos [virtual]
 

Set the position vector (default: (0,0,0)).

3D mode -> 3D position st mode -> x is the pan value (from left (-1) to right (1)), set y and z to 0

Definition at line 213 of file source_al.cpp.

References _Pos, _SourceName, TestALError, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z.

void NLSOUND::CSourceAL::setSourceRelativeMode bool    mode [virtual]
 

Set the source relative mode. If true, positions are interpreted relative to the listener position (default: false).

Implements NLSOUND::ISource.

Definition at line 338 of file source_al.cpp.

References _SourceName, and TestALError.

Referenced by setStaticBuffer.

void NLSOUND::CSourceAL::setStaticBuffer IBuffer   buffer [virtual]
 

Set the buffer that will be played (no streaming) If the buffer is stereo, the source mode becomes stereo and the source relative mode is on, otherwise the source is considered as a 3D source.

Set NULL to set "no buffer"

Reimplemented from NLSOUND::ISource.

Definition at line 64 of file source_al.cpp.

References _SourceName, setSourceRelativeMode, and TestALError.

void NLSOUND::CSourceAL::setVelocity const NLMISC::CVector   vel,
bool    deferred
[virtual]
 

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

Implements NLSOUND::ISource.

Definition at line 241 of file source_al.cpp.

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

ALuint NLSOUND::CSourceAL::sourceName   [inline]
 

Return the OpenAL source name.

Definition at line 149 of file source_al.h.

References _SourceName.

void NLSOUND::CSourceAL::stop   [virtual]
 

Stop playing.

Implements NLSOUND::ISource.

Definition at line 138 of file source_al.cpp.

References NLSOUND::ISource::_Buffer, _SourceName, nlwarning, and TestALError.

void NLSOUND::CSourceAL::update   [virtual]
 

Update the source (e.g. continue to stream the data in).

Implements NLSOUND::ISource.

Definition at line 202 of file source_al.cpp.


Member Data Documentation

NLMISC::CVector NLSOUND::CSourceAL::_Pos [private]
 

Definition at line 156 of file source_al.h.

Referenced by getPos, and setPos.

ALuint NLSOUND::CSourceAL::_SourceName [private]
 

Definition at line 154 of file source_al.h.

Referenced by getCone, getDirection, getGain, getLooping, getMinMaxDistances, getPitch, getSourceRelativeMode, getVelocity, isPlaying, isStopped, pause, play, setCone, setDirection, setEAXProperty, setGain, setLooping, setMinMaxDistances, setPitch, setPos, setSourceRelativeMode, setStaticBuffer, setVelocity, sourceName, and stop.


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