BASS.NET API for the Un4seen BASS Audio Library

BassEnc_AacBASS_Encode_AAC_StartFile Method

BASS.NET API for the Un4seen BASS Audio Library
Sets up an AAC 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.EncAac
Assembly:  Bass.Net (in Bass.Net.dll) Version: 2.4.17.7
Syntax

public static int BASS_Encode_AAC_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 FDK AAC style options are supported:

--object-type value ... 'value' can be: 2/5/23/29/39. See here for descriptions: Hydrogenaudo Fraunhofer FDK AAC

--vbr value ... 'value' can be 0 (CBR) or 1-5 (VBR levels).

--bitrate value ... bitrate (bps) for CBR.

flags
Type: Un4seen.Bass.AddOn.EncBASSEncode
A combination of these flags (see BASSEncode):
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.
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.

MP3 encoding involves extensive floating-point operations, so it is not supported on platforms/architectures that do not have an FPU, eg. older ARM platforms/architectures.

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 '--ti' option file could not be opened.
BASS_ERROR_FILEFORMA '--ti' option file has an invalid format. It needs to be JPEG, PNG, or GIF.
BASS_ERROR_MEMThere is insufficient memory.
BASS_ERROR_NOTAVAILThis function is not available on platforms/architectures without an FPU.
BASS_ERROR_UNKNOWNSome other mystery problem!

See Also

Reference