##### [API function]

## FSOUND_Sample_Load

Loads and decodes a static soundfile into memory.
This includes such files as .WAV, .MP2, .MP3, .OGG, .RAW and others.

FSOUND_SAMPLE * F_API FSOUND_Sample_Load(
int index,
const char *name_or_data,
unsigned int inputmode,
int offset,
int length
);

### Parameters

index | Sample pool index. See remarks for more on the sample pool. 0 or above - The absolute index into the sample pool. The pool will grow as the index gets larger. If a slot is already used it will be replaced. FSOUND_FREE - Let FSOUND select an arbitrary sample slot. FSOUND_UNMANAGED - Dont have this sample managed within fsounds sample management system
name_or_data | Name of sound file or pointer to memory image to load.
mode | Description of the data format, OR in the bits defined in FSOUND_MODES to describe the data being loaded.
offset | Optional. 0 by default. If > 0, this value is used to specify an offset in a file, so fmod will seek before opening. length must also be specified if this value is used.
length | Optional. 0 by default. If > 0, this value is used to specify the length of a memory block when using FSOUND_LOADMEMORY, or it is the length of a file or file segment if the offset parameter is used. On PlayStation 2 this must be 16 byte aligned for memory loading.

### Return Value

On success, a sample pointer is returned.
On failure, NULL is returned.

### Remarks

FMOD has a sample management system that holds onto any samples loaded or allocated, and frees them all when you call FSOUND_Close.
It takes the hassle out of having to keep hold of a lot of sample handles and remember to free them all at the end of your application.
It is basically an expandle array of handles that holds each sample until FMOD closes down where it does a cleanup.
FSOUND_UNMANAGED can be used so FMOD does NOT use the sample management system. You have to make sure they are freed yourself.
--------
Specify FSOUND_LOADMEMORY to load a file from a memory image.
The pointer you pass to name must be the actual image of the data you want to load.
The length parameter is to be filled out if FSOUND_LOADMEMORY is specified, otherwise if you do not specify memory loading, can be safely ignored and should be set to 0.
--------
Compressed formats are expanded into memory. If the file is quite large, it could take a while to load.
--------
If FSOUND_8BITS is specified and the file decodes to 16bit normally, FMOD will downgrade the sample to 8bit.
--------
On PlayStation 2, the name_or_data pointer and length variables must be 16 byte aligned, for DMA reasons.
--------
Note that FSOUND_NONBLOCKING is NOT supported with this function.
___________________
Supported on the following platforms : Win32, WinCE, Linux, Macintosh, XBox, PlayStation 2, GameCube

### See Also

FSOUND_Close , FSOUND_MODES , FSOUND_Sample_Alloc , FSOUND_Sample_Free

This document copyright ©Firelight Technologies, Pty, Ltd, 1999-2002. All rights reserved.
Generated Thu Dec 15 17:31:32 2005 by SourceDoc v0.10, the automated source code documenter.