BASS.NET API for the Un4seen BASS Audio LibraryBASSBufferSpace Method BASS.NET API for the Un4seen BASS Audio Library
Returns the number of bytes available in the ring buffer for writing until an overflow of the read pointer will happen.

Namespace: Un4seen.Bass
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.12.0
Syntax

public int Space(
	int reader
)

Parameters

reader
Type: SystemInt32
The zero-based index of the reader to use (0=first reader) or -1 to get the smallest available space for all readers.

Return Value

Type: Int32
Returns the number of bytes available in the ring buffer for writing until an overflow of the read pointer will happen (space between the current write pointer position and the read pointer position).
Remarks

In order to convert the available space in the buffer to number of samples, simply devide the result by the bytes per sample (e.g. if the result is 56780 and you are using the buffer with 16-bit stereo sample data, the number of sample are 56780/2 = 28390 samples or 14195 stereo pairs).

Note, that there is never a real physical write limitation, since writing to the buffer always has priority. Meaning if there is not sufficient space left between the write pointer position and the last read pointer position, this fact is simply ignored. The data will be written anyhow. However, this will result in an overflow, so that the next read operation will only have the overflown sample data available - resulting in a gap in the sound.

See Also

Reference