ENCODEPROCEX callback

User defined callback function to process encoded sample data.

void CALLBACK EncodeProcEx(
    HENCODE handle,
    DWORD channel,
    const void *buffer,
    DWORD length,
    QWORD offset,
    void *user
);

Parameters

handleThe encoder that the data is from.
channelThe channel that the encoder is set on.
bufferBuffer containing the encoded data.
lengthThe number of bytes in the buffer.
offsetFile offset of the data.
userThe user instance data given when BASS_Encode_StartCA (or other encoder initialization function) was called.

Example

A callback function to write the encoded data to to a file.
void CALLBACK MyFileWriter(HENCODE handle, DWORD channel, const void *buffer, DWORD length, QWORD offset, void *user)
{
    FILE *file=(FILE*)user;
    fseek(file, offset, SEEK_SET); // seek to file offset
    fwrite(buffer, 1, length, file); // write the data
}

NOTE: This is just an example. It is simpler to use a dedicated file encoding function, eg. BASS_Encode_StartCAFile.

See also

BASS_Encode_StartCA