Initiates the creation of a custom generated sample.
void* WINAPI BASS_SampleCreate( |
Parameters
length | The sample's length, in samples (ie. not bytes). | ||||||||||||||||||||
freq | The default sample rate... 100 (min) - 100000 (max) | ||||||||||||||||||||
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, a pointer to the memory location at which the sample data should be written is returned. If an error occured, NULL is returned. Use BASS_ErrorGetCode to get the error code.
Error codes
BASS_ERROR_INIT | BASS_Init has not been successfully called. |
BASS_ERROR_ALREADY | A sample is already being created. BASS_SampleCreateDone must be called to finish creating the previous sample, before trying to create another one. |
BASS_ERROR_FREQ | freq is out of range... DirectSound only allows sample rates between 100 and 100000. |
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
After writing the sample data to the memory location returned, call BASS_SampleCreateDone to finish the sample's creation and get a handle for the new sample.
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.
Example
To create a 440hz sine-wave.
HSAMPLE handle; |
See also
BASS_SampleCreateDone, BASS_SampleLoad