private void CallBackProc(IntPtr hwo, MM_MSG uMsg, IntPtr dwInstance, IntPtr dwParam1, IntPtr dwParam2) { if (uMsg == MM_MSG.MM_WOM_DONE) { lock (_queueIn) { InItem inItem = _queueIn[0]; inItem.ReleaseData(); _queueIn.RemoveAt(0); _queueOut.Add(inItem); while (_queueIn.Count > 0) { inItem = _queueIn[0]; if (inItem._waveHeader != null) { break; } if (_asyncDispatch != null && !_aborted) { _asyncDispatch.Post(inItem._userData); } _queueIn.RemoveAt(0); } } if (_queueIn.Count == 0) { _evt.Set(); } } }
private void CallBackProc(IntPtr hwo, MM_MSG uMsg, IntPtr dwInstance, IntPtr dwParam1, IntPtr dwParam2) { if (uMsg == MM_MSG.MM_WOM_DONE) { InItem inItem; lock (_queueIn) { inItem = _queueIn[0]; inItem.ReleaseData(); _queueIn.RemoveAt(0); _queueOut.Add(inItem); // look for the next elements in the queue if they are events to throw! while (_queueIn.Count > 0) { inItem = _queueIn[0]; // Do we have an event or a sound buffer if (inItem._waveHeader == null) { if (_asyncDispatch != null && !_aborted) { _asyncDispatch.Post(inItem._userData); } _queueIn.RemoveAt(0); } else { break; } } } // if the queue is empty, then restart the callers thread if (_queueIn.Count == 0) { _evt.Set(); } } }