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; }
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); }
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; }