sound.h

This interface defines an abstract type that represents a sound.
Type
Sound This type encapsulates a sound file.
Functions
newSound(filename) Creates a Sound object from the specified file.
freeSound(sound) Frees the memory associated with the sound.
play(sound) Starts playing the sound.

Type detail


typedef struct SoundCDT *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);

Function detail


Sound newSound(string filename);
Creates a Sound object from the specified file.

Usage:

sound = newSound(filename);

void freeSound(Sound sound);
Frees the memory associated with the sound.

Usage:

freeSound(sound);

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

Usage:

play(sound);