The playback buffer length for HSTREAM and HMUSIC channels.
BASS_SetConfig( BASS_CONFIG_BUFFER, DWORD length );
|length||The buffer length in milliseconds. The minimum length is 10ms, the maximum is 5000 milliseconds. If the length specified is outside this range, it is automatically capped.|
Small buffer lengths are only required if the sound is going to be changing in real-time, for example, in a soft-synth. If you need to use a small buffer, then the minbuf member of BASS_INFO should be used to get the recommended minimum buffer length supported by the device and its drivers, and add that to the update period plus some margin for the stream's processing. Even then, it is still possible that the sound could break up on some systems, it is also possible that smaller buffers may be fine. So when using small buffers, you should have an option in your software for the user to finetune the length used, for optimal performance.
Using this config option only affects the HMUSIC/HSTREAM channels that are created afterwards, not any that have already been created. So you can have channels with differing buffer lengths by using this config option each time before creating them.
If automatic updating is disabled, make sure you call BASS_Update frequently enough to keep the buffers updated.
DWORD len=BASS_GetConfig(BASS_CONFIG_UPDATEPERIOD); // get update period BASS_INFO info; BASS_GetInfo(&info); // retrieve device info len+=info.minbuf+1; // add the 'minbuf' plus 1ms margin BASS_SetConfig(BASS_CONFIG_BUFFER, len); // set the buffer length