Sends a RIFF chunk to an encoder.

BOOL BASS_Encode_AddChunk(
    DWORD handle,
    char *id,
    void *buffer,
    DWORD length


handleThe encoder handle... a HENCODE. idThe 4 character chunk id. bufferThe buffer containing the chunk 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_NOTAVAILNo RIFF headers/chunks are being sent to the encoder (due to the BASS_ENCODE_NOHEAD flag being in effect), or sample data encoding has started.
BASS_ERROR_ENDEDThe encoder has died.


BASSenc writes the minimum chunks required of a WAV file: "fmt" and "data", and "ds64" and "fact" when appropriate. This function can be used to add other chunks. For example, a BWF "bext" chunk or "INFO" tags.

Chunks can only be added prior to sample data being sent to the encoder. The BASS_ENCODE_PAUSE flag can be used when starting the encoder to ensure that no sample data is sent before additional chunks have been set.

See also

BASS_Encode_Start, BASS_Encode_StartACMFile