Cafu Engine
MixerTrackT Class Reference

A mixer track represents/encapsulates/abstracs an OpenAL sound source. More...

#include "MixerTrack.hpp"

Public Member Functions

 MixerTrackT ()
 The constructor. Throws an exception of type std::runtime_error on failure. More...
 
 ~MixerTrackT ()
 The destructor. Stops the sound, detaches, and releases the OpenAL source. More...
 
bool Play (SoundImplT *Sound)
 Plays a sound. More...
 
void Pause ()
 Pauses the currently played sound. More...
 
void Resume ()
 Resumes a previously paused sound. More...
 
void StopAndDetach ()
 Stops the currently played sound and detaches it from this mixer track. More...
 
bool IsPlaying ()
 Checks if this mixer track is playing the sound currently attached to it. More...
 
bool IsUsed ()
 Checks if this mixer track is currently used the sound currently attached to it. More...
 
unsigned int GetPriority ()
 Returns information about the priority of the currently played sound object. More...
 
void Update ()
 Updates the mixer track according to the attached sound. More...
 
ALuint GetOpenALSource () const
 Returns the handle to the OpenAL "source" that is encapsulated by this mixer track. More...
 

Detailed Description

A mixer track represents/encapsulates/abstracs an OpenAL sound source.

Playing a sound assigns a mixer track to the sound (and the sounds buffer to the mixer track). A mixer track can only be assigned to and play back one sound at a time. Mixer tracks are a limited resource; they are reused and managed by the MixerTrackManT singleton.

Constructor & Destructor Documentation

MixerTrackT::MixerTrackT ( )

The constructor. Throws an exception of type std::runtime_error on failure.

MixerTrackT::~MixerTrackT ( )

The destructor. Stops the sound, detaches, and releases the OpenAL source.

Member Function Documentation

ALuint MixerTrackT::GetOpenALSource ( ) const
inline

Returns the handle to the OpenAL "source" that is encapsulated by this mixer track.

unsigned int MixerTrackT::GetPriority ( )

Returns information about the priority of the currently played sound object.

Returns
Priority of the currently played sound object. Higher values mean higher priority.
bool MixerTrackT::IsPlaying ( )

Checks if this mixer track is playing the sound currently attached to it.

Returns
Whether the sound is currently playing.
bool MixerTrackT::IsUsed ( )

Checks if this mixer track is currently used the sound currently attached to it.

This is more general than IsPlaying() since it also returns mixer tracks as used if the sound attached to them is not playing but paused. Stopped sounds will result don't mark a mixer track as used.

Returns
Whether the mixer track is currently used.
void MixerTrackT::Pause ( )

Pauses the currently played sound.

bool MixerTrackT::Play ( SoundImplT Sound)

Plays a sound.

The previously assigned sound is stopped and detached, the new sound is attached and played.

Parameters
SoundThe sound to play.
Returns
whether the attempt to play the sound was succesful.
void MixerTrackT::Resume ( )

Resumes a previously paused sound.

void MixerTrackT::StopAndDetach ( )

Stops the currently played sound and detaches it from this mixer track.

void MixerTrackT::Update ( )

Updates the mixer track according to the attached sound.

Updated attributes include the position, velocity and direction, as well as shader attributes like the minimal distance, the volume, etc.


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