BASS

BASS_StreamPutFileData


Adds data to a "push buffered" user file stream's buffer.

DWORD BASS_StreamPutFileData(
    HSTREAM handle,
    void *buffer,
    DWORD length
);

Parameters

handleThe stream handle.
bufferPointer to the file data.
lengthThe amount of data in bytes, or BASS_FILEDATA_END to end the file.

Return value

If successful, the number of bytes read from buffer is returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_NOTAVAILThe stream is not using the STREAMFILE_BUFFERPUSH file system.
BASS_ERROR_ENDEDThe file has ended.

Remarks

If there is not enough space in the stream's file buffer to receive all of the data, then only the amount that will fit is read from buffer. BASS_StreamGetFilePosition can be used to check the amount of space in the buffer.

File data should be provided at a rate sufficent to sustain playback. If there is insufficient file data, and the playback buffer is subsequently exhausted, BASS will automatically stall playback of the stream, until more data is available. A BASS_SYNC_STALL sync can be set via BASS_ChannelSetSync, to be triggered upon playback stalling or resuming.

See also

BASS_StreamCreateFileUser, BASS_StreamGetFilePosition