##### [API function]

## FMUSIC_SetSample

Replaces a mod's sample with a sample definition specified.

signed char F_API FMUSIC_SetSample(
FMUSIC_MODULE *mod,
int sampno,
FSOUND_SAMPLE *sptr
);

### Parameters

mod | Pointer to the song to set the sample for.
sampno | index to sample inside module.
sptr | Pointer to the sample definition to replace mod sample

### Return Value

On success, TRUE is returned.
On failure, FALSE is returned.

### Remarks

Because of the instrument nature of some formats like XM, this function lists all the samples in order of instruments and their subsamples.
ie if instrument 1 has 2 samples and instrument 2 contains 3 samples, then sampno in this case would be 0 and 1 for instrument 1's samples, and 2,3 & 4 for instrument 2's samples.
------------
FMOD does not free the existing mod sample that you may be overwriting. If you do overwrite an existing handle, it may be lost, and you may incur a memory leak. It is a good idea to free the existing sample first before overwriting it.
------------
Important: For PlayStation 2, this function has to do a blocking query to the IOP, and can take significantly more time than a standard non blocking fmod function. This means it is best to cache the pointers for samples while loading, and not call this function in realtime.
------------
This function is not supported with the MIDI format.
___________________
Supported on the following platforms : Win32, WinCE, Linux, Macintosh, XBox, PlayStation 2, GameCube

### See Also

FMUSIC_GetSample

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