BASS_Encode_Write

Sends sample data to an encoder or all encoders on a channel.

BOOL BASS_Encode_Write(
    DWORD handle,
    void *buffer,
    DWORD length
);

Parameters

handleThe encoder or channel handle... a HENCODE, HSTREAM, HMUSIC, or HRECORD.
bufferThe buffer containing the sample data.
lengthThe number of bytes in the buffer.

Return value

If successful, TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_ENDEDNo more data may be fed to the encoder. The encoder has died, or the encoder's queue is being processed before it is closed.

Remarks

There is usually no need to use this function, as the channel's sample data will automatically be fed to the encoder as it is decoded/played. But in some situations, it could be useful to be able to manually feed the encoder instead. The sample data is expected to be the same format as the channel's, or floating-point if the BASS_CONFIG_FLOATDSP option is enabled.

When queued encoding is enabled, this function will return successfully even if the queue did not have space for all of the provided data. BASS_Encode_GetCount can be used to check that there is sufficient space prior to calling this function.

See also

BASS_Encode_SetPaused, BASS_Encode_Start