"L. Spiro Engine"
Classes | Public Types | Static Public Member Functions | Protected Types | Static Protected Member Functions

lss::CWaveLoader Class Reference

#include <LSSWaveLoader.h>

List of all members.

Classes

struct  LSE_WAVE_FILE_CHUNK_HEADER
struct  LSE_WAVE_FILE_FMT_DATA
struct  LSE_WAVE_FILE_HEADER
struct  LSE_WAVE_FILE_INFO

Public Types

enum  LSE_WAVE_EXTENSIBLE { LSE_WE_PCM = 1, LSE_WE_EXTENSIBLE = 0xFFFE, LSE_WE_EXTPERIMENTAL = 0xFFFF }
typedef struct
lss::CWaveLoader::LSE_WAVE_FILE_INFO
LPLSE_WAVE_FILE_INFO
typedef struct
lss::CWaveLoader::LSE_WAVE_FILE_INFO 
LPCLSE_WAVE_FILE_INFO

Static Public Member Functions

static LSBOOL LSE_CALL GetWaveInfo (const LSUINT8 *_pui8File, LSUINT32 _ui32FileLen, LSE_WAVE_FILE_INFO &_wfiInfo)
static LSBOOL LSE_CALL GetWaveInfo (const CFileMap &_fmMap, LSE_WAVE_FILE_INFO &_wfiInfo)
static LSBOOL LSE_CALL LoadWavFile (const LSCHAR *_pcFile, LSUINT8 *&_pui8Data, LSUINT32 &_ui32Length, LSUINT32 &_ui32Freq, LSUINT32 &_ui32Bits, LSUINT32 &_ui32Channels, CAllocator *_paAllocator)
static LSBOOL LSE_CALL LoadWavFile (const LSUINT8 *_pui8File, LSUINT32 _ui32FileLen, LSUINT8 *&_pui8Data, LSUINT32 &_ui32Length, LSUINT32 &_ui32Freq, LSUINT32 &_ui32Bits, LSUINT32 &_ui32Channels, CAllocator *_paAllocator)

Protected Types

enum  LSS_WAVE_SPEAKERS {
  LSS_SPEAKER_FRONT_LEFT = (1 << 0), LSS_SPEAKER_FRONT_RIGHT = (1 << 1), LSS_SPEAKER_FRONT_CENTER = (1 << 2), LSS_SPEAKER_LOW_FREQUENCY = (1 << 3),
  LSS_SPEAKER_BACK_LEFT = (1 << 4), LSS_SPEAKER_BACK_RIGHT = (1 << 5), LSS_SPEAKER_FRONT_LEFT_OF_CENTER = (1 << 6), LSS_SPEAKER_FRONT_RIGHT_OF_CENTER = (1 << 7),
  LSS_SPEAKER_BACK_CENTER = (1 << 8), LSS_SPEAKER_SIDE_LEFT = (1 << 9), LSS_SPEAKER_SIDE_RIGHT = (1 << 10), LSS_SPEAKER_TOP_CENTER = (1 << 11),
  LSS_SPEAKER_TOP_FRONT_LEFT = (1 << 12), LSS_SPEAKER_TOP_FRONT_CENTER = (1 << 13), LSS_SPEAKER_TOP_FRONT_RIGHT = (1 << 14), LSS_SPEAKER_TOP_BACK_LEFT = (1 << 15),
  LSS_SPEAKER_TOP_BACK_CENTER = (1 << 16), LSS_SPEAKER_TOP_BACK_RIGHT = (1 << 17), LSS_SPEAKER_ANY = 0x80000000
}
typedef struct
lss::CWaveLoader::LSE_WAVE_FILE_HEADER
LPLSE_WAVE_FILE_HEADER
typedef struct
lss::CWaveLoader::LSE_WAVE_FILE_HEADER 
LPCLSE_WAVE_FILE_HEADER
typedef struct
lss::CWaveLoader::LSE_WAVE_FILE_CHUNK_HEADER
LPLSE_WAVE_FILE_CHUNK_HEADER
typedef struct
lss::CWaveLoader::LSE_WAVE_FILE_CHUNK_HEADER 
LPCLSE_WAVE_FILE_CHUNK_HEADER
typedef struct
lss::CWaveLoader::LSE_WAVE_FILE_FMT_DATA
LPLSE_WAVE_FILE_FMT_DATA
typedef struct
lss::CWaveLoader::LSE_WAVE_FILE_FMT_DATA 
LPCLSE_WAVE_FILE_FMT_DATA

Static Protected Member Functions

static const
LPLSE_WAVE_FILE_CHUNK_HEADER
LSE_CALL 
FindChunk (const LSCHAR *_pcName, const LSUINT8 *_pui8Data, LSUINT32 _ui32Len)
static const LSUINT64 LSE_CALL FindChunk (const LSCHAR *_pcName, const CFileMap &_fmMap)
static CSoundLib::LSS_CHANNELS
LSE_CALL 
FindSoundLibraryFormat (LSUINT32 _ui32Channels, LSUINT32 _ui32Bits)
static LSBOOL LSE_CALL GetWaveInfo (const LSE_WAVE_FILE_HEADER &_wfhHeader, const LSE_WAVE_FILE_FMT_DATA &_wffdFmt, const LSE_WAVE_FILE_CHUNK_HEADER &_wfchData, LSUINT64 _ui64FileLen, LSE_WAVE_FILE_INFO &_wfiInfo)

Detailed Description

Class CWaveLoader

Description: Loads a wave file to RAM using the given allocator.


Member Typedef Documentation

A chunk header.

The "fmt " data part.

The wave-file header.

Stores information about a wave file.


Member Enumeration Documentation

The compression values.

The speaker arrangements found in wave files. These can be found in the non-portable ksmedia.h.


Member Function Documentation

static const LPLSE_WAVE_FILE_CHUNK_HEADER LSE_CALL lss::CWaveLoader::FindChunk ( const LSCHAR *  _pcName,
const LSUINT8 *  _pui8Data,
LSUINT32  _ui32Len 
) [static, protected]

Find a chunk header in a valid WAVE file.

Parameters:
_pcNameName of the chunk to find.
_pui8DataBuffered file data.
_ui32LenSize of the buffered file data.
Returns:
Returns NULL if not found. Otherwise returns a pointer to the start of the chunk within the file data.
static const LSUINT64 LSE_CALL lss::CWaveLoader::FindChunk ( const LSCHAR *  _pcName,
const CFileMap &  _fmMap 
) [static, protected]

Find a chunk header in a valid WAVE file.

Parameters:
_pcNameName of the chunk to find.
_fmMapBuffered file data.
Returns:
Returns 0ULL if not found. Otherwise returns an offset to the start of the chunk within the file data.
static CSoundLib::LSS_CHANNELS LSE_CALL lss::CWaveLoader::FindSoundLibraryFormat ( LSUINT32  _ui32Channels,
LSUINT32  _ui32Bits 
) [static, protected]

Does the format of the WAVE have an exact (and supported) sound-library format? Returns CSoundLib::LSS_C_TOTAL if not.

Parameters:
_ui32ChannelsNumber of channels.
_ui32BitsNumber of bits.
Returns:
Returns a matching CSoundLib::LSS_CHANNELS for the given channel and bit combination.
static LSBOOL LSE_CALL lss::CWaveLoader::GetWaveInfo ( const LSUINT8 *  _pui8File,
LSUINT32  _ui32FileLen,
LSE_WAVE_FILE_INFO _wfiInfo 
) [static]

Get information about a wave file from a loaded file.

Parameters:
_pui8FileLoaded file buffer. The entire file should be loaded for this to succeed.
_ui32DataLenLength of the loaded buffer.
_wfiInfoReference to a LSE_WAVE_FILE_INFO structure containing the returned data.
Returns:
Returns false if the buffer is not a valid (or recognized) .wav file.
static LSBOOL LSE_CALL lss::CWaveLoader::GetWaveInfo ( const CFileMap &  _fmMap,
LSE_WAVE_FILE_INFO _wfiInfo 
) [static]

Get information about a wave file from a mapped file.

Parameters:
_fmMapThe mapped file.
_wfiInfoReference to a LSE_WAVE_FILE_INFO structure containing the returned data.
Returns:
Returns false if the buffer is not a valid (or recognized) .wav file.
static LSBOOL LSE_CALL lss::CWaveLoader::GetWaveInfo ( const LSE_WAVE_FILE_HEADER _wfhHeader,
const LSE_WAVE_FILE_FMT_DATA _wffdFmt,
const LSE_WAVE_FILE_CHUNK_HEADER _wfchData,
LSUINT64  _ui64FileLen,
LSE_WAVE_FILE_INFO _wfiInfo 
) [static, protected]

Get information about a wave file from key parts of the file header.

Parameters:
_wfhHeaderStructure containing the data in the header of the wave file.
_wffdFmtThe format data of the format chunk.
_wfchDataThe data chunk of the file data.
_ui64FileLenThe length of the file.
_wfiInfoReference to a LSE_WAVE_FILE_INFO structure containing the returned data.
Returns:
Returns false if the data is not a valid (or recognized) .wav file.
static LSBOOL LSE_CALL lss::CWaveLoader::LoadWavFile ( const LSUINT8 *  _pui8File,
LSUINT32  _ui32FileLen,
LSUINT8 *&  _pui8Data,
LSUINT32 &  _ui32Length,
LSUINT32 &  _ui32Freq,
LSUINT32 &  _ui32Bits,
LSUINT32 &  _ui32Channels,
CAllocator *  _paAllocator 
) [static]

Load a WAVE file that has already been loaded to RAM.

Parameters:
_pui8FileThe file data.
_ui32FileLenLength of the file data.
_pui8DataPointer filled with the file data allocated with _paAllocator.
_ui32LengthLength of the wave data in bytes.
_ui32FreqFrequency of the wave data.
_ui32BitsBits per sample of the wave data.
_ui32ChannelsChannels in the wave data.
_paAllocatorAllocator used to allocate _pui8Data, or NULL to use LSENEW.
Returns:
Returns false if the load fails or the file is not recognized as a valid WAVE file.
static LSBOOL LSE_CALL lss::CWaveLoader::LoadWavFile ( const LSCHAR *  _pcFile,
LSUINT8 *&  _pui8Data,
LSUINT32 &  _ui32Length,
LSUINT32 &  _ui32Freq,
LSUINT32 &  _ui32Bits,
LSUINT32 &  _ui32Channels,
CAllocator *  _paAllocator 
) [static]

Load a WAVE file. Returns the PCM sound data, data length, frequency, bit depth, and channels. PCM data is allocated via the given allocator.

Parameters:
_pcFileThe file to load.
_pui8DataPointer filled with the file data allocated with _paAllocator.
_ui32LengthLength of the wave data in bytes.
_ui32FreqFrequency of the wave data.
_ui32BitsBits per sample of the wave data.
_ui32ChannelsChannels in the wave data.
_paAllocatorAllocator used to allocate _pui8Data, or NULL to use LSENEW.
Returns:
Returns false if the load fails or the file is not recognized as a valid WAVE file.

The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator