BASS.NET API for the Un4seen BASS Audio Library

BassEnc_FlacBASS_Encode_FLAC_StartFile Method

BASS.NET API for the Un4seen BASS Audio Library
Sets up a FLAC encoder on a channel, writing the output to a file.

This overload implements UNICODE options. The BASS_UNICODE flag will be added automatically, since all .Net strings are always unicode.

Namespace:  Un4seen.Bass.AddOn.EncFlac
Assembly:  Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax

public static int BASS_Encode_FLAC_StartFile(
	int handle,
	string options,
	BASSEncode flags,
	string filename
)

Parameters

handle
Type: SystemInt32
The channel handle... a HSTREAM, HMUSIC, or HRECORD.
options
Type: SystemString
Encoder options... =use defaults. The following reference FLAC encoder style options are supported:

The following reference FLAC encoder style options are supported: --ogg, --serial-number, --until, -S / --seekpoint, --no-seektable, -T / --tag, --picture, -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.

flags
Type: Un4seen.Bass.AddOn.EncBASSEncode
A combination of these flags (see BASSEncode):
BASS_ENCODE_FP_8BIT, BASS_ENCODE_FP_16BIT, BASS_ENCODE_FP_24BITWhen you want to encode a floating-point channel, but the encoder does not support 32-bit floating-point sample data, then you can use one of these flags to have the sample data converted to 8/16/24 bit integer data before it's passed on to the encoder. These flags are ignored if the channel's sample data isn't floating-point.
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 data 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(Int32) and BASS_ChannelUpdate(Int32, Int32) 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 data rate (to real-time speed) when sending to a Shoutcast or Icecast server.
BASS_ENCODE_PAUSEStart the encoder paused.
BASS_ENCODE_AUTOFREEAutomatically free the encoder when the source channel is freed.
BASS_ENCODE_FLAC_NOCOUNTDo not count the encoder output to make available from BASS_Encode_GetCount (with BASS_ENCODE_COUNT_OUT). This saves a bit of processing. It also prevents casting (via BASS_Encode_CastInit) or serving (via BASS_Encode_ServerInit) the data, so it should not be used in those cases.
BASS_UNICODEoptions is Unicode (16-bit characters) (not needed here, since the overloads already take care of it).
filename
Type: SystemString
Output filename... =no output file.

Return Value

Type: Int32
The encoder handle is returned if the encoder is successfully started, else 0 is returned (use BASS_ErrorGetCode to get the error code).
Remarks

BASS_Encode_StartUser(Int32, String, BASSEncode, ENCODERPROC, IntPtr) is used internally to apply the encoder to the source channel, so the remarks in its documentation also apply to this function.

The evenly spaced seekpoint options (with a 'x' or 's' suffix), including the 10s default spacing, are only applicable when the "--until" option is used to tell how long the encoding will be. "--until=-0" can be used for the full length of the source channel, according to BASS_ChannelGetLength(Int32, BASSMode)).

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).

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_FORMATThe channel's sample format is not supported by the encoder.
BASS_ERROR_ILLPARAMoptions contains an invalid setting.
BASS_ERROR_FILEOPENA '--picture' option file could not be opened.
BASS_ERROR_FILEFORMA '--picture' option file has an invalid format. It needs to be JPEG, PNG, or GIF.
BASS_ERROR_MEMThere is insufficient memory.
BASS_ERROR_UNKNOWNSome other mystery problem!

See Also

Reference