openalpp::SourceBase Class Reference

#include <sourcebase.h>

Inheritance diagram for openalpp::SourceBase:

openalpp::PositionedObject openalpp::AudioBase openalpp::Referenced openalpp::GroupSource openalpp::Source List of all members.

Public Member Functions

void play ()
void pause ()
void stop ()
void rewind ()
SourceState getState () const
void setLooping (bool loop=true)
bool isLooping () const
bool isPaused () const
void setDirection (float directionx, float directiony, float directionz)
void getDirection (float &directionx, float &directiony, float &directionz) const
void makeOmniDirectional ()
void setSoundCone (float innerangle, float outerangle=360.0, float outergain=0.0)
void getSoundCone (float &innerangle, float &outerangle, float &outergain) const
void setGain (float gain)
float getGain () const
void setMinMaxGain (float min=0.0, float max=1.0)
void getMinMaxGain (float &min, float &max) const
void setAmbient (bool ambient=true)
bool isAmbient () const
void setRelative (bool relative=true)
bool isRelative () const
void setReferenceDistance (float distance=1.0)
float getReferenceDistance () const
void setMaxDistance (float distance)
float getMaxDistance () const
void setRolloffFactor (float factor=1.0)
float getRolloffFactor () const
void setPitch (float pitch=1.0)
float getPitch () const
void setReverbScale (float scale) throw (InitError,ValueError)
void setReverbDelay (float delay) throw (InitError,ValueError)
float getReverbDelay () throw (InitError)
float getReverbScale () throw (InitError)
ALuint link (const SourceBase *source) throw (MemoryError)
void unlink (const SourceBase *source) throw (NameError)
void unlink (const ALuint name) throw (NameError)
void unlinkAll ()
ALuint getAlSource () const
void setPosition (float x, float y, float z)
void getPosition (float &x, float &y, float &z) const
void setVelocity (float vx, float vy, float vz)
void getVelocity (float &vx, float &vy, float &vz) const
SourceBaseoperator= (const SourceBase &sourcebase)

Protected Member Functions

virtual ~SourceBase ()
 SourceBase () throw (MemoryError,NameError)
 SourceBase (float x, float y, float z) throw (MemoryError,NameError)
 SourceBase (const SourceBase &sourcebase)

Protected Attributes

ALuint sourcename_
bool streaming_

Detailed Description

Base class for sources. This class holds functions for playing, setting position etc. However, it cannot be instantiated, instead a source of either type (GroupSource or Source) should be created.


Constructor & Destructor Documentation

virtual openalpp::SourceBase::~SourceBase  )  [protected, virtual]
 

Destructor.

openalpp::SourceBase::SourceBase  )  throw (MemoryError,NameError) [protected]
 

Constructor.

openalpp::SourceBase::SourceBase float  x,
float  y,
float  z
throw (MemoryError,NameError) [protected]
 

Constructor.

Parameters:
x x coordinate.
y y coordinate.
z z coordinate.

openalpp::SourceBase::SourceBase const SourceBase sourcebase  )  [protected]
 

Copy constructor.


Member Function Documentation

ALuint openalpp::SourceBase::getAlSource  )  const
 

Returns the OpenAL name of the source. Can be used to directly modify the source with OpenAL functions.

void openalpp::SourceBase::getDirection float &  directionx,
float &  directiony,
float &  directionz
const
 

Gets the direction of the source.

Parameters:
directionx x value of the direction vector.
directiony y value of the direction vector.
directionz z value of the direction vector.

float openalpp::SourceBase::getGain  )  const
 

Gets the gain (volume).

Returns:
gain.

float openalpp::SourceBase::getMaxDistance  )  const
 

Gets the maximum distance.

Returns:
maximum distance.

void openalpp::SourceBase::getMinMaxGain float &  min,
float &  max
const
 

Gets maximum and minumum gain.

Parameters:
min is minimum gain.
max is maximum gain.

float openalpp::SourceBase::getPitch  )  const
 

Gets the pitch.

Returns:
pitch.

void openalpp::SourceBase::getPosition float &  x,
float &  y,
float &  z
const [virtual]
 

Inherited from PositionedObject.

Implements openalpp::PositionedObject.

float openalpp::SourceBase::getReferenceDistance  )  const
 

Gets the reference distance.

Returns:
reference distance.

float openalpp::SourceBase::getReverbDelay  )  throw (InitError)
 

Get reverb delay for this source.

Returns:
the delay.

float openalpp::SourceBase::getReverbScale  )  throw (InitError)
 

Get reverb scale for this source.

Returns:
the scale.

float openalpp::SourceBase::getRolloffFactor  )  const
 

Gets the roll-off factor.

Returns:
rolloff factor.

void openalpp::SourceBase::getSoundCone float &  innerangle,
float &  outerangle,
float &  outergain
const
 

Gets the sound cone parameters.

Parameters:
innerangle specifies the inner cone.
outerangle specifies the outer cone.
outergain specifies the gain outside the outer cone.

SourceState openalpp::SourceBase::getState  )  const
 

Get the current state.

Returns:
one of Initial,Playing,Paused,Stopped

void openalpp::SourceBase::getVelocity float &  vx,
float &  vy,
float &  vz
const [virtual]
 

Inherited from PositionedObject.

Implements openalpp::PositionedObject.

bool openalpp::SourceBase::isAmbient  )  const
 

Check if the source is ambient.

Returns:
true if the source is ambient, false otherwise.

bool openalpp::SourceBase::isLooping  )  const
 

Check whether the source is looping.

Returns:
true if it's looping, false otherwise.

bool openalpp::SourceBase::isPaused  )  const
 

Returns:
true if source is paused, false otherwise.

bool openalpp::SourceBase::isRelative  )  const
 

Check if the source's position is relative.

Returns:
true if the source is relative, false otherwise.

ALuint openalpp::SourceBase::link const SourceBase source  )  throw (MemoryError)
 

Link this source to another. This causes calls to Play(), Pause(), Stop() and Rewind() (on this source) to be applied to all sources this has been linked to, synchronously.

Parameters:
source is the source to link to.
Returns:
identifier for the linked source. This is also the OpenAL name for it.

void openalpp::SourceBase::makeOmniDirectional  ) 
 

Makes the source omni-directional. The same effect can be achieved by calling SetDirection(0,0,0)

SourceBase& openalpp::SourceBase::operator= const SourceBase sourcebase  ) 
 

Assignment operator.

void openalpp::SourceBase::pause  ) 
 

Pause the source.

Reimplemented in openalpp::Source.

void openalpp::SourceBase::play  ) 
 

Play the source.

Reimplemented in openalpp::GroupSource, and openalpp::Source.

void openalpp::SourceBase::rewind  ) 
 

Rewind the source.

void openalpp::SourceBase::setAmbient bool  ambient = true  ) 
 

Makes the source ambient (or makes it stop being ambient). This function _will_ change the source's position, direction and roll-off factor.

Parameters:
ambient is true if the source should be ambient, false otherwise.

void openalpp::SourceBase::setDirection float  directionx,
float  directiony,
float  directionz
 

Sets the direction of the source.

Parameters:
directionx x value of the direction vector.
directiony y value of the direction vector.
directionz z value of the direction vector.

void openalpp::SourceBase::setGain float  gain  ) 
 

Sets gain (volume). The volume a source will be played at will be multiplied by this _after_ the attenuation calculations. Note: In todays's implementation on Linux, gain is clamped to [0.0,1.0]. This will be changed in future releases of OpenAL.

Parameters:
gain is the gain [0.0,...

void openalpp::SourceBase::setLooping bool  loop = true  ) 
 

Turn on/off looping.

Parameters:
loop is true if the source should loop, false otherwise.

void openalpp::SourceBase::setMaxDistance float  distance  ) 
 

Sets the maximum distance. This is used in attenuation calculations, if the distance model is InverseDistanceClamped.

Parameters:
distance is the maximum distance.

void openalpp::SourceBase::setMinMaxGain float  min = 0.0,
float  max = 1.0
 

Sets maximum and minimum gain this source will be played at. I.e. the gain will be clamped to these values.

Parameters:
min is minimum gain.
max is maximum gain.

void openalpp::SourceBase::setPitch float  pitch = 1.0  ) 
 

Sets the pitch. 1.0 is normal. Each reduction by 50% equals a reduction by one octave.

Parameters:
pitch is the pitch (0.0,1.0].

void openalpp::SourceBase::setPosition float  x,
float  y,
float  z
[virtual]
 

Inherited from PositionedObject.

Implements openalpp::PositionedObject.

void openalpp::SourceBase::setReferenceDistance float  distance = 1.0  ) 
 

Sets the reference distance for this source. The reference distance is used in attenuation calculations.

Parameters:
distance is the reference distance.

void openalpp::SourceBase::setRelative bool  relative = true  ) 
 

Makes the source's position relative (or makes it stop being relative). This means that the position in space will not be absolute, but rather relative to the listener.

Parameters:
relative is true if the source should be relative, false otherwise.

void openalpp::SourceBase::setReverbDelay float  delay  )  throw (InitError,ValueError)
 

Set reverb delay for this source. AudioEnviroment::InitiateReverb() must be called before using this. This is how many seconds back in time the echo will be.

Parameters:
delay is the delay [0.0-2.0] in seconds.

void openalpp::SourceBase::setReverbScale float  scale  )  throw (InitError,ValueError)
 

Set reverb scale for this source. This is simply the scale of the "echo." AudioEnviroment::InitiateReverb() must be called before this.

Parameters:
scale is the reverb scale [0.0-1.0].

void openalpp::SourceBase::setRolloffFactor float  factor = 1.0  ) 
 

Sets the roll-off factor. This is used in distance attenuation calculations.

Parameters:
factor is the rolloff factor.

void openalpp::SourceBase::setSoundCone float  innerangle,
float  outerangle = 360.0,
float  outergain = 0.0
 

Sets the sound cone parameters for a directional sound source. This function has no effect on omni-directional sources. Two cones, with the top at the source, and turned the same direction as the source, are defined by this. Inside the inner cone (specified by innerangle), sound will be played at full volume (attenuated by distance), and outside the outer cone (specified by outerangle) sound will be played at the volume specified by outergain. Between these areas, the sound volume will be interpolated between normal gain and outergain.

Parameters:
innerangle specifies the inner cone.
outerangle specifies the outer cone.
outergain specifies the gain outside the outer cone.

void openalpp::SourceBase::setVelocity float  vx,
float  vy,
float  vz
[virtual]
 

Inherited from PositionedObject.

Implements openalpp::PositionedObject.

void openalpp::SourceBase::stop  ) 
 

Stop the source.

Reimplemented in openalpp::Source.

void openalpp::SourceBase::unlink const ALuint  name  )  throw (NameError)
 

Unlink this source from another.

Parameters:
name is the name of the source to unlink.

void openalpp::SourceBase::unlink const SourceBase source  )  throw (NameError)
 

Unlink this source from another.

Parameters:
source is the source to unlink.

void openalpp::SourceBase::unlinkAll  ) 
 

Unlink all sources from this.


Member Data Documentation

ALuint openalpp::SourceBase::sourcename_ [protected]
 

OpenAL name for this source.

bool openalpp::SourceBase::streaming_ [protected]
 

Flag for whether the source is streaming.


The documentation for this class was generated from the following file:
Generated on Thu May 18 00:49:38 2006 for openalpp by  doxygen 1.4.6