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

saud_channel Class Reference

class for a SAUD sound channel (a Full Throttle track) More...

#include <channel.h>

Inheritance diagram for saud_channel:

Inheritance graph
[legend]
Collaboration diagram for saud_channel:

Collaboration graph
[legend]
List of all members.

Public Methods

 saud_channel (int track, int freq) throw ()
virtual ~saud_channel () throw ()
bool is_terminated () const throw ()
 is the track terminated ?

bool set_parameters (int duration, int flags, int vol1, int vol2) throw (std::exception)
 debugging do not use.

bool check_parameters (int index, int duration, int flags, int vol1, int vol2) throw (std::exception)
 debugging do not use.

bool append_data (chunck &b, int size) throw (std::exception)
 appends coded sound data to the track.

int available_sound_data () const throw ()
 get the number of samples currently available in the channel.

void read_sound_data (short *sound_buffer, int size) throw (std::exception)
 read some sound data from the channel.


Protected Methods

void handleStrk (chunck &c) throw (std::exception)
 STRK chunck handling.

void handleSmrk (chunck &c) throw (std::exception)
 SMRK chunck handling.

void handleShdr (chunck &c) throw (std::exception)
 SHDR chunck handling.

bool processBuffer () throw (std::exception)
 SAUD buffer processing.

void recalcVolumeTable () throw (std::exception)
 volume table calculation.


Private Attributes

int _track
 The track identifier.

int _nbframes
 number of frames of the track (unused)

unsigned char * _buffer
 SAUD buffer.

int _buffer_size
 the size of the sound buffer

int _frequency
 the frequency target of the track (always 22050)

int _cur_buffer_write_pos
 the current write position in the SAUD buffer

int _cur_buffer_read_pos
 the current read position in the SAUD buffer

int _data_start
 the start of the sound data in the SAUD buffer

int _data_size
 remaining size of sound data in the SAUD buffer

bool _mark_reached
 set to true when the SMRK tag is reached

int _flags
 current flags of the track (unused)

int _volume
 the current track volume

int _balance
 the current track balance

int _index
 the current PSAD index (for coherency checking)

short _voltable [2][256]
 the precalculated volume table (stereo 16 bits)

int _rdata_start
 a copy of _data_start that is not modified by read_sound_data(). Used to save the sound data to a file.

int _rdata_size
 a copy of _data_size that is not modified by read_sound_data(). Used to save the sound data to a file.


Detailed Description

class for a SAUD sound channel (a Full Throttle track)

This class implements a channel specifically for Full Throttle.

Definition at line 107 of file channel.h.


Constructor & Destructor Documentation

saud_channel::saud_channel int    track,
int    freq
throw ()
 

Definition at line 130 of file channel.cpp.

saud_channel::~saud_channel   throw () [virtual]
 

Definition at line 144 of file channel.cpp.

References win32_save_as_wave().


Member Function Documentation

bool saud_channel::append_data chunck   b,
int    size
throw (std::exception) [virtual]
 

appends coded sound data to the track.

This method is called by the player from time to time when new data is available for the track.

Parameters:
b  the chunck to read data from.
size  the size of the data to read.
Returns:
true if everything went fine, false otherwise

Implements channel.

Definition at line 217 of file channel.cpp.

References from_big_endian(), and chunck::type.

int saud_channel::available_sound_data   const throw () [virtual]
 

get the number of samples currently available in the channel.

This method is called by the mixer from time to time to get the current number of samples available.

Remarks:
If a track has no more available data, it does not necesseraly means that it is terminated.
Returns:
the number of samples available

Implements channel.

Definition at line 254 of file channel.cpp.

bool saud_channel::check_parameters int    index,
int    duration,
int    flags,
int    vol1,
int    vol2
throw (std::exception) [virtual]
 

debugging do not use.

This method is called by player to perform integrity check on the unknown parameters in the chuncks. There is no real other point than to check a few assertions in using this method.

Implements channel.

Definition at line 203 of file channel.cpp.

void saud_channel::handleShdr chunck   c throw (std::exception) [protected]
 

SHDR chunck handling.

This method contain the handling of the SHDR sub-chunck.

Parameters:
c  the SHDR chunck to handle.

Definition at line 74 of file channel.cpp.

void saud_channel::handleSmrk chunck   c throw (std::exception) [protected]
 

SMRK chunck handling.

This method contain the handling of the SMRK sub-chunck.

Parameters:
c  the SMRK chunck to handle.

Definition at line 59 of file channel.cpp.

void saud_channel::handleStrk chunck   c throw (std::exception) [protected]
 

STRK chunck handling.

This method contain the handling of the STRK sub-chunck.

Parameters:
c  the STRK chunck to handle.

Definition at line 37 of file channel.cpp.

References from_big_endian().

bool saud_channel::is_terminated   const throw () [virtual]
 

is the track terminated ?

This method is called by the mixer from time to time to check if the track is terminated.

Remarks:
If a track has no more available data, it does not necesseraly means that it is terminated.
Returns:
true if the sound channel is terminated, false otherwise

Implements channel.

Definition at line 158 of file channel.cpp.

bool saud_channel::processBuffer   throw (std::exception) [protected]
 

SAUD buffer processing.

this method is called by append_data to check if something can be done from the available data.

Returns:
true if everything went fine, false otherwise

Definition at line 83 of file channel.cpp.

References chunck::chunck_string(), from_big_endian(), and chunck::type.

void saud_channel::read_sound_data short *    sound_buffer,
int    size
throw (std::exception) [virtual]
 

read some sound data from the channel.

This method is called by the mixer from time to time to get the current number of samples available.

Parameters:
sound_buffer  the buffer to write data to.
size  the size of the data to write (in samples).
Remarks:
The sound_buffer may already has been set by another track, so the track should add to it.
Returns:
the number of samples available

Implements channel.

Definition at line 238 of file channel.cpp.

void saud_channel::recalcVolumeTable   throw (std::exception) [protected]
 

volume table calculation.

This method is called when the _volume or the _balance change. This method fills the _voltable tables.

Definition at line 167 of file channel.cpp.

bool saud_channel::set_parameters int    duration,
int    flags,
int    vol1,
int    vol2
throw (std::exception) [virtual]
 

debugging do not use.

This method is called by player to perform integrity check on the unknown parameters in the chuncks. There is no real other point than to check a few assertions in using this method.

Implements channel.

Definition at line 189 of file channel.cpp.


Member Data Documentation

int saud_channel::_balance [private]
 

the current track balance

Definition at line 121 of file channel.h.

unsigned char* saud_channel::_buffer [private]
 

SAUD buffer.

Definition at line 111 of file channel.h.

int saud_channel::_buffer_size [private]
 

the size of the sound buffer

Definition at line 112 of file channel.h.

int saud_channel::_cur_buffer_read_pos [private]
 

the current read position in the SAUD buffer

Definition at line 115 of file channel.h.

int saud_channel::_cur_buffer_write_pos [private]
 

the current write position in the SAUD buffer

Definition at line 114 of file channel.h.

int saud_channel::_data_size [private]
 

remaining size of sound data in the SAUD buffer

Definition at line 117 of file channel.h.

int saud_channel::_data_start [private]
 

the start of the sound data in the SAUD buffer

Definition at line 116 of file channel.h.

int saud_channel::_flags [private]
 

current flags of the track (unused)

Definition at line 119 of file channel.h.

int saud_channel::_frequency [private]
 

the frequency target of the track (always 22050)

Definition at line 113 of file channel.h.

int saud_channel::_index [private]
 

the current PSAD index (for coherency checking)

Definition at line 122 of file channel.h.

bool saud_channel::_mark_reached [private]
 

set to true when the SMRK tag is reached

Definition at line 118 of file channel.h.

int saud_channel::_nbframes [private]
 

number of frames of the track (unused)

Definition at line 110 of file channel.h.

int saud_channel::_rdata_size [private]
 

a copy of _data_size that is not modified by read_sound_data(). Used to save the sound data to a file.

Definition at line 125 of file channel.h.

int saud_channel::_rdata_start [private]
 

a copy of _data_start that is not modified by read_sound_data(). Used to save the sound data to a file.

Definition at line 124 of file channel.h.

int saud_channel::_track [private]
 

The track identifier.

Definition at line 109 of file channel.h.

short saud_channel::_voltable[2][256] [private]
 

the precalculated volume table (stereo 16 bits)

Definition at line 123 of file channel.h.

int saud_channel::_volume [private]
 

the current track volume

Definition at line 120 of file channel.h.


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