BASS.NET API for the Un4seen BASS Audio Library

EncoderWMA Class

BASS.NET API for the Un4seen BASS Audio Library
Encoder class implementation for the Windows Media Audio codec using Un4seen.Bass.AddOn.Wma.
Inheritance Hierarchy

SystemObject
  Un4seen.Bass.MiscBaseEncoder
    Un4seen.Bass.MiscEncoderWMA

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

[SerializableAttribute]
public sealed class EncoderWMA : BaseEncoder

The EncoderWMA type exposes the following members.

Constructors

  NameDescription
Public methodEncoderWMA
Creates an instance of a Windows Media Audio 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 (".wma").
(Overrides BaseEncoderDefaultOutputExtension.)
Public propertyEffectiveBitrate
Returns the effective encoder bitrate (in kbps) of the output.
(Overrides BaseEncoderEffectiveBitrate.)
Public propertyEncoderCommandLine
Returns an empty string, since WMA does not use any command-line tool, but instead directly uses the Un4seen.Bass.AddOn.Wma add-on.
(Overrides BaseEncoderEncoderCommandLine.)
Public propertyEncoderDirectory
Gets or Sets the encoder's base directory.
(Inherited from BaseEncoder.)
Public propertyEncoderExists
This property always return , since we use the native BASSWMA add-on.
(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_WAV is always returned.
(Overrides BaseEncoderEncoderType.)
Public propertyForce16Bit
Always returns false, since this encoder doesn't supports this flag. Use the WMA_Use24Bit property instead.
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.
(Overrides BaseEncoderIsActive.)
Public propertyIsPaused
Gets a value indicating if the encoder has been paused (see Pause(Boolean)) - else will be returned.
(Overrides BaseEncoderIsPaused.)
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
WMA does implement 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.)
Public propertyWMA_Notify
Gets ot Sets a ENCODENOTIFYPROC on the WMA encoder.
Top
Methods

  NameDescription
Public methodDispose
Implement IDisposable.
(Inherited from BaseEncoder.)
Protected methodFinalize
Finalization code.
(Inherited from BaseEncoder.)
Public methodPause
Pauses or resumes an encoder
(Overrides BaseEncoderPause(Boolean).)
Public methodSetTag
Sets a tag in a WMA encoding.
Public methodSettingsString
Returns the string representation of the current encoder settings.
(Overrides BaseEncoderSettingsString.)
Public methodStart
This method starts the actual WMA encoder.
(Overrides BaseEncoderStart(ENCODEPROC, IntPtr, Boolean).)
Public methodStop
Stops the encoder (if started).
(Overrides BaseEncoderStop.)
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 fieldWMA_Bitrate
Choose a total bitrate to encode at. Takes an argument in kbps (default is 128 kbps).
Public fieldWMA_ForceStandard
When set to , the WMA standard codec (WMA 9) will be forced to use (default is ).
Public fieldWMA_MultiBitrate
Here you can specify an array of encoding bitrates (in bits per second!) to use in case you selected WMA_UseNetwork or WMA_UsePublish - default is .
Public fieldWMA_NetworkClients
The maximum number of clients (up to 50) that can be connected (only used, if WMA_UseNetwork is set to and WMA_UsePublish is set to ) - default is 1.
Public fieldWMA_NetworkPort
The network port number for clients to conenct to (only used, if WMA_UseNetwork is set to and WMA_UsePublish is set to ) - default is 8080.
Public fieldWMA_PublishPassword
Password to use in connecting to the server.
Public fieldWMA_PublishUrl
URL of the publishing point on the Windows Media server.
Public fieldWMA_PublishUsername
Username to use in connecting to the server.
Public fieldWMA_Use24Bit
Use 24-bit encoding? (Default is ).
Public fieldWMA_UseNetwork
Enables WMA encoding to the network (default is ).
Public fieldWMA_UsePro
Use the WMA 10 Professional format? (Default is = WMA 9 format).
Public fieldWMA_UsePublish
Enables WMA encoding to a publishing point on a Windows Media server.
Public fieldWMA_UseVBR
Enable the VBR (variable bitrate) mode (default is ).
Public fieldWMA_VBRQuality
Set a VBR quality level from 1 (very low) to 100 (lossless).
Top
Remarks

This class uses the BASS_CTYPE_STREAM_WMA encoder type.

Since WMA does support 8-, 16-, and 32-bit(IEEE float) sample data as input, no BASS_ENCODE_FP_ flag will be used.

Make sure to set the WMA_xxx flags before calling Start(ENCODEPROC, IntPtr, Boolean).

As with all encoders in this framework also this WMA encoder always automatically encodes sample data (by using a DSP callback). So there is no need to manually send any sample data to the encoder.

The WMA_Notify property can be used to setup a ENCODENOTIFYPROC to receive notifications about the encoder status (e.g. when the encoder died).

IMPORTANT NOTE: This implementation uses BASSwma. So make sure the BASSwma add-on and dll is available.

Examples

Manual encoding of a stream (here in lossless format):
int stream = Bass.BASS_StreamCreateFile("test.wav", 0, 0, BASSFlag.BASS_STREAM_DECODE);
EncoderWMA wma = new EncoderWMA(stream);
wma.WMA_UseVBR = true;
wma.WMA_VBRQuality = 100; // lossless
wma.InputFile = null;      //STDIN
wma.OutputFile = "test.wma";
wma.Start(null, IntPtr.Zero, false);
// encode all the data right away
Utils.DecodeAllData(stream, true);
wma.Stop();
Automatic encoding to the local network (using a recording handle):
EncoderWMA wma = new EncoderWMA(_recHandle);
wma.WMA_UseVBR = false;
wma.WMA_Bitrate = 64;
wma.WMA_UsePro = true;
wma.WMA_UseNetwork = true;
wma.WMA_NetworkPort = 80;
wma.WMA_NetworkClients = 10;
wma.InputFile = null;  //STDIN
wma.OutputFile = null; //STDOUT
wma.Start(null, IntPtr.Zero, false);
...
// encodes until this is called
wma.Stop();
See Also

Reference