Exemplo n.º 1
0
		private void FlushThread()
		{
			AudioBuffer result = new AudioBuffer(_mixer.PCM, _mixer.BufferSize);
			while (true)
			{
				buffer.Read(result, -1);
				if (_icecastWriter != null && !close)
				{
					try
					{
						_icecastWriter.Write(result);
					}
					catch (Exception ex)
					{
						close = true;
					}
				}
				if (_icecastWriter != null && close)
				{
					_icecastWriter.Delete();
					_icecastWriter = null;
				}
			}
		}
Exemplo n.º 2
0
		private void checkBoxTransmit_CheckedChanged(object sender, EventArgs e)
		{
			close = !checkBoxTransmit.Checked;
			this.toolTip1.SetToolTip(this.checkBoxTransmit, "");
			if (!close && _icecastWriter == null)
			{
				IcecastWriter icecastWriter = new IcecastWriter(_mixer.PCM, _icecastSettings);
				try
				{
					icecastWriter.Connect();
					if (icecastWriter.Response.StatusCode == HttpStatusCode.OK)
						_icecastWriter = icecastWriter;
					else
					{
						toolTip1.ToolTipIcon = ToolTipIcon.Error;
						toolTip1.ToolTipTitle = icecastWriter.Response.StatusCode.ToString();
						toolTip1.IsBalloon = true;
						//toolTip1.Show(resp.StatusDescription, checkBoxTransmit, 0, 0, 2000);
						toolTip1.SetToolTip(checkBoxTransmit, icecastWriter.Response.StatusDescription);
					}
				}
				catch (Exception ex)
				{
					Trace.WriteLine(ex.Message);
					icecastWriter.Close();
					toolTip1.ToolTipIcon = ToolTipIcon.Error;
					toolTip1.ToolTipTitle = "Exception";
					toolTip1.IsBalloon = true;
					//toolTip1.Show(ex.Message, checkBoxTransmit, 0, 0, 2000);
					toolTip1.SetToolTip(checkBoxTransmit, ex.Message);
				}
			}
		}