FSOUND_Sample_Alloc

##### [API function]

## FSOUND_Sample_Alloc

Allocates a new empty sample. Used if you want to create a sample from scratch and fill the databuffer with your own data (using FSOUND_Sample_Lock or FSOUND_Sample_Upload), instead of just loading a file with FSOUND_Sample_Load.

FSOUND_SAMPLE * F_API FSOUND_Sample_Alloc(
int index,
int length,
unsigned int mode,
int deffreq,
int defvol,
int defpan,
int defpri
);

### Parameters

index | Sample pool index. See remarks for more on the sample pool. 0 or above - The absolute index into fsounds 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 fsound free this sample upon FSOUND_Close
length | The length in of the sample buffer in SAMPLES.
mode | Bitfield describing various characteristics of the sample. Valid parameters are described in FSOUND_MODES.
deffreq | Default frequency for this sample.
defvol | Default volume for this sample.
defpan | Default pan for this sample.
defpri | Default priority for this sample.

### Return Value

On success, a pointer to an allocated sample 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 NOT to use the sample management system.
------------
FSOUND_Sample_Alloc is only nescessary for lower level operations with sample data. Usually
FSOUND_Load does the work for you. lower level operations mean such things as uploading data from memory or
your own compressed data for example.
You can create a new sample from scratch by doing the following operations
1. Allocate a new sample with FSOUND_Sample_Alloc
2. Write data to the sample buffer with FSOUND_Sample_Lock and FSOUND_Sample_Unlock, or
FSOUND_Sample_Upload.
Note FSOUND_Sample_Lock only returns a pointer to the sample data, whereas
FSOUND_Sample_Upload does a copy from data you give it, with format conversion to the
correct format.
___________________
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 , FSOUND_Sample_Load , FSOUND_Sample_Lock , FSOUND_Sample_SetDefaults , FSOUND_Sample_SetLoopPoints , FSOUND_Sample_Unlock , FSOUND_Sample_Upload

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.