private void CheckForAbort() { if (_aborted) { // Synchronous operation lock (_queueIn) { foreach (InItem inItem in _queueIn) { // Do we have an event or a sound buffer if (inItem._waveHeader != null) { WaveHeader waveHeader = inItem._waveHeader; Interop.WinMM.waveOutUnprepareHeader( _hwo, waveHeader.WAVEHDR.AddrOfPinnedObject(), waveHeader.SizeHDR); waveHeader.Dispose(); } else { _asyncDispatch.Post(inItem._userData); } } _queueIn.Clear(); // if the queue is empty, then restart the callers thread _evt.Set(); } } ClearBuffers(); }
public void Dispose() { if (_waveHeader != null) { _waveHeader.Dispose(); } GC.SuppressFinalize(this); }
private void ClearBuffers() { foreach (InItem item in _queueOut) { WaveHeader waveHeader = item._waveHeader; Interop.WinMM.MMSYSERR result = Interop.WinMM.waveOutUnprepareHeader( _hwo, waveHeader.WAVEHDR.AddrOfPinnedObject(), waveHeader.SizeHDR); if (result != Interop.WinMM.MMSYSERR.NOERROR) { //System.Diagnostics.Debug.Assert (false); } waveHeader.Dispose(); } _queueOut.Clear(); }