public NetworkAudioPlayer(HwClient receiver) { this.receiver = receiver; receiver.SetUp(OnDataReceived); waveOut = new WaveOut(); waveProvider = new BufferedWaveProvider(new WaveFormat(8000, 16, 2)); waveOut.Init(waveProvider); waveOut.Play(); }
public NetworkAudioSender(int inputDeviceNumber, HwClient audioSender) { this.audioSender = audioSender; waveIn = new WaveInEvent { BufferMilliseconds = 100, DeviceNumber = inputDeviceNumber, WaveFormat = new WaveFormat(8000, 16, 2) }; waveIn.DataAvailable += OnAudioCaptured; waveIn.StartRecording(); }
static void Main(string[] args) { // SENDER var client = new HwClient("tcp://18.185.114.115:5555", ZSocketType.DEALER, BindingType.Connect, "Master Unit"); var audio = new NetworkAudioSender(0, client); while (client.IsRunning()) { while (true) { var input = Console.ReadLine(); if (input == "q") { client.SetRunning(false); Environment.Exit(0); } } } // PLAYER /* * var client = new HwClient("tcp://18.185.114.115:5555", ZSocketType.DEALER, BindingType.Connect, "Master Unit2"); * var audio = new NetworkAudioPlayer(client); * while (client.IsRunning()) * { * while (true) * { * var input = Console.ReadLine(); * * if (input == "q") * { * client.SetRunning(false); * Environment.Exit(0); * } * } * } */ //SERVER /* * var server = new HwServer("tcp://*:5555", ZSocketType.ROUTER, BindingType.Bind); * while (server.IsRunning()) * { * while (true) * { * var input = Console.ReadLine(); * * if (input == "q") * Environment.Exit(0); * else * { * server.SendString("Master Unit", "str", input); * } * } * } */ }