BASS_Encode_FLAC_Start


Sets up an FLAC encoder on a channel.

HENCODE BASS_Encode_FLAC_Start(
    DWORD handle,
    char *options,
    DWORD flags,
    ENCODEPROC *proc,
    void *user
);

Parameters

handleThe channel handle... a HSTREAM, HMUSIC, or HRECORD.
optionsEncoder options... NULL = use defaults. The following reference FLAC encoder style options are supported: --ogg, --serial-number, --until, -T / --tag, -P / --padding, --no-padding, -b / --blocksize, -V / --verify, --fast, --best, -0 / --compression-level-0 and the other compression level options. Anything else that is included will be ignored. See the FLAC documentation for details on the aforementioned options and defaults.
flagsA combination of these flags.
BASS_ENCODE_FP_8BIT,
BASS_ENCODE_FP_16BIT,
BASS_ENCODE_FP_24BIT
Convert floating-point sample data to 8/16/24 bit integer. FLAC does not support floating-point sample data, so one of these flags should be used to have the sample data converted to integer before it is fed to the encoder. If none of these flags are used, then floating-point sample data will be converted according to the channel's origres value (as available from BASS_ChannelGetInfo), or to 16 bit if that is undefined.
BASS_ENCODE_FP_AUTOConvert floating-point sample data back to the channel's format (8/16 bit integer) if the data is only floating-point due to the BASS_CONFIG_FLOATDSP option being enabled.
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, but if data is queud more quickly than the encoder can process it, that could result in lost data.
BASS_ENCODE_LIMITLimit the encoding rate to real-time speed, by introducing a delay when the rate is too high. With BASS 2.4.6 or above, this flag is ignored when the encoder is fed in a playback buffer update cycle (including BASS_Update and BASS_ChannelUpdate calls), to avoid possibly causing playback buffer underruns. Except for in those instances, this flag is applied automatically when the encoder is feeding a Shoutcast or Icecast server.
BASS_ENCODE_CAST_NOLIMITDon't limit the encoding rate to real-time speed when feeding a Shoutcast or Icecast server. This flag overrides the BASS_ENCODE_LIMIT flag.
BASS_ENCODE_PAUSEStart the encoder in a paused state.
BASS_ENCODE_AUTOFREEAutomatically free the encoder when the source channel is freed. If queuing is enabled, any remaining queued data will be sent to the encoder before it is freed.
BASS_UNICODEoptions is in UTF-16 form. Otherwise it should be UTF-8.
procOptional callback function to receive the encoded data... NULL = no callback.
userUser instance data to pass to the callback function.

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_FORMATThe channel's sample format is not supported by the encoder.
BASS_ERROR_UNKNOWNSome other mystery problem!

Remarks

BASS_Encode_StartUser is used internally to apply the encoder to the source channel, so the remarks in its documentation also apply to this function.

If the encoded data is being written to a file, the resulting file will not be seekable unless the --ogg or --until option is used. "--until=-0" can be used to specify the source channel's full length (according to BASS_ChannelGetLength). This issue does not apply when using BASS_Encode_FLAC_StartFile to write a file.

Tags/comments should be in UTF-8 form. This function will take care of that when the BASS_UNICODE flag is used, but otherwise you will need to make sure that any tags included in options are UTF-8 (not ISO-8859-1/etc).

See also

BASS_Encode_FLAC_StartFile

BASS_Encode_CastInit, BASS_Encode_IsActive, BASS_Encode_ServerInit, BASS_Encode_SetNotify, BASS_Encode_SetPaused, BASS_Encode_Stop, BASS_Encode_Write, ENCODEPROC callback, BASS_CONFIG_ENCODE_PRIORITY