Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals

Ars::Sounds Class Reference

#include <arssound.h>


Public Member Functions

 Sounds (void)
 ~Sounds (void)
const bool Load (const string &aSection, const string &akey, string aCfgFile="")
const bool Load (const string &aFilename)
void Configure (const int channel=0, const int nr=0, const int ticks=-1)
void Play (const int channel=-2, const int nr=-2, const int ticks=-2)
 operator Mix_Chunk * (void)
const bool operator== (const Sounds &snd)

Protected Attributes

Mix_Chunk * wave
int channel
int ticks
int loop
int id


Constructor & Destructor Documentation

Ars::Sounds::Sounds void   ) 
 

Definition at line 7 of file arssound.cpp.

References Ars::cnt.

00008 : loop( 0 ) , ticks( -1 ) , channel( 0 ) , wave( 0 ) , id( ++cnt )
00009 {
00010 }

Ars::Sounds::~Sounds void   ) 
 

Definition at line 12 of file arssound.cpp.

References wave.

00013 {
00014         if( wave )
00015                 Mix_FreeChunk( wave );
00016         wave = 0;
00017 }


Member Function Documentation

void Ars::Sounds::Configure const int  channel = 0,
const int  nr = 0,
const int  ticks = -1
 

Definition at line 19 of file arssound.cpp.

References channel, loop, and ticks.

Referenced by Play().

00020 {
00021         if( nr != -2 )
00022                 loop = nr;
00023         if( aChannel != -2 )
00024                 channel = aChannel;
00025         if( aTicks != -2 )
00026                 ticks = aTicks;
00027 }

const bool Ars::Sounds::Load const string &  aFilename  ) 
 

Definition at line 45 of file arssound.cpp.

References wave.

00046 {
00047         if( wave )
00048                 Mix_FreeChunk( wave );
00049 
00050         wave = Mix_LoadWAV( aFilename.c_str() );
00051         return wave != 0;
00052 }

const bool Ars::Sounds::Load const string &  aSection,
const string &  akey,
string  aCfgFile = ""
 

Definition at line 36 of file arssound.cpp.

References Cfg::GetCfg(), and Cfg::Handler::GetCfgFile().

Referenced by Ars::AddSound().

00037 {
00038         if( aCfgFile.empty() )
00039                 aCfgFile = Cfg::GetCfg().GetCfgFile( "Paths" , "sounds" );
00040         Cfg::Handler &h = Cfg::GetCfg( aCfgFile );
00041 
00042         return Load( h.GetCfgFile( aSection , akey ) );
00043 }

Ars::Sounds::operator Mix_Chunk * void   )  [inline]
 

Definition at line 42 of file arssound.h.

References wave.

00042 {       return wave;    } 

const bool Ars::Sounds::operator== const Sounds snd  )  [inline]
 

Definition at line 43 of file arssound.h.

References id.

00043 {       return id == snd.id;    }

void Ars::Sounds::Play const int  channel = -2,
const int  nr = -2,
const int  ticks = -2
 

Definition at line 29 of file arssound.cpp.

References channel, Configure(), loop, ticks, and wave.

Referenced by Ars::Window::evMouseButtonUp().

00030 {
00031         Configure( aChannel , nr , aTicks );
00032         if( wave )
00033                 Mix_PlayChannelTimed( channel , wave , loop , ticks );
00034 }


Field Documentation

int Ars::Sounds::channel [protected]
 

Definition at line 25 of file arssound.h.

Referenced by Configure(), and Play().

int Ars::Sounds::id [protected]
 

Definition at line 28 of file arssound.h.

Referenced by operator==().

int Ars::Sounds::loop [protected]
 

Definition at line 27 of file arssound.h.

Referenced by Configure(), and Play().

int Ars::Sounds::ticks [protected]
 

Definition at line 26 of file arssound.h.

Referenced by Configure(), and Play().

Mix_Chunk* Ars::Sounds::wave [protected]
 

Definition at line 23 of file arssound.h.

Referenced by Load(), operator Mix_Chunk *(), Play(), and ~Sounds().


The documentation for this class was generated from the following files:
Generated on Fri Dec 5 04:06:48 2003 for Borqueror by doxygen 1.3.3