SFXProfile

consoledoc.h

Encapsulates a single sound file for playback by the sound system.

More...

Sound

filename

Path to the sound file.

bool

Whether to preload sound data when the profile is added to system.

Public Functions

float

Return the length of the sound data in seconds.

Detailed Description

Encapsulates a single sound file for playback by the sound system.

SFXProfile combines a sound description (SFXDescription) with a sound file such that it can be played by the sound system. To be able to play a sound file, the sound system will always require a profile for it to be created. However, several of the SFX functions (sfxPlayOnce(), sfxCreateSource()) perform this creation internally for convenience using temporary profile objects.

Sound files can be in either OGG or WAV format. However, extended format support is available when using FMOD. See SFX_formats.

Profile Loading

By default, the sound data referenced by a profile will be loaded when the profile is first played and the data then kept until either the profile is deleted or until the sound device on which the sound data is held is deleted.

This initial loading my incur a small delay when the sound is first played. To avoid this, a profile may be expicitly set to load its sound data immediately when the profile is added to the system. This is done by setting the preload property to true.

note:

Sounds using streamed playback (SFXDescription::isStreaming) cannot be preloaded and will thus ignore the preload flag.

datablock SFXProfile( Shore01Snd )
{
   fileName     = "art/sound/Lakeshore_mono_01";
   description  = Shore01Looping3d;
   preload      = true;
};

Sound

filename fileName 

Path to the sound file.

If the extension is left out, it will be inferred by the sound system. This allows to easily switch the sound format without having to go through the profiles and change the filenames there, too.

bool preload 

Whether to preload sound data when the profile is added to system.

note:

This flag is ignored by streamed sounds.

Profile Loading

Public Functions

getSoundDuration()

Return the length of the sound data in seconds.

return:

The length of the sound data in seconds or 0 if the sound referenced by the profile could not be found.