public bool SetNotifyHandler(IWaveNotifyHandler notifyHander) { bool result = false; if (notifyHander != null) { if (_WaveNotify == null) { Interlocked.Exchange(ref _WaveNotify, notifyHander); } else { // Only 1 member is supported throw new InvalidOperationException(); } } else { Interlocked.Exchange(ref _WaveNotify, null); } return result; }
private IWaveNotifyHandler _WaveNotify; // Audio Event handler #endregion Fields #region Constructors public WaveOutDevice() { _hWaveOut = IntPtr.Zero; _DeviceState = (int)WaveStatus.waveClosed; _AudioBuffers = new Dictionary<int, WaveBuffer>(); _WaveNotify = null; _Callback = null; }