Creates a new sample.
HSAMPLE BASS_SampleCreate( DWORD length, DWORD freq, DWORD chans, DWORD max, DWORD flags );
|length||The sample's length, in bytes.|
|freq||The default sample rate.|
|chans||The number of channels... 1 = mono, 2 = stereo, etc.|
|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.|
|BASS_ERROR_INIT||BASS_Init has not been successfully called.|
|BASS_ERROR_ILLPARAM||max and/or length is invalid.|
|BASS_ERROR_FORMAT||The sample format is not supported.|
|BASS_ERROR_MEM||There is insufficient memory.|
|BASS_ERROR_NO3D||Could not initialize 3D support.|
|BASS_ERROR_UNKNOWN||Some other mystery problem!|
To play a sample, first a channel must be obtained using BASS_SampleGetChannel, which can then be played using BASS_ChannelStart or BASS_ChannelPlay.
If you want to play a large or one-off sample, then it would probably be better to stream it instead with BASS_StreamCreate.
HSAMPLE sample = BASS_SampleCreate(256, 440 * 64, 1, 1, BASS_SAMPLE_LOOP | BASS_SAMPLE_OVER_POS); // create sample short data; // data buffer int a; for (a = 0; a < 128; a++) data[a] = (short)(32767.0 * sin(a * 6.283185 / 64)); // sine wave BASS_SampleSetData(sample, data); // set the sample's data