private void DataArrived(IntPtr data, int size) { if (_recorderBuffer == null || _recorderBuffer.Length < size) { _recorderBuffer = new byte[size]; } if (_recorderBuffer != null) { System.Runtime.InteropServices.Marshal.Copy(data, _recorderBuffer, 0, size); if (_isPlayer == true) { _stream.Write(_recorderBuffer, 0, _recorderBuffer.Length); } _audioFrame.Process(ref _recorderBuffer); _audioFrame.RenderTimeDomain(ref pictureBox1); _audioFrame.RenderFrequencyDomain(ref pictureBox2); } }