public static void stopSending()
 {
     if (microphoneDevice != null)
     {
         microphoneDevice.Stop();
         microphoneDevice = null;
     }
     switch (Protocol)
     {
         case Protocols.Shoutcast:
             if (socket != null && socket.Connected)
             {
                 socket.Disconnect(false);
                 socket.Dispose();
                 socket = null;
             }
             break;
         case Protocols.Icecast:
             if (icecastStream != null)
             {
                 icecastStream.Close(0);
                 icecastStream.Dispose();
                 icecastStream = null;
             }
             if (client.Connected)
                 client.Close();
             if (client != null)
                 client = null;
             break;
     }
 }
 private static void establishMicrophone()
 {
     microphoneDevice = new WaveIn(RawMicrophoneDevice, inputFormat.nSamplesPerSec, inputFormat.wBitsPerSample, inputFormat.nChannels, inputFormat.nSamplesPerSec * (inputFormat.wBitsPerSample / 8) * inputFormat.nChannels);
     microphoneDevice.BufferFull += sendBuffer;
 }