SFXResource
Engine/source/sfx/sfxResource.h
This is the base class for all sound file resources including streamed sound files.
Classes:
Public Types
Parent
Protected Attributes
Public Friends
struct
Protected Functions
The constructor is protected.
SFXResource(String fileName, SFXStream * stream)
Construct a resource instance for the given file.
Public Functions
The destructor.
Returns the total playback time milliseconds.
Return the path to the sound file.
Open a stream for reading the resource's sample data.
Public Static Functions
This is a helper function used by SFXProfile for load a sound resource.
Detailed Description
This is the base class for all sound file resources including streamed sound files.
It acts much like an always in-core header to the actual sound data which is read through an SFXStream.
The first step occurs at ResourceManager::load() time at which only the header information, the format, size frequency, and looping flag, are loaded from the sound file. This provides just the nessasary information to simulate sound playback for sounds playing just out of the users hearing range.
The second step loads the actual sound data or begins filling the stream buffer. This is triggered by a call to openStream(). SFXProfile, for example, does this when mPreload is enabled.
Public Types
typedef void Parent
Protected Attributes
U32 mDuration
The length of the sample in milliseconds.
String mFileName
Path to the sound file.
SFXFormat mFormat
The format of the sample data.
Public Friends
Protected Functions
SFXResource()
The constructor is protected.
SFXResource(String fileName, SFXStream * stream)
Construct a resource instance for the given file.
Format and duration are read from the given stream.
Public Functions
~SFXResource()
The destructor.
getDuration()
Returns the total playback time milliseconds.
getFileName()
Return the path to the sound file.
getFormat()
The format of the data in the resource.
openStream()
Open a stream for reading the resource's sample data.
Public Static Functions
exists(String filename)
A helper function which returns true if the sound resource exists.
Parameters:
filename | The sound file path with or without extension. |
load(String filename)
This is a helper function used by SFXProfile for load a sound resource.
It takes care of trying different types for extension-less filenames.
Parameters:
filename | The sound file path with or without extension. |