/* * File: sound.h * ------------- * This interface defines an abstract type that represents a sound. */ #ifndef _sound_h #define _sound_h/* * Type: Sound * ----------- * This type 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 = newSound("ringtone.wav"); * play(ringtone); */ typedef struct SoundCDT *Sound;/* * Function: newSound * Usage: sound = newSound(filename); * ---------------------------------- * Creates a Sound object from the specified file. */ Sound newSound(string filename);/* * Function: freeSound * Usage: freeSound(sound); * ------------------------ * Frees the memory associated with the sound. */ void freeSound(Sound sound);/* * Function: play * Usage: play(sound); * ------------------- * Starts playing the sound. This call returns immediately without waiting * for the sound to finish. */ void play(Sound sound); #endif