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

ZE::ZSound Class Reference

#include <ZE_ZSound.h>

List of all members.

Detailed Description

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

Public Member Functions

 ZSound ()
 Default Constructor.

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

virtual ~ZSound ()
 Destructor, frees memory.

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

void OpenFromZip (std::string zipname, std::string filename)
 Opens a sound effect file from within a zip archive.

void Release ()
 Release sound effect.

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

void Pause () const
 Pause sound.

void Unpause () const
 Unpause sound.

void Stop (int fadeTime=0) const
 Stop sound.

void SetVolume (int volume)
 Change Volume.

bool IsLoaded () const
 Check if file is loaded.

bool IsPlaying () const
 Check if sound is Playing.

bool IsPaused () const
 Check if sound is Paused.

int Volume () const
 Find Current Volume of Sound Channel.

Static Public Attributes

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

Protected Attributes

 Pointer to ZEngine Object.

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 std::string  filename  ) 

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

filename Sound effect to open.

virtual ZE::ZSound::~ZSound  )  [virtual]

Destructor calls ZSound::Release().

Member Function Documentation

void ZE::ZSound::Open std::string  filename  ) 

Open a music file to be used.

filename Music to open.

void ZE::ZSound::OpenFromZip std::string  zipname,
std::string  filename

Open a sound effect file from within a zip archive using zlib and SDL_RWops.

zipname Zip file to open sound effect from.
filename File to open as new sound effect.

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.

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  )  const

Pause currently playing sound.

void ZE::ZSound::Unpause  )  const

Unpause currently playing sound.

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

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

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

void ZE::ZSound::SetVolume int  volume  ) 

Change volume of currently playing sample.

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

bool ZE::ZSound::IsLoaded  )  const

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

Loaded or Unloaded state of data.

bool ZE::ZSound::IsPlaying  )  const

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

Playing / Not Playing State of sound.

bool ZE::ZSound::IsPaused  )  const

Check if sound is "playing" but currently paused.

Paused / Not Paused State of Sound.

int ZE::ZSound::Volume  )  const

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

Volume of sound channel, 0-128.

The documentation for this class was generated from the following file:
Generated on Sun Oct 5 19:34:46 2003 for ZEngine by doxygen1.3