Un4seen.Bass.MiscBroadCast
Namespace: Un4seen.Bass.Misc
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
The BroadCast type exposes the following members.
Name | Description | |
---|---|---|
BroadCast |
Creates an instance of the broadcasting class using the specified streaming server.
|
Name | Description | |
---|---|---|
AutomaticMode |
Gets if the automatic mode was used (, if AutoConnect was called, else meaning Connect was used instead).
| |
AutoReconnect |
Gets or Sets if the broadcast connection should automatically be reconnected in case of a connection or encoder error (default=).
| |
IsConnected |
Connected to the server? (=connected).
| |
IsStarted |
Is the server started? (=started).
| |
NotificationSuppressDataSend |
Gets or Sets, if the DataSend event will be raised when subscribed to the Notification event handler (default is ).
| |
NotificationSuppressIsAlive |
Gets or Sets, if the IsAlive event will be raised when subscribed to the Notification event handler and AutoReconnect is enabled (default is ).
| |
ReconnectTimeout |
Gets or Sets the reconnect timeout in seconds (default is 5sec.).
| |
Server |
Returns the streaming server interface which is used with this instance.
| |
Status |
Gets the current broadcast status.
| |
TotalBytesSend |
Returns the total number of bytes send to the server during a broadcast.
| |
TotalConnectionTime |
Returns the total online connection time (for how long the broadcast is already running since it was connected).
|
Name | Description | |
---|---|---|
AutoConnect | ||
Connect | ||
Disconnect |
Disconnects from the broadcast server calling Disconnect (also stops the encoder using Stop).
| |
GetListeners |
Returns the number of listeners currently connected.
| |
GetStats |
Returns the XML stats of the server.
| |
SendData |
Sends encoded sample data manually to the broadcast server (e.g. the data as received in an own ENCODEPROC).
| |
StartEncoder |
Starts the underlying encoder (see Encoder).
| |
StopEncoder |
Stops the Encoder | |
UpdateTitle(String, String) |
Updates the title of the playing song on a broadcast server.
| |
UpdateTitle(TAG_INFO, String) |
Updates the title of the playing song on a broadcast server.
|
Name | Description | |
---|---|---|
Notification |
Event handler used to notify that the BroadCast status has changed or that a BroadCast event has occurred.
|
To setup broadcast streaming you first need to create an instance of a class, which is derived from the StreamingServer class (e.g. SHOUTcast or ICEcast). These classes will contain all necessary configuration data (e.g. server address an port, username and password, station description etc., as well as an IBaseEncoder instance, which defines the target broadcasting encoder format).
The BroadCast class support manual streaming (e.g. in your own DSPPROC or ENCODEPROC) as well as automatic streaming. Automatic streaming is implemented internally also via a user DSP.
If you want to broadcast to multiple outputs (multiple servers) you need to create an instance for each output seperately.
private int _recHandle; private BroadCast _broadCast; ... _recHandle = Bass.BASS_RecordStart(44100, 2, BASSFlag.BASS_DEFAULT, null, 0); ... // create an encoder instance (e.g. for MP3 use EncoderLAME): EncoderLAME lame = new EncoderLAME(_recHandle); lame.InputFile = null; //STDIN lame.OutputFile = null; //STDOUT lame.LAME_Bitrate = (int)EncoderLAME.BITRATE.kbps_56; lame.LAME_Mode = EncoderLAME.LAMEMode.Mono; lame.LAME_TargetSampleRate = (int)EncoderLAME.SAMPLERATE.Hz_22050; lame.LAME_Quality = EncoderLAME.LAMEQuality.Quality; // create a StreamingServer instance (e.g. SHOUTcast) using the encoder: SHOUTcast shoutcast = new SHOUTcast(lame); shoutcast.ServerAddress = "localhost"; shoutcast.ServerPort = 8000; shoutcast.Password = "changeme"; shoutcast.PublicFlag = true; // use the BroadCast class to control streaming: _broadCast = new BroadCast(shoutcast); _broadCast.AutoReconnect = true; _broadCast.Notification += new BroadCastEventHandler(OnBroadCast_Notification); _broadCast.AutoConnect(); private void OnBroadCast_Notification(object sender, BroadCastEventArgs e) { // Note: this method might be called from another thread (non UI thread)! if (_broadCast == null) return; if (_broadCast.IsConnected) { // we are connected... } else { // we are not connected... } }