Encoded data processing callback function.
void CALLBACK WMEncodeProc(
HWMENCODE handle,
DWORD type,
const void *buffer,
DWORD length,
void *user
);
| handle | The encoder handle. | ||||||
| type | The type of data to process, one of the following.
| ||||||
| buffer | A pointer to the data to process. | ||||||
| length | The length of the data. | ||||||
| user | The user instance data given when BASS_WMA_EncodeOpen was called. |
void CALLBACK MyWMEncodeProc(HWMENCODE handle, DWORD type, const void *buffer, DWORD length, void *user)
{
if (type==BASS_WMA_ENCODE_HEAD) {
fseek(user, 0, SEEK_SET); // rewind to start of file
fwrite(buffer, length, 1, user); // write the header
} else if (type==BASS_WMA_ENCODE_DATA)
fwrite(buffer, length, 1, user); // write encoded data
else if (type==BASS_WMA_ENCODE_DONE)
fclose(user); // done encoding - close the file
}
...
FILE *file=fopen("a_file.wma", "wb"); // created the file
BASS_WMA_EncodeOpen(44100, 2, 0, 64000, &MyWMEncodeProc, file); // create the encoder
NOTE: This is just an example. It is simpler to use BASS_WMA_EncodeOpenFile to encode to a file.