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 );
handle | The encoder that the data is from. |
channel | The channel that the encoder is set on. |
buffer | Buffer containing the encoded data. |
length | The number of bytes in the buffer. |
offset | File offset of the data. |
user | The user instance data given when BASS_Encode_StartCA (or other encoder initialization function) was called. |
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.