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"); }
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 ); } _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 ManageAudioSendBuffer(OpusCodec codec, MumbleUdpConnection udpConnection, MumbleClient mumbleClient) { _udpConnection = udpConnection; _codec = codec; _mumbleClient = mumbleClient; _pcmArrays = new List <PcmArray>(); _encodingBuffer = new AudioEncodingBuffer(); }
public ManageAudioSendBuffer(MumbleUdpConnection udpConnection, MumbleClient mumbleClient) { _udpConnection = udpConnection; _mumbleClient = mumbleClient; _pcmArrays = new List <PcmArray>(); _encodingBuffer = new AudioEncodingBuffer(); _waitHandle = new AutoResetEvent(false); }
public ManageAudioSendBuffer(MumbleUdpConnection udpConnection, MumbleClient mumbleClient, int maxPositionalLength) { _isRunning = true; _udpConnection = udpConnection; _mumbleClient = mumbleClient; _pcmArrays = new List <PcmArray>(); _encodingBuffer = new AudioEncodingBuffer(); _waitHandle = new AutoResetEvent(false); _maxPositionalLength = maxPositionalLength; }
public ManageAudioSendBuffer(OpusCodec codec, MumbleUdpConnection udpConnection, MumbleClient mumbleClient) { _udpConnection = udpConnection; _codec = codec; _mumbleClient = mumbleClient; _pcmArrays = new List <PcmArray>(); _encodingBuffer = new AudioEncodingBuffer(); _encodingThread = new Thread(EncodingThreadEntry) { IsBackground = true }; }
internal MumbleTcpConnection(IPEndPoint host, string hostname, UpdateOcbServerNonce updateOcbServerNonce, MumbleUdpConnection udpConnection, MumbleClient mumbleClient) { _host = host; _hostname = hostname; _mumbleClient = mumbleClient; _udpConnection = udpConnection; _tcpClient = new TcpClient(); _updateOcbServerNonce = updateOcbServerNonce; _processThread = new Thread(ProcessTcpData) { IsBackground = true }; }
public void Close() { if (_tcpConnection != null) { _tcpConnection.Close(); } _tcpConnection = null; if (_udpConnection != null) { _udpConnection.Close(); } _udpConnection = null; if (_manageSendBuffer != null) { _manageSendBuffer.Dispose(); } _manageSendBuffer = null; }
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; }