Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

ZE::ZMusic Class Reference

#include <ZE_ZMusic.h>

List of all members.


Detailed Description

ZMusic music class, class wraps common features for SDL_Mixer's Mix_Music. Inherited from ZObject.


Public Methods

 ZMusic ()
 Default Constructor.

 ZMusic (string filename)
 Constructor that opens a music file.

virtual ~ZMusic ()
 Destructor, frees memory.

void Open (string filename)
 Opens a music file.

void Release ()
 Release music.

void Play (int loopNum=0, int fadeTime=0) const
 Play currently loaded music.

void Pause () const
 Pause music.

void Unpause () const
 Unpause music.

void Rewind () const
 Rewind music.

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

void SetVolume (int volume)
 Change Volume.

bool IsLoaded () const
 Check if file is loaded.

bool IsPlaying () const
 Check if music is Playing.

bool IsPaused () const
 Check if music is Paused.

int Volume () const
 Find Current Volume of Music.


Static Public Attributes

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


Protected Attributes

ZEnginerEngine
 Pointer to ZEngine Object.

Mix_Music * rMusic
 Pointer to music data.


Constructor & Destructor Documentation

ZE::ZMusic::ZMusic  
 

Default Constructor, does nothing.

ZE::ZMusic::ZMusic string    filename
 

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

Parameters:
filename Music to open.

virtual ZE::ZMusic::~ZMusic   [virtual]
 

Destructor calls ZMusic::Release().


Member Function Documentation

void ZE::ZMusic::Open string    filename
 

Open a music file to be used.

Parameters:
filename Music to open.

void ZE::ZMusic::Release  
 

Release memory held by music data.

void ZE::ZMusic::Play int    loopNum = 0,
int    fadeTime = 0
const
 

Play music currently loaded in ZMusic, looping loopNum times. (use ZMusic::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::ZMusic::Pause   const
 

Pause currently playing music.

void ZE::ZMusic::Unpause   const
 

Unpause currently paused music.

void ZE::ZMusic::Rewind   const
 

Rewind music to beginning.

void ZE::ZMusic::Stop int    fadeTime = 0 const
 

Stop currently playing music, 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::ZMusic::SetVolume int    volume
 

Change volume of currently playing music.

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

bool ZE::ZMusic::IsLoaded   const
 

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

Returns:
Loaded or Unloaded state of data.

bool ZE::ZMusic::IsPlaying   const
 

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

Returns:
Playing / Not Playing State of Music.

bool ZE::ZMusic::IsPaused   const
 

Check if music is "playing" but currently paused.

Returns:
Paused / Not Paused State of Music.

int ZE::ZMusic::Volume   const
 

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

Returns:
Volume of music, 0-128.


The documentation for this class was generated from the following file:
Generated on Sun Apr 27 17:49:38 2003 for ZEngine by doxygen1.3-rc2