BASS_Encode_StartACMFile

Sets up an encoder on a channel, using an ACM codec and writing the output to a file.

HENCODE BASS_Encode_StartACMFile(
    DWORD handle,
    void *form,
    DWORD flags,
    char *filename
);

Parameters

handleThe channel handle... a HSTREAM, HMUSIC, or HRECORD.
formACM codec output format.
flagsA combination of these flags.
BASS_ENCODE_NOHEADDo not write any headers.
BASS_ENCODE_RF64Write an RF64 header instead of a standard RIFF header, allowing the file to go beyond 4GB in size. This flag is ignored if the BASS_ENCODE_NOHEAD flag is used.
BASS_ENCODE_DITHERApply dither (TPDF) when converting floating-point sample data to integer
BASS_ENCODE_QUEUEQueue data to feed the encoder asynchronously. This prevents the data source (DSP system or BASS_Encode_Write call) getting blocked by the encoder, and can improve performance through multithreading, but if data is queued more quickly than the encoder can process it then that could result in lost data.
BASS_ENCODE_QUEUE_WAITThis is the same as BASS_ENCODE_QUEUE except that it will wait for space in the queue rather than drop data (so the data source may get blocked).
BASS_ENCODE_PAUSEStart the encoder paused.
BASS_ENCODE_AUTOFREEAutomatically free the encoder when the source channel is freed. If it has queued data, the encoder will be freed asynchronously once that has been processed.
BASS_UNICODEfilename is in UTF-16 form. Otherwise it is ANSI.
filenameThe output filename.

Return value

The encoder handle is returned if the encoder is successfully started, else 0 is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_NOTAVAILThe codec specified in form couldn't be initialized.
BASS_ERROR_CREATEThe file could not be created.
BASS_ERROR_MEMThere is insufficient memory.
BASS_ERROR_UNKNOWNSome other mystery problem!

Remarks

This function is identical to BASS_Encode_StartACM, except that it writes the encoded data to a file instead of a callback function.

Unless the BASS_ENCODE_NOHEAD flag is specified, a WAVE header and the form contents will be written to the file. This is generally required for the file to be playable, but in some cases (eg. MP3) it is not. Standard RIFF files are limited to 4GB in size, and the encoder will automatically stop at that point. That size limit can be overcome by writing an RF64 file instead with the BASS_ENCODE_RF64 flag. When writing an RF64 file, a standard RIFF header will still be written initially, which will only be replaced by an RF64 header at the end if the file size has exceeded the standard limit.

Platform-specific

This function is only available on Windows.

See also

BASS_Encode_AddChunk, BASS_Encode_GetACMFormat, BASS_Encode_IsActive, BASS_Encode_SetPaused, BASS_Encode_Start, BASS_Encode_StartACM, BASS_Encode_Stop, BASS_Encode_Write, ENCODEPROC callback, BASS_CONFIG_ENCODE_PRIORITY