private void WriteToWaveOut() { MmResult result; lock (waveOutLock) { result = WaveInterop.waveOutWrite(hWaveOut, header, Marshal.SizeOf(header)); } if (result != MmResult.NoError) { throw new MmException(result, "waveOutWrite"); } GC.KeepAlive(this); }