Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ZE::ZSound Class Reference

#include <ZE_ZSound.h>

Inherits ZE::ZObject.

List of all members.


Detailed Description

ZSound music class, class wraps common features for SDL_Mixer's Mix_Chunk. Inherited from ZObject.


Public Methods

 ZSound ()
 Default Constructor.

 ZSound (string filename)
 Constructor that opens a sound effect file.

 ~ZSound ()
 Destructor, frees memory.

void Open (string filename)
 Opens a sound effect file.

void Release ()
 Release sound effect.

void Play (int loopNum=0, int fadeTime=0)
 Play currently loaded sound effect.

void Pause ()
 Pause sound.

void Unpause ()
 Unpause sound.

void Stop (int fadeTime=0)
 Stop sound.

void SetVolume (int volume)
 Change Volume.

bool IsLoaded ()
 Check if file is loaded.

bool IsPlaying ()
 Check if sound is Playing.

bool IsPaused ()
 Check if sound is Paused.

int Volume ()
 Find Current Volume of Sound Channel.


Static Public Attributes

const int LoopInfinite
 Static Variable For Infinite loop of sound. (Defined as -1).


Protected Attributes

Mix_Chunk * rSound
 Pointer to music data.

int rChannelID
 Channel ID Number from SDL_Mixer.


Constructor & Destructor Documentation

ZE::ZSound::ZSound  
 

Default Constructor, does nothing.

ZE::ZSound::ZSound string    filename
 

Constructor simply calls ZSound::Open() with same filename. (WAV,MOD,MID,OGG)

Parameters:
filename Sound effect to open.

ZE::ZSound::~ZSound  
 

Destructor calls ZSound::Release().


Member Function Documentation

void ZE::ZSound::Open string    filename
 

Open a music file to be used.

Parameters:
filename Music to open.

void ZE::ZSound::Release  
 

Release memory held by sample data.

void ZE::ZSound::Play int    loopNum = 0,
int    fadeTime = 0
 

Play sound effect, looping loopNum times. (use ZSound::LoopInfinite to loop forever.) If fade is not zero (which it defaults to) music will fade in over specified number of milliseconds.

Parameters:
loopNum Number of times to loop song, defaults to zero.
fadeTime Milliseconds to fade to full volume, defaults to zero for no fade.

void ZE::ZSound::Pause  
 

Pause currently playing sound.

void ZE::ZSound::Unpause  
 

Unpause currently playing sound.

void ZE::ZSound::Stop int    fadeTime = 0
 

Stop currently playing sound, if fadeTime is not zero, fade out over specified time.

Parameters:
fadeTime Milliseconds to fade out over, defaults to zero for immediate stop.

void ZE::ZSound::SetVolume int    volume
 

Change volume of currently playing sample.

Parameters:
volume Volume to change to, can be in a range from 0 to 128.

bool ZE::ZSound::IsLoaded  
 

Check if file is loaded and pointer to data is non-NULL.

Returns:
Loaded or Unloaded state of data.

bool ZE::ZSound::IsPlaying  
 

Check if sound is playing, specifically if it is not stopped. (Paused state should be checked for by IsPaused)

Returns:
Playing / Not Playing State of sound.

bool ZE::ZSound::IsPaused  
 

Check if sound is "playing" but currently paused.

Returns:
Paused / Not Paused State of Sound.

int ZE::ZSound::Volume  
 

Get current volume of sound channel represented as a value from 0-128.

Returns:
Volume of sound channel, 0-128.


The documentation for this class was generated from the following file:
Generated on Wed Dec 11 23:42:27 2002 for ZEngine by doxygen1.3-rc1