BASS

FILEREADPROC callback


User file stream read callback function.

DWORD CALLBACK FileReadProc(
    void *buffer,
    DWORD length,
    void *user
);

Parameters

bufferPointer to the buffer to put the data in.
lengthMaximum number of bytes to read.
userThe user instance data given when BASS_StreamCreateFileUser was called.

Return value

The number of bytes read... -1 = end of file, 0 = end of file (buffered file stream only).

Remarks

During creation of the stream, this function should try to return the amount of data requested. After that, it can just return whatever is available up to the requested amount.

For an unbuffered file stream, this function should be as quick as possible during playback; any delays will not only affect the decoding of the current stream, but can also affect other streams and MOD musics that are playing. It is better to return less data (even none) rather than wait for more data. A buffered file stream is not affected by delays like this, as this function runs in its own thread then.

See also

BASS_StreamCreateFileUser, BASS_FILEPROCS structure