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
| handle | The channel handle... a HSTREAM, HMUSIC, or HRECORD.
|
| form | ACM codec output format.
|
| flags | A combination of these flags.
| BASS_ENCODE_NOHEAD | Do not write any headers.
| | BASS_ENCODE_RF64 | Write 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_DITHER | Apply dither (TPDF) when converting floating-point sample data to integer
| | BASS_ENCODE_QUEUE | Queue 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_WAIT | This 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_PAUSE | Start the encoder paused.
| | BASS_ENCODE_AUTOFREE | Automatically 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_UNICODE | filename is in UTF-16 form. Otherwise it is ANSI.
|
|
| filename | The 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_HANDLE | handle is not valid.
|
| BASS_ERROR_NOTAVAIL | The codec specified in form couldn't be initialized.
|
| BASS_ERROR_CREATE | The file could not be created.
|
| BASS_ERROR_MEM | There is insufficient memory.
|
| BASS_ERROR_UNKNOWN | Some 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