public MumbleClient(string hostName, int port, AudioPlayerCreatorMethod createMumbleAudioPlayerMethod, AudioPlayerRemoverMethod removeMumbleAudioPlayerMethod, DebugValues debugVals = null)
        {
            IPAddress[] addresses = Dns.GetHostAddresses(hostName);
            if (addresses.Length == 0)
            {
                throw new ArgumentException(
                          "Unable to retrieve address from specified host name.",
                          hostName
                          );
            }
            var host = new IPEndPoint(addresses[0], port);

            _udpConnection = new MumbleUdpConnection(host, this);
            _tcpConnection = new MumbleTcpConnection(host, hostName, _udpConnection.UpdateOcbServerNonce, _udpConnection, this);
            _udpConnection.SetTcpConnection(_tcpConnection);
            _audioPlayerCreator   = createMumbleAudioPlayerMethod;
            _audioPlayerDestroyer = removeMumbleAudioPlayerMethod;

            if (debugVals == null)
            {
                debugVals = new DebugValues();
            }
            _debugValues = debugVals;

            //Maybe do Lazy?
            _codec = new OpusCodec();

            _manageSendBuffer = new ManageAudioSendBuffer(_codec, _udpConnection, this);
        }
Exemplo n.º 2
0
 public void Close()
 {
     Debug.Log("Closing mumble");
     if (_manageSendBuffer != null)
     {
         _manageSendBuffer.Dispose();
     }
     _manageSendBuffer = null;
     if (_tcpConnection != null)
     {
         _tcpConnection.Close();
     }
     _tcpConnection = null;
     if (_udpConnection != null)
     {
         _udpConnection.Close();
     }
     _udpConnection = null;
     if (_audioDecodeThread != null)
     {
         _audioDecodeThread.Dispose();
     }
     _audioDecodeThread = null;
     Debug.Log("Mumble closed");
 }
Exemplo n.º 3
0
        private void Init(IPAddress[] addresses)
        {
            //Debug.Log("Host addresses recv");
            if (addresses == null || addresses.Length == 0)
            {
                Debug.LogError("Failed to get addresses!");
                throw new ArgumentException(
                          "Unable to retrieve address from specified host name.",
                          _hostName
                          );
            }

            _addresses = addresses;
            var endpoint = new IPEndPoint(_addresses[0], _port);

            _audioDecodeThread  = new AudioDecodeThread(_outputSampleRate, _outputChannelCount, this);
            _decodingBufferPool = new DecodingBufferPool(_audioDecodeThread);
            _udpConnection      = new MumbleUdpConnection(endpoint, _audioDecodeThread, this);
            _tcpConnection      = new MumbleTcpConnection(endpoint, _hostName,
                                                          _udpConnection.UpdateOcbServerNonce, _udpConnection, this);

            _udpConnection.SetTcpConnection(_tcpConnection);
            _manageSendBuffer = new ManageAudioSendBuffer(_udpConnection, this, _maxPositionalDataLength);
            ReadyToConnect    = true;
        }
Exemplo n.º 4
0
 public void Close()
 {
     if (_tcpConnection != null)
     {
         _tcpConnection.Close();
     }
     _tcpConnection = null;
     if (_udpConnection != null)
     {
         _udpConnection.Close();
     }
     _udpConnection = null;
     if (_manageSendBuffer != null)
     {
         _manageSendBuffer.Dispose();
     }
     _manageSendBuffer = null;
 }
Exemplo n.º 5
0
        private void Init(IPAddress[] addresses)
        {
            //Debug.Log("Host addresses recv");
            if (addresses == null || addresses.Length == 0)
            {
                Debug.LogError("Failed to get addresses!");
                throw new ArgumentException(
                          "Unable to retrieve address from specified host name.",
                          _hostName
                          );
            }
            var endpoint = new IPEndPoint(addresses[0], _port);

            _udpConnection = new MumbleUdpConnection(endpoint, this);
            _tcpConnection = new MumbleTcpConnection(endpoint, _hostName, _udpConnection.UpdateOcbServerNonce, _udpConnection, this);
            _udpConnection.SetTcpConnection(_tcpConnection);
            _codec            = new OpusCodec();
            _manageSendBuffer = new ManageAudioSendBuffer(_codec, _udpConnection, this);
            ReadyToConnect    = true;
        }
Exemplo n.º 6
0
 internal void SetTcpConnection(MumbleTcpConnection tcpConnection)
 {
     _tcpConnection = tcpConnection;
 }