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

imuse_channel Class Reference

class for a IACT sound channel (a The Dig track) More...

#include <channel.h>

Inheritance diagram for imuse_channel:

Inheritance graph
[legend]
Collaboration diagram for imuse_channel:

Collaboration graph
[legend]
List of all members.

Public Methods

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

bool set_parameters (int nbframes, int size, int unk1, int unk2) throw (std::exception)
 debugging do not use.

bool check_parameters (int index, int nbframes, int size, int unk1, int unk2) 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

int resample_mono (int size) throw (std::exception)
int resample_stereo (int size) throw (std::exception)
int decode (int size, int &) throw (std::exception)
bool processBuffer () throw (std::exception)
bool handleMap (chunck &)
bool handleFormat (chunck &)
bool handleText (chunck &)
bool handleRegion (chunck &)
bool handleStop (chunck &)

Private Attributes

int _track
 the track number

unsigned char * _buffer
 the buffer that contain the iMUS chunck

short * _decoded_buffer
 a buffer for the decoded sound data

short * _resampled_buffer
 a buffer for the resampled sound data

int _buffer_size
 the size of the iMUS buffer

int _frequency
 the target frequency of the mixer

int _cur_buffer_write_pos
 the current write position in the iMUS buffer

int _cur_buffer_read_pos
 the current read position in the iMUS buffer

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

int _data_size
 remaining size of sound data in the iMUS buffer

int _size
int _nbframes
int _unk1
int _unk2
int _index
int _bitsize
 the bitsize of the original data

int _rate
 the sampling rate of the original data

int _channels
 the number of channels of the original data

int _imuse_start
int _imuse_length
int _imuse_stop
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 IACT sound channel (a The Dig track)

This class implements a channel specifically for The Dig.

Bug:
for unknown reason, some sound have a too long duration, or repeat themselves.

Definition at line 178 of file channel.h.


Constructor & Destructor Documentation

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

Definition at line 258 of file channel.cpp.

imuse_channel::~imuse_channel   throw () [virtual]
 

Definition at line 272 of file channel.cpp.


Member Function Documentation

bool imuse_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 338 of file channel.cpp.

References from_big_endian(), and chunck::type.

int imuse_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 628 of file channel.cpp.

bool imuse_channel::check_parameters int    index,
int    nbframes,
int    size,
int    unk1,
int    unk2
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 313 of file channel.cpp.

int imuse_channel::decode int    size,
int &   
throw (std::exception) [protected]
 

Definition at line 535 of file channel.cpp.

bool imuse_channel::handleFormat chunck   [protected]
 

Definition at line 370 of file channel.cpp.

References _bitsize, _channels, _imuse_start, _rate, from_big_endian(), chunck::get_dword(), chunck::get_size(), and chunck::seek().

Referenced by handleMap().

bool imuse_channel::handleMap chunck   [protected]
 

Definition at line 426 of file channel.cpp.

References chunck::chunck_string(), chunck::eof(), chunck::get_size(), chunck::get_type(), handleFormat(), handleRegion(), handleStop(), handleText(), and chunck::sub_block().

bool imuse_channel::handleRegion chunck   [protected]
 

Definition at line 404 of file channel.cpp.

References _imuse_length, _imuse_start, from_big_endian(), chunck::get_dword(), chunck::get_size(), and chunck::seek().

Referenced by handleMap().

bool imuse_channel::handleStop chunck   [protected]
 

Definition at line 417 of file channel.cpp.

References _imuse_length, _imuse_start, _imuse_stop, from_big_endian(), chunck::get_dword(), and chunck::get_size().

Referenced by handleMap().

bool imuse_channel::handleText chunck   [protected]
 

Definition at line 388 of file channel.cpp.

References _imuse_start, from_big_endian(), chunck::get_dword(), chunck::get_size(), and chunck::read().

Referenced by handleMap().

bool imuse_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 291 of file channel.cpp.

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

Definition at line 578 of file channel.cpp.

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

void imuse_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 647 of file channel.cpp.

int imuse_channel::resample_mono int    size throw (std::exception) [protected]
 

Definition at line 453 of file channel.cpp.

int imuse_channel::resample_stereo int    size throw (std::exception) [protected]
 

Definition at line 492 of file channel.cpp.

bool imuse_channel::set_parameters int    nbframes,
int    size,
int    unk1,
int    unk2
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 300 of file channel.cpp.


Member Data Documentation

int imuse_channel::_bitsize [private]
 

the bitsize of the original data

Definition at line 195 of file channel.h.

Referenced by handleFormat().

unsigned char* imuse_channel::_buffer [private]
 

the buffer that contain the iMUS chunck

Definition at line 181 of file channel.h.

int imuse_channel::_buffer_size [private]
 

the size of the iMUS buffer

Definition at line 184 of file channel.h.

int imuse_channel::_channels [private]
 

the number of channels of the original data

Definition at line 197 of file channel.h.

Referenced by handleFormat().

int imuse_channel::_cur_buffer_read_pos [private]
 

the current read position in the iMUS buffer

Definition at line 187 of file channel.h.

int imuse_channel::_cur_buffer_write_pos [private]
 

the current write position in the iMUS buffer

Definition at line 186 of file channel.h.

int imuse_channel::_data_size [private]
 

remaining size of sound data in the iMUS buffer

Definition at line 189 of file channel.h.

int imuse_channel::_data_start [private]
 

the start of the sound data in the iMUS buffer

Definition at line 188 of file channel.h.

short* imuse_channel::_decoded_buffer [private]
 

a buffer for the decoded sound data

Definition at line 182 of file channel.h.

int imuse_channel::_frequency [private]
 

the target frequency of the mixer

Definition at line 185 of file channel.h.

int imuse_channel::_imuse_length [private]
 

Definition at line 199 of file channel.h.

Referenced by handleRegion(), and handleStop().

int imuse_channel::_imuse_start [private]
 

Definition at line 198 of file channel.h.

Referenced by handleFormat(), handleRegion(), handleStop(), and handleText().

int imuse_channel::_imuse_stop [private]
 

Definition at line 200 of file channel.h.

Referenced by handleStop().

int imuse_channel::_index [private]
 

Definition at line 194 of file channel.h.

int imuse_channel::_nbframes [private]
 

Definition at line 191 of file channel.h.

int imuse_channel::_rate [private]
 

the sampling rate of the original data

Definition at line 196 of file channel.h.

Referenced by handleFormat().

int imuse_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 202 of file channel.h.

int imuse_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 201 of file channel.h.

short* imuse_channel::_resampled_buffer [private]
 

a buffer for the resampled sound data

Definition at line 183 of file channel.h.

int imuse_channel::_size [private]
 

Definition at line 190 of file channel.h.

int imuse_channel::_track [private]
 

the track number

Definition at line 180 of file channel.h.

int imuse_channel::_unk1 [private]
 

Definition at line 192 of file channel.h.

int imuse_channel::_unk2 [private]
 

Definition at line 193 of file channel.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