Loads a WAV sample.
HSAMPLE WINAPI BASS_SampleLoad( |
Parameters
mem | TRUE = load the sample from memory. | ||||||||||||||||
file | Filename (mem = FALSE) or a memory location (mem = TRUE). | ||||||||||||||||
offset | File offset to load the sample from (only used if mem = FALSE). | ||||||||||||||||
length | Data length (only used if mem = FALSE)... 0 = use all data up to the end of file. If length over-runs the end of the file, it'll automatically be lowered to the end of the file. | ||||||||||||||||
max | Maximum number of simultaneous playbacks... 1 (min) - 65535 (max)... use one of the BASS_SAMPLE_OVER flags to choose the override decider, in the case of there being no free channel available for playback (ie. the sample is already playing max times). | ||||||||||||||||
flags | A combination of these flags.
|
Return value
If successful, the loaded sample's handle is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code.
Error codes
BASS_ERROR_INIT | BASS_Init has not been successfully called. |
BASS_ERROR_FILEOPEN | The file could not be opened. |
BASS_ERROR_FORMAT | The file's format is not recognised/supported. |
BASS_ERROR_MEM | There is insufficent memory. |
BASS_ERROR_NO3D | Couldn't initialize 3D support for the sample. |
BASS_ERROR_UNKNOWN | Some other mystery problem! |
Remarks
WAV files can be in standard Windows PCM format or they can be compressed with any CODEC, but the CODEC is required to be installed on the user's computer for the WAV to be decoded. So, you should either distribute the CODEC with your software, or use a CODEC that comes with Windows (eg. Microsoft ADPCM).
The BASS_SAMPLE_VAM flag is ignored if the version of DirectX used is less than 7.0, you can check which version of DirectSound is being used with BASS_GetInfo.
Use BASS_SampleGetInfo and BASS_SampleSetInfo to set the default attributes (volume, etc...) of the sample.
See also
BASS_SampleCreate, BASS_SampleFree, BASS_SampleGetInfo, BASS_SamplePlay, BASS_SamplePlay3D, BASS_SamplePlay3DEx, BASS_SamplePlayEx