SFXResource Class Reference

#include <sfxResource.h>

Inheritance diagram for SFXResource:

Inheritance graph
[legend]
List of all members.

Detailed Description

This is the base class for all sound file resources including streamed sound files.

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 ????. SFXProfile, for example, does this when mPreload is enabled.


Public Member Functions

const U8getData () const
 Returns the sample data array.
U32 getSize () const
 The length of the data buffer in bytes.
U32 getLength () const
 Returns the total playback time milliseconds.
U32 getPosition (U32 ms) const
 Returns the byte offset into the sample buffer from the time in milliseconds.
U32 getSampleBytes () const
 Returns the number of bytes per sample based on the format ( a sample includes all channels ).
U32 getSampleBits () const
 Returns the number of bits per sample ( a sample includes all channels ).
U32 getChannels () const
 Returns the number of seperate audio signals in the sound.
U32 getFrequency () const
 Returns the number of samples per second.

Static Public Member Functions

static ResourceOld< SFXResourceload (const char *filename)
 This is a helper function used by SFXProfile for load a sound resource.
static bool exists (const char *filename)
 A helper function which returns true if the sound resource exists.

Protected Member Functions

 SFXResource ()
 The constructor is protected.
virtual ~SFXResource ()
 The destructor.

Protected Attributes

SFXFormat mFormat
 The format of the sample data.
U8mData
 The loaded sample data.
U32 mSize
 The length of the mData array in bytes.
U32 mFrequency
 The number of samples per second.
U32 mLength
 The length of the sample in milliseconds.


Constructor & Destructor Documentation

SFXResource::SFXResource (  )  [protected]

The constructor is protected.

See also:
SFXResource::load()

virtual SFXResource::~SFXResource (  )  [protected, virtual]

The destructor.


Member Function Documentation

static ResourceOld<SFXResource> SFXResource::load ( const char *  filename  )  [static]

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.

static bool SFXResource::exists ( const char *  filename  )  [static]

A helper function which returns true if the sound resource exists.

Parameters:
filename The sound file path with or without extension.

const U8* SFXResource::getData (  )  const [inline]

Returns the sample data array.

U32 SFXResource::getSize (  )  const [inline]

The length of the data buffer in bytes.

U32 SFXResource::getLength (  )  const [inline]

Returns the total playback time milliseconds.

U32 SFXResource::getPosition ( U32  ms  )  const

Returns the byte offset into the sample buffer from the time in milliseconds.

Parameters:
ms The time in milliseconds.

U32 SFXResource::getSampleBytes (  )  const

Returns the number of bytes per sample based on the format ( a sample includes all channels ).

U32 SFXResource::getSampleBits (  )  const [inline]

Returns the number of bits per sample ( a sample includes all channels ).

U32 SFXResource::getChannels (  )  const

Returns the number of seperate audio signals in the sound.

Typically 1 for mono or 2 for stereo.

U32 SFXResource::getFrequency (  )  const [inline]

Returns the number of samples per second.


Member Data Documentation

The format of the sample data.

U8* SFXResource::mData [protected]

The loaded sample data.

U32 SFXResource::mSize [protected]

The length of the mData array in bytes.

The number of samples per second.

The length of the sample in milliseconds.