Starts the underlying encoder (see Encoder).
Namespace: Un4seen.Bass.Misc
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax
Parameters
- proc
- Type: Un4seen.Bass.AddOn.EncENCODEPROC
Optional callback function to receive the encoded data. To have the encoded data received by a callback function, the encoder needs to be told to output to STDOUT (instead of a file), so SupportsSTDOUT must return true. - 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: BooleanReturn , if the encoder was successfully started - else is returned (see LastError or LastErrorMessage for details).
Remarks
Do NOT call this method, if you are in AutomaticMode, since the encoder will be started automatically in this case.
If the encoder was already started, this method anyhow returns - however no Notification event will be raised in this case.
If you Connect manually, your ENCODEPROC must call SendData(IntPtr, Int32) manually as well, see the example below.
Examples
private BroadCast _broadCast; private ENCODEPROC _myEncProc; ... // create your encoder (using a recording handle) EncoderLAME lame = new EncoderLAME(_recHandle); // create an streaming server instance SHOUTcast shoutcast = new SHOUTcast(lame); // create the broadcast instance _broadCast = new BroadCast(shoutcast); _broadCast.AutoReconnect = true; _broadCast.Notification += new BroadCastEventHandler(OnBroadCast_Notification); // create your encoder callback _myEncProc = new ENCODEPROC(MyEncodingCallback); // start the encoder (paused) _broadCast.StartEncoder(_myEncProc, IntPtr.Zero, true); // now connect to start your broadcast _broadCast.Connect(); // and really start the encoder _broadCast.Server.Encoder.Pause(false); ... // your broadcast encoder callback implementation private void MyEncodingCallback(int handle, int channel, IntPtr buffer, int length, IntPtr user) { // here we receive the encoded data back (manual mode) if ( _broadCast.IsConnected ) { _broadCast.SendData(buffer, length); } } private void OnBroadCast_Notification(object sender, BroadCastEventArgs e) { if (e.EventType == BroadCastEventType.EncoderRestartRequired) _broadCast.StartEncoder(_myEncProc, 0); if (!_broadCast.IsConnected) { // connection lost } }
See Also