Beispiel #1
0
        /// <summary>
        /// Pause the audio
        /// </summary>
        public void Pause()
        {
            if (playbackState == PlaybackState.Playing)
            {
                playbackState = PlaybackState.Paused; // set this here, to avoid a deadlock with some drivers

                MmResult result;
                lock (waveOutLock)
                {
                    result = WaveInterop.waveOutPause(hWaveOut);
                }
                if (result != MmResult.NoError)
                {
                    throw new MmException(result, "waveOutPause");
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Pause the audio
        /// </summary>
        public void Pause()
        {
            if (Thread.CurrentThread.ManagedThreadId != waveOutThread.ManagedThreadId)
            {
                lock (actionQueue)
                {
                    actionQueue.Enqueue(new WaveOutAction(WaveOutFunction.Pause, null));
                    workAvailable.Set();
                }
                return;
            }

            MmResult result = WaveInterop.waveOutPause(hWaveOut);

            if (result != MmResult.NoError)
            {
                throw new MmException(result, "waveOutPause");
            }
            playbackState = PlaybackState.Paused;
        }