Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

wftk::Music Class Reference

Wrapper class for loading and playing music files (mp3, ogg, mod). More...

#include <music.h>

Inheritance diagram for wftk::Music:

wftk::Sound List of all members.

Public Types

typedef Resource< Music * > Resource
 refcounted resource type

Public Member Functions

 Music ()
 default constructor
 Music (const std::string &)
 create music object from file on disk
virtual bool load (const std::string &)
 load a sound from a file
virtual bool play (int loops=0) const
 play the sound
virtual int setVolume (int vol)
 set volume (0..100)
virtual void stop () const
 cease playback
virtual bool playing () const
 true if music is playing
virtual bool paused () const
 true if music is paused
virtual void pause () const
 pause playback
virtual void rewind () const
 rewind song to beginning
virtual void resume () const
 resume song (if paused)

Static Public Attributes

static ResourceRegistry< Music * > registry
 Load Music resource from file.

Detailed Description

Wrapper class for loading and playing music files (mp3, ogg, mod).


Member Data Documentation

ResourceRegistry< Music * > wftk::Music::registry [static]
 

Load Music resource from file.

Use the load() function to load an mp3 from a file on disk and register it with wftk's Resources engine, e.g.:

   Music::registry.load("town_music", "town.mp3");

Use the find() function to retrieve a pointer to the Music object. If the named object has not been registered, find() will return 0.

   Music* noise = Music::registry.find("ambient");

Use the setMusic function from the Mixer class to play the given music within the application:

   wftk::Mixer::instance()->setMusic("town_music");


The documentation for this class was generated from the following files:

Generated Tue Apr 12 22:48:55 2005.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.