Exemplo n.º 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");
                }
            }
        }
Exemplo n.º 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;
        }