Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

mixer Class Reference

The class for the player's sound mixer. More...

#include <mixer.h>

Collaboration diagram for mixer:

Collaboration graph
[legend]
List of all members.

Public Methods

 mixer () throw ()
int get_frequency () const throw ()
virtual ~mixer () throw ()
bool init (sound_renderer *out, int freq, int size) throw ()
 mixer initialisation

channelfind_channel (int track) throw ()
 channel lookup

bool add_channel (int track, channel *c) throw (std::exception)
 add a channel to the mixer

bool handle_frame () throw (std::exception)
 performing mixing for a frame of the animation

bool stop () throw (std::exception)
 stop the mixer


Private Attributes

std::map< int, channel * > _channels
 The map of track and channels.

int _frequency
 The mixer's frequency.

short * _sound
 Internal mixed sound buffer.

sound_renderer_out
 The sound renderer to send mixed sound data to.


Detailed Description

The class for the player's sound mixer.

This class is used for sound mixing. It contains a list of current track and request them to mix. It then sends the mixed sound samples to the sound renderer.

Definition at line 51 of file mixer.h.


Constructor & Destructor Documentation

mixer::mixer   throw ()
 

Definition at line 33 of file mixer.cpp.

mixer::~mixer   throw () [virtual]
 

Definition at line 51 of file mixer.cpp.


Member Function Documentation

bool mixer::add_channel int    track,
channel   c
throw (std::exception)
 

add a channel to the mixer

This method allow to add a channel to the mixer.

Parameters:
track  the track identifier.
c  the channel to add.
Returns:
true if everything went fine, false otherwise

Definition at line 66 of file mixer.cpp.

channel * mixer::find_channel int    track throw ()
 

channel lookup

This method allow to search for a particular channel, identified by it's track identifier.

Parameters:
track  the track identifier.
Returns:
a pointer if the channel exist, 0 otherwise

Definition at line 60 of file mixer.cpp.

int mixer::get_frequency   const throw () [inline]
 

Definition at line 59 of file mixer.h.

References _frequency.

bool mixer::handle_frame   throw (std::exception)
 

performing mixing for a frame of the animation

This method request that the mixer generates the sound data for the current frame and send it to the sound renderer.

Returns:
true if everything went fine, false otherwise

Definition at line 76 of file mixer.cpp.

bool mixer::init sound_renderer   out,
int    freq,
int    size
throw ()
 

mixer initialisation

This method initialize the sound mixer.

Parameters:
out  the sound renderer to send data to. must NOT be initialized, because it will be initialized by this method.
freq  the output frequency.
size  the recommended size of the internal sound buffer (unused)
Returns:
true if initialization was done successfully, false otherwise

Definition at line 36 of file mixer.cpp.

bool mixer::stop   throw (std::exception)
 

stop the mixer

Returns:
true if everything went fine, false otherwise

Definition at line 45 of file mixer.cpp.


Member Data Documentation

std::map<int, channel *> mixer::_channels [private]
 

The map of track and channels.

Definition at line 53 of file mixer.h.

int mixer::_frequency [private]
 

The mixer's frequency.

Definition at line 54 of file mixer.h.

Referenced by get_frequency().

sound_renderer* mixer::_out [private]
 

The sound renderer to send mixed sound data to.

Definition at line 56 of file mixer.h.

short* mixer::_sound [private]
 

Internal mixed sound buffer.

Definition at line 55 of file mixer.h.


The documentation for this class was generated from the following files:
Generated on Fri Aug 9 22:54:32 2002 for san_player by doxygen1.2.16