private void OnRemoteVoiceAdded(RemoteVoiceLink remoteVoiceLink) { int bitsPerSample = 32; string filePath = this.GetFilePath(remoteVoiceLink); if (this.Logger.IsInfoEnabled) { this.Logger.LogInfo("Incoming stream, output file path: {0}", filePath); } WaveWriter waveWriter = new WaveWriter(filePath, new WaveFormat(remoteVoiceLink.Info.SamplingRate, bitsPerSample, remoteVoiceLink.Info.Channels)); remoteVoiceLink.FloatFrameDecoded += f => { waveWriter.WriteSamples(f.Buf, 0, f.Buf.Length); }; remoteVoiceLink.RemoteVoiceRemoved += () => { if (this.Logger.IsInfoEnabled) { this.Logger.LogInfo("Remote voice stream removed: Saving wav file."); } waveWriter.Dispose(); }; }