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_ILLPARAMlength is not valid, it must equate to a whole number of samples.
BASS_ERROR_ENDEDNo more data may be fed to the encoder. The encoder has died, or its queue is being drained before being freed.

Remarks

Except for dummy encoders, there is usually no need to use this function because 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 a channel handle (rather than encoder handle) is used and there are multiple encoders on the channel, this function will return successfully if any (not necessarily all) of them succeed. This function will also return successfully even if data was dropped due to the encoder's queue being full; 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