Пример #1
0
        public AudioListener(IPAddress ipAddress, int port)
        {
            this.IPAddress = ipAddress;
            this.Port      = port;
            codec          = new G722ChatCodec();

            IPEndPoint defaultEP = new IPEndPoint(IPAddress.Any, 0);
            IPEndPoint wherefrom = new IPEndPoint(ipAddress, port);
            IPEndPoint bindEP    = new IPEndPoint(IPAddress.Any, port);

            connection = new MulticastUdpConnection(defaultEP, wherefrom, bindEP, 100);

            listener = new Listener();
            listener.Init(connection);
            listener.MessageAvailableEvent += DataAvailable;
        }
Пример #2
0
        public VoiceStreamer(IPAddress ipAddress, int port, WaveFormat format)
        {
            codec            = new G722ChatCodec();
            Client           = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            Input            = WaveIOHellper.CreateWaveIn();
            Input.WaveFormat = format;

            bufferedWaveProvider      = new BufferedWaveProvider(Input.WaveFormat);
            volumeWaveProvider        = new VolumeWaveProvider16(bufferedWaveProvider);
            volumeWaveProvider.Volume = 1;

            Input.DataAvailable += VoiceInput;
            this.IPAddress       = ipAddress;
            this.Port            = port;
            RemotePoint          = new IPEndPoint(this.IPAddress, port);
            _sendFailed          = false;
        }