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

ZE::ZMusic Class Reference

#include <ZE_ZMusic.h>

Inherits ZE::ZObject.

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.

 ~ZMusic ()
 Destructor, frees memory.

void Open (string filename)
 Opens a music file.

void Release ()
 Release music.

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

void Pause ()
 Pause music.

void Unpause ()
 Unpause music.

void Rewind ()
 Rewind music.

void Stop (int fadeTime=0)
 Stop music.

void SetVolume (int volume)
 Change Volume.

bool IsLoaded ()
 Check if file is loaded.

bool IsPlaying ()
 Check if music is Playing.

bool IsPaused ()
 Check if music is Paused.

int Volume ()
 Find Current Volume of Music.


Static Public Attributes

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


Protected Attributes

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.

ZE::ZMusic::~ZMusic  
 

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
 

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  
 

Pause currently playing music.

void ZE::ZMusic::Unpause  
 

Unpause currently paused music.

void ZE::ZMusic::Rewind  
 

Rewind music to beginning.

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

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  
 

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

Returns:
Loaded or Unloaded state of data.

bool ZE::ZMusic::IsPlaying  
 

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  
 

Check if music is "playing" but currently paused.

Returns:
Paused / Not Paused State of Music.

int ZE::ZMusic::Volume  
 

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 Wed Dec 4 19:16:09 2002 for ZEngine by doxygen1.3-rc1