Planeshift
Public Member Functions

SoundSystem Class Reference

This is an Interface Class to the Crystalspace Soundrenderer. More...

#include <system.h>

List of all members.

Public Member Functions

void Create3dSource (csRef< iSndSysSource > &sndsource, csRef< iSndSysSource3D > &sndsource3d, float mindist, float maxdist, csVector3 pos)
 Creates a 3d Source on top of a 2d source.
void Create3DSource (csRef< iSndSysSource > &sndSource, csRef< iSndSysSource3D > &sndSource3D, float minDist, float maxDist, csVector3 pos)
 Creates a 3D source on top of a 2D source.
void CreateDirectional3dSource (csRef< iSndSysSource3D > &sndsource3d, csRef< iSndSysSource3DDirectionalSimple > &sndsourcedir, csVector3 direction, float rad)
 Creates a directional source on top of a 3d source.
void CreateDirectional3DSource (csRef< iSndSysSource3D > &sndSource3D, csRef< iSndSysSource3DDirectionalSimple > &sndSourceDir, csVector3 direction, float rad)
 Creates a directional source on top of a 3D source.
bool CreateSource (csRef< iSndSysStream > &sndStream, csRef< iSndSysSource > &sndSource)
 Create a source associated to your stream with volume 0.
bool CreateSource (csRef< iSndSysStream > &sndstream, csRef< iSndSysSource > &sndsource)
 Create a Source associated to your Stream.
bool CreateStream (csRef< iSndSysData > &snddata, int loop, int type, csRef< iSndSysStream > &sndstream)
 Creates a stream out of the given snddata.
bool CreateStream (csRef< iSndSysData > &sndData, bool loop, int type, csRef< iSndSysStream > &sndStream)
 Creates a stream out of the given sound data.
csVector3 GetListenerPosition () const
 Gets the current listener's position.
bool Initialize (iObjectRegistry *objectReg)
 initializes this object and tries to load the soundrenderer.
bool Initialize (iObjectRegistry *objectReg)
 Initializes this object by loading the CS sound renderer and creating a global listener.
void RemoveSource (csRef< iSndSysSource > &sndsource)
 Removes a Source.
void RemoveSource (csRef< iSndSysSource > &sndSource)
 Removes a source from the sound renderer.
void RemoveStream (csRef< iSndSysStream > &sndStream)
 Removes a stream from the sound renderer.
void RemoveStream (csRef< iSndSysStream > &sndstream)
 Removes a stream.
void UpdateListener (csVector3 v, csVector3 f, csVector3 t)
 Updates listener's position.
void UpdateListener (csVector3 v, csVector3 f, csVector3 t)
 Updates listener position.

Detailed Description

This is an Interface Class to the Crystalspace Soundrenderer.

This is an interface class to the CrystalSpace sound renderer.

It works like a Wrapper and has some additional functionalities but no own data/objects. All it does is simplifying access to the Soundrenderer.

It works like a wrapper and has some additional functionalities but at the moment it hasn't own data/objects. All it does is simplifying access to the sound renderer. In the future this will be the class that controls the number of active sources.

Definition at line 37 of file system.h.


Member Function Documentation

void SoundSystem::Create3dSource ( csRef< iSndSysSource > &  sndsource,
csRef< iSndSysSource3D > &  sndsource3d,
float  mindist,
float  maxdist,
csVector3  pos 
)

Creates a 3d Source on top of a 2d source.

Doesnt work of your stream type is CS_SND3D_DISABLE

Parameters:
sndsourceyour iSndSysSource object
sndsource3dyour iSndSysSource3D object
mindistdistance when volume is at max
maxdistdistance when volume is at min
pos3d position of this source
void SoundSystem::Create3DSource ( csRef< iSndSysSource > &  sndSource,
csRef< iSndSysSource3D > &  sndSource3D,
float  minDist,
float  maxDist,
csVector3  pos 
)

Creates a 3D source on top of a 2D source.

It doesn't work if your stream type is CS_SND3D_DISABLE. To remove the 3D source it is enough to remove the original 2D source.

Parameters:
sndSourceyour 2D iSndSysSource object.
sndSource3Dthe iSndSysSource3D that will contain the 3D source.
minDistgreatest distance at which the sound is played at maximum volume.
maxDistmaximum distance at which the sound can be heard.
pos3D position of this source.
void SoundSystem::CreateDirectional3dSource ( csRef< iSndSysSource3D > &  sndsource3d,
csRef< iSndSysSource3DDirectionalSimple > &  sndsourcedir,
csVector3  direction,
float  rad 
)

Creates a directional source on top of a 3d source.

Parameters:
sndsource3dyour iSndSysSource3D object
sndsourcediryour iSndSysSource3DDirectionalSimple object
directiondirection this source is emitting to
radradiation of the directional cone
void SoundSystem::CreateDirectional3DSource ( csRef< iSndSysSource3D > &  sndSource3D,
csRef< iSndSysSource3DDirectionalSimple > &  sndSourceDir,
csVector3  direction,
float  rad 
)

Creates a directional source on top of a 3D source.

To remove the 3D source it is enough to remove the original 2D source.

Parameters:
sndSource3Dyour iSndSysSource3D object.
sndSourceDirthe iSndSysSource3DDirectionalSimple object that will contain the directional source.
directiondirection this source emits to.
radradiation of the directional cone.
bool SoundSystem::CreateSource ( csRef< iSndSysStream > &  sndStream,
csRef< iSndSysSource > &  sndSource 
)

Create a source associated to your stream with volume 0.

Parameters:
sndStreamyour iSndSysStream object.
sndSourcethe iSndSysSource object that will contain the source.
Returns:
true on success, false if SoundSystem hasn't been initialized correctly.
bool SoundSystem::CreateSource ( csRef< iSndSysStream > &  sndstream,
csRef< iSndSysSource > &  sndsource 
)

Create a Source associated to your Stream.

Parameters:
sndstreamyour iSndSysStream object
sndsourceyour iSndSysSource object
bool SoundSystem::CreateStream ( csRef< iSndSysData > &  snddata,
int  loop,
int  type,
csRef< iSndSysStream > &  sndstream 
)

Creates a stream out of the given snddata.

Parameters:
snddatavalid iSndSysData object
loopLOOP or DONT_LOOP
type3dtype of this sound CS_SND3D_DISABLE=0 CS_SND3D_RELATIVE=1 or CS_SND3D_ABSOLUTE=2
sndstreamyour iSndSysStream object
bool SoundSystem::CreateStream ( csRef< iSndSysData > &  sndData,
bool  loop,
int  type,
csRef< iSndSysStream > &  sndStream 
)

Creates a stream out of the given sound data.

Parameters:
sndDatavalid iSndSysData object.
looptrue if the sound must loop, false otherwise.
type3D type of this sound; it can have these values CS_SND3D_DISABLE=0, CS_SND3D_RELATIVE=1 or CS_SND3D_ABSOLUTE=2.
sndStreamthe iSndSysStream object that will contain the stream.
Returns:
true on success, false if SoundSystem hasn't been initialized correctly.
csVector3 SoundSystem::GetListenerPosition ( ) const

Gets the current listener's position.

Returns:
a vector containing the listener position. If SoundSystem has not been initialized correctly it returns a null vector (0, 0, 0).
bool SoundSystem::Initialize ( iObjectRegistry *  objectReg)

initializes this object and tries to load the soundrenderer.

returns true or false

Parameters:
objectRegps objectreg where we find our soundrenderer
bool SoundSystem::Initialize ( iObjectRegistry *  objectReg)

Initializes this object by loading the CS sound renderer and creating a global listener.

Parameters:
objectRegps iObjectRegistry used to get the sound renderer.
Returns:
true on success, false otherwise.
void SoundSystem::RemoveSource ( csRef< iSndSysSource > &  sndsource)

Removes a Source.

Parameters:
sndsourceiSndSysSource object to remove
void SoundSystem::RemoveSource ( csRef< iSndSysSource > &  sndSource)

Removes a source from the sound renderer.

Attention:
removing the source doesn't remove its stream! Call RemoveStream for that.
Parameters:
sndSourceiSndSysSource object to remove.
void SoundSystem::RemoveStream ( csRef< iSndSysStream > &  sndStream)

Removes a stream from the sound renderer.

Parameters:
sndStreamiSndSysStream object to remove.
void SoundSystem::RemoveStream ( csRef< iSndSysStream > &  sndstream)

Removes a stream.

Parameters:
sndstreamiSndSysStream object to remove
void SoundSystem::UpdateListener ( csVector3  v,
csVector3  f,
csVector3  t 
)

Updates listener's position.

Parameters:
vviewpoint or for that matter hearpoint.
ffront.
ttop.
void SoundSystem::UpdateListener ( csVector3  v,
csVector3  f,
csVector3  t 
)

Updates listener position.

Parameters:
vviewpoint or for that matter hearpoint
ffront
ttop

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