BASS.NET API for the Un4seen BASS Audio Library

EncoderTooLAME Class

BASS.NET API for the Un4seen BASS Audio Library
Encoder class implementation for MPEG Audio Layer II (MP2) encoding using "tooLAME.exe".
Inheritance Hierarchy

SystemObject
  Un4seen.Bass.MiscBaseEncoder
    Un4seen.Bass.MiscEncoderTooLAME

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

[SerializableAttribute]
public sealed class EncoderTooLAME : BaseEncoder

The EncoderTooLAME type exposes the following members.

Constructors

  NameDescription
Public methodEncoderTooLAME
Creates an instance of a tooLAME encoder implementation.
Top
Properties

  NameDescription
Public propertyChannelBitwidth
This property returns the actual bitwidth of the sample data of the channel (e.g. 8, 16, 32).
(Inherited from BaseEncoder.)
Public propertyChannelHandle
Gets or Sets the channel handle which is used to create the broadcast encoder class.
(Inherited from BaseEncoder.)
Public propertyChannelInfo
Returns the general channel info.
(Inherited from BaseEncoder.)
Public propertyChannelNumChans
This property returns the actual number of channles of the sample data BASS is using with the channel (e.g. 1=mono, 2=stereo, etc.).
(Inherited from BaseEncoder.)
Public propertyChannelSampleRate
This property returns the actual sample rate in Hz of the sample data BASS is using with the channel (e.g. 44100).
(Inherited from BaseEncoder.)
Public propertyDefaultOutputExtension
This return the default extension of an output file for this encoder (".mp2").
(Overrides BaseEncoderDefaultOutputExtension.)
Public propertyEffectiveBitrate
Returns the effective encoder bitrate (in kbps) of the output.
(Overrides BaseEncoderEffectiveBitrate.)
Public propertyEncoderCommandLine
Gets the actual encoder command-line string (using all TOO_xxx properties).
(Overrides BaseEncoderEncoderCommandLine.)
Public propertyEncoderDirectory
Gets or Sets the encoder's base directory.
(Inherited from BaseEncoder.)
Public propertyEncoderExists
This property return , if the file "tooLAME.exe" exists in the EncoderDirectory - else is returned.
(Overrides BaseEncoderEncoderExists.)
Public propertyEncoderHandle
Gets or sets the current HENCODE encoder handle.
(Inherited from BaseEncoder.)
Public propertyEncoderType
Gets a value indicating the type of content. Here BASS_CTYPE_STREAM_MP2 is always returned.
(Overrides BaseEncoderEncoderType.)
Public propertyForce16Bit
Always returns true, since this encoder only supports receiving 16 bit sample data.
Public propertyInputFile
Gets or Sets the input file name to be processed by the encoder (null = STDIN, default).
(Inherited from BaseEncoder.)
Public propertyIsActive
Gets a value indicating if the encoder has been started (see Start(ENCODEPROC, IntPtr, Boolean)) and is active - else will be returned.
(Inherited from BaseEncoder.)
Public propertyIsPaused
Gets a value indicating if the encoder has been paused (see Pause(Boolean)) - else must be returned.
(Inherited from BaseEncoder.)
Public propertyIsStreaming
Is this instance used for streaming? When set to true, some internal encoder options might be set. Default is false.
(Inherited from BaseEncoder.)
Public propertyNoLimit
Gets or Sets if encoding should use the CAST_NOLIMIT flag (which is only needed, if the encoder is used for streaming).
(Inherited from BaseEncoder.)
Public propertyOutputFile
Gets or Sets the output file name to be processed by the encoder (null = STDOUT, default).
(Inherited from BaseEncoder.)
Public propertySupportsSTDOUT
tooLAME implements STDOUT, so is always returned.
(Overrides BaseEncoderSupportsSTDOUT.)
Public propertyTAGs
Gets or Sets the TAG_INFO structure associated with the encoder.
(Inherited from BaseEncoder.)
Public propertyUseAsyncQueue
Gets or Sets if encoding should use an async queue (i.e. the BASS_ENCODE_QUEUE flag).
(Inherited from BaseEncoder.)
Top
Methods

  NameDescription
Public methodDispose
Implement IDisposable.
(Inherited from BaseEncoder.)
Protected methodFinalize
Finalization code.
(Inherited from BaseEncoder.)
Public methodPause
Pauses or resumes an encoder.
(Inherited from BaseEncoder.)
Public methodSettingsString
Returns the string representation of the current encoder settings.
(Overrides BaseEncoderSettingsString.)
Public methodStart
This method starts the actual tooLAME encoder. After the encoder was started successfully the EncoderHandle returns a valid HENCODE handle.
(Overrides BaseEncoderStart(ENCODEPROC, IntPtr, Boolean).)
Public methodStop
Stops the encoder immediately (if started).
(Inherited from BaseEncoder.)
Public methodStop(Boolean)
Stops the encoder (if started).
(Inherited from BaseEncoder.)
Public methodToString
Returns the name of the Encoder.
(Overrides ObjectToString.)
Top
Fields

  NameDescription
Public fieldTOO_ATH
-l: Set the ATH level. Default level is 0.0 (which will not use the property).
Public fieldTOO_Bitrate
-b: Choose a total bitrate to encode at. Takes an argument in kbps (default is 192 kbps).
Public fieldTOO_Copyright
-c: Turn on Copyright flag in output bitstream (default is ).
Public fieldTOO_CustomOptions
The custom parameter string, which should be used, if the TOO_UseCustomOptionsOnly property is set to .
Public fieldTOO_DABExtension
-D: Add DAB extensions of specific length (specify 0 (zero) to not specify a DAB extension, default).
Public fieldTOO_DeEmphasis
-d: Set the de-emphasis type (None, CCIT, 50/15ms). Default is None.
Public fieldTOO_Downmix
-a: Downmix from stereo to mono? (default is ).
Public fieldTOO_Mode
-m: The encoding mode (Stereo, Joint stereo, DualChannel, Mono, default is Auto).
Public fieldTOO_Original
-o: Mark as Original in output bitstream (default is ).
Public fieldTOO_Padding
-r: force padding bit/frame off (default is ).
Public fieldTOO_Protect
-e: Enable CRC error protection in output bitstream. An extra 16-bit checksum is added to each frame (default is ).
Public fieldTOO_PsycModel
-P: The psychoacoustic model (PAM) tooLAME should use (-1 to 4).
Public fieldTOO_Quick
-q: Enable quick mode (if value is geater than 0 (zero)). Only re-calculate psycho-acoustic model every specified number of frames (default is 0).
Public fieldTOO_UseCustomOptionsOnly
Use the TOO_CustomOptions parameter string only (default=).
Public fieldTOO_UseVBR
Enable the VBR (variable bitrate) mode (default is ).
Public fieldTOO_VBRLevel
-v: Enable VBR and set a quality level from -50 to 50 (default is disbaled).
Top
Remarks

This class uses the BASS_CTYPE_STREAM_MP2 encoder type.

"tooLAME.exe" must be downloaded separately (e.g. from www.rarewares.org or toolame.sourceforge.net). tooLAME is a very good and stable freeware MP2 encoder.

Since tooLAME does only support 16-bit sample data as input, the BASS_ENCODE_FP_16BIT flag will be used. This will be used, whenever the underlying channel handle is float or the BASS_CONFIG_FLOATDSP option has been set.

Make sure to set the TWO_xxx flags before retrieving the EncoderCommandLine or calling Start(ENCODEPROC, IntPtr, Boolean).

This implementation uses the automatic DSP system for encoding. Meaning the sending of sample data to the encoder is done automatically when you play the channel (BASS_ChannelPlay(Int32, Boolean)) or call BASS_ChannelGetData(Int32, IntPtr, Int32) (if it's a decoding channel). So there is no need to call BASS_Encode_Write(Int32, IntPtr, Int32) manually!

If you simply want to encode a physical file please also take a look to the EncodeFile(String, String, BaseEncoder, BaseEncoderENCODEFILEPROC, Boolean, Boolean).

See Also

Reference