BASS.NET API for the Un4seen BASS Audio Library

EncoderWMAStart Method

BASS.NET API for the Un4seen BASS Audio Library
This method starts the actual WMA encoder.

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

public override bool Start(
	ENCODEPROC proc,
	IntPtr user,
	bool paused
)

Parameters

proc
Type: Un4seen.Bass.AddOn.EncENCODEPROC
Optional callback function to receive the encoded data... = no callback.
user
Type: SystemIntPtr
User instance data to pass to the callback function.
paused
Type: SystemBoolean
Start the encoder paused? If , you might use Pause(Boolean) to unpause (and really start the encoder).

Return Value

Type: Boolean
Returns , if the encoder was successfully started - else is returned.

Implements

IBaseEncoderStart(ENCODEPROC, IntPtr, Boolean)
Remarks

This method calls BASS_WMA_EncodeOpen(Int32, Int32, BASSWMAEncode, Int32, WMENCODEPROC, IntPtr), BASS_WMA_EncodeOpenFile(Int32, Int32, BASSWMAEncode, Int32, String), BASS_WMA_EncodeOpenNetwork(Int32, Int32, BASSWMAEncode, Int32, Int32, Int32) or BASS_WMA_EncodeOpenPublish(Int32, Int32, BASSWMAEncode, Int32, String, String, String) (resp. BASS_WMA_EncodeOpenNetworkMulti(Int32, Int32, BASSWMAEncode, Int32, Int32, Int32) or BASS_WMA_EncodeOpenPublishMulti(Int32, Int32, BASSWMAEncode, Int32, String, String, String) if the WMA_MultiBitrate was set) internally depending on the WMA_UseNetwork and WMA_UsePublish properties.

If you have specified a file name for InputFile (instead of ), a default stream using BASS_StreamCreateFile(String, Int64, Int64, BASSFlag) will be created internally and all it's data will immediately be encoded (meaning the paused flag will have no effect).

After the encoder was started successfully the EncoderHandle returns a valid HENCODE handle. If the encoder was not started successfully or was stopped EncoderHandle returns 0 (zero).

The proc is only used, if you have set the WMA_UseNetwork property to and are encoding to STDOUT (OutputFile must be ). If in such case the proc is invoked you need to be aware of one special WMA case: When encoding begins, an initial header is given. When encoding is completed, an updated header is given (the initial header should be replaced by the updated one). The WMA header can be recognized by a negative 'length' parameter, whereas positive 'length' values will indicate plain WMA encoded data.

Internally, the sending of sample data to the encoder is implemented via a DSP callback on the channel. That means when you play the channel (or call BASS_ChannelGetData(Int32, IntPtr, Int32) if it's a decoding channel), the sample data will be sent to the encoder at the same time. So in contrast to the standard BASSwma implementation there is no need to manually feed (write) any sample data to the encoder.

If an encoder stops running prematurely, Stop should still be called to release resources that were allocated for the encoding. You might use the WMA_Notify property to get informed when this happens.

See Also

Reference