The SimpleCxxLib package


#include "sound.h"

class Sound

This class encapsulates a sound file. The sound file is specified in the constructor and must be a file in either the current directory or a subdirectory named sounds.

The following code, for example, plays the sound file ringtone.wav:

   Sound ringtone("ringtone.wav");
   ringtone.play();
Constructor
Sound()
Sound(filename) 
Creates a Sound object.
Method
play() Starts playing the sound.

Constructor detail


Sound(string filename);
Creates a Sound object. The default constructor creates an empty sound that cannot be played. The second form initializes the sound by reading in the contents of the specified file.

Usage:

Sound sound;
Sound sound(filename);

Method detail


void play();
Starts playing the sound. This call returns immediately without waiting for the sound to finish.

Usage:

sound.play();