List of all members.
Detailed Description
Base Sound class.
SoundBase: ---------- SoundBase provides generic functionality. SoundBase controls sound samples in terms of the base Sample class. A derivative of Sound is specific to a sound system. If no sound system is available, SoundNOP will be compiled.
Sound keeps tracking of samples being played: --------------------------------------------- Play() will become a NOP if redundantly passed the same args while it is still playing. So clients can rely on Sound to keep track of which samples are playing.
Class design: ------------- A derivative of SoundBase initializes the sound system and controls the master volume. A derivative of Sample plays sound files. SoundBase provides caching of Samples. SoundBase is able to define the Sample-related methods, but defers other functionality to a SoundBase derivative.
Member Typedef Documentation
Constructor & Destructor Documentation
| sound::SoundBase::SoundBase |
( |
void |
|
) |
[protected] |
| sound::SoundBase::~SoundBase |
( |
|
) |
[protected, virtual] |
Member Function Documentation
| const string sound::SoundBase::ComputePathnameSoundFile |
( |
const string & |
soundFilename |
) |
|
Compute full pathname to a sound file according to these rules:
- If arg is a pure filename (no slashes) then prepends directory to sound data files.
- If arg has any slashes then it is returned unchanged (relative or absolute pathname).
| virtual shptr<Sample> sound::SoundBase::CreateSample |
( |
const Sample::Name & |
sampleName |
) |
[protected, pure virtual] |
| virtual bool sound::SoundBase::Enable |
( |
const bool |
enable = true |
) |
[pure virtual] |
- Returns:
- Volume of a sample.
| virtual fp sound::SoundBase::GetVolume |
( |
void |
|
) |
[pure virtual] |
| virtual bool sound::SoundBase::IfEnabled |
( |
void |
|
) |
[pure virtual] |
| bool sound::SoundBase::IfPlaying |
( |
const Sample::Name & |
sampleName |
) |
|
- Returns:
- True if sample is playing.
Play sound sample.
- Parameters:
-
| sampleName | |
| playLoop | Play continuously or once. |
| volume | Default is DEFAULT_VOLUME. |
- Returns:
- false if error (else true, even if sound is disabled).
| bool sound::SoundBase::SetVolume |
( |
const Sample::Name & |
sampleName, |
|
|
const fp |
volume | |
|
) |
| | |
Set volume of a sample.
- Parameters:
-
| sampleName | |
| volume | 0.0 = off, 1.0 max volume. |
| virtual bool sound::SoundBase::SetVolume |
( |
const fp |
volume |
) |
[pure virtual] |
| bool sound::SoundBase::Stop |
( |
void |
|
) |
|
Stop playing all samples.
| bool sound::SoundBase::Stop |
( |
const Sample::Name & |
sampleName |
) |
|
Member Data Documentation
The documentation for this class was generated from the following files: