예제 #1
0
파일: WaveOut.cs 프로젝트: senlinms/naudio
        /// <summary>
        /// Stop and reset the WaveOut device
        /// </summary>
        public void Stop()
        {
            if (playbackState != PlaybackState.Stopped)
            {
                // in the call to waveOutReset with function callbacks
                // some drivers will block here until OnDone is called
                // for every buffer
                playbackState = PlaybackState.Stopped; // set this here to avoid a problem with some drivers whereby
                MmResult result;
                lock (waveOutLock)
                {
                    result = WaveInterop.waveOutReset(hWaveOut);
                }
                if (result != MmResult.NoError)
                {
                    throw new MmException(result, "waveOutReset");
                }

                // with function callbacks, waveOutReset will call OnDone,
                // and so PlaybackStopped must not be raised from the handler
                // we know playback has definitely stopped now, so raise callback
                if (callbackInfo.Strategy == WaveCallbackStrategy.FunctionCallback)
                {
                    RaisePlaybackStoppedEvent(null);
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Stop and reset the WaveOut device
 /// </summary>
 public void Stop()
 {
     if (playbackState != PlaybackState.Stopped)
     {
         MmResult result;
         lock (waveOutLock)
         {
             result = WaveInterop.waveOutReset(hWaveOut);
         }
         if (result != MmResult.NoError)
         {
             throw new MmException(result, "waveOutReset");
         }
         playbackState = PlaybackState.Stopped;
     }
 }
예제 #3
0
 /// <summary>
 /// Stop and reset the WaveOut device
 /// </summary>
 // Token: 0x06000A16 RID: 2582 RVA: 0x0001D550 File Offset: 0x0001B750
 public void Stop()
 {
     if (this.playbackState != PlaybackState.Stopped)
     {
         this.playbackState = PlaybackState.Stopped;
         MmResult mmResult;
         lock (this.waveOutLock)
         {
             mmResult = WaveInterop.waveOutReset(this.hWaveOut);
         }
         if (mmResult != MmResult.NoError)
         {
             throw new MmException(mmResult, "waveOutReset");
         }
         this.callbackEvent.Set();
     }
 }
예제 #4
0
 /// <summary>
 /// Stop and reset the WaveOut device
 /// </summary>
 public void Stop()
 {
     if (playbackState != PlaybackState.Stopped)
     {
         MmResult result;
         playbackState = PlaybackState.Stopped; // set this here to avoid a problem with some drivers whereby
         // in the call to waveOutReset they don't return until an OnDone is called
         lock (waveOutLock)
         {
             result = WaveInterop.waveOutReset(hWaveOut);
         }
         if (result != MmResult.NoError)
         {
             throw new MmException(result, "waveOutReset");
         }
     }
 }
예제 #5
0
 /// <summary>
 /// Stop and reset the WaveOut device
 /// </summary>
 public void Stop()
 {
     if (playbackState != PlaybackState.Stopped)
     {
         // in the call to waveOutReset with function callbacks
         // some drivers will block here until OnDone is called
         // for every buffer
         playbackState = PlaybackState.Stopped; // set this here to avoid a problem with some drivers whereby
         MmResult result;
         lock (waveOutLock)
         {
             result = WaveInterop.waveOutReset(hWaveOut);
         }
         if (result != MmResult.NoError)
         {
             throw new MmException(result, "waveOutReset");
         }
         callbackEvent.Set(); // give the thread a kick, make sure we exit
     }
 }
예제 #6
0
 public void Stop()
 {
     if (this.playbackState != PlaybackState.Stopped)
     {
         this.playbackState = PlaybackState.Stopped;
         MmResult mmResult;
         lock (this.waveOutLock)
         {
             mmResult = WaveInterop.waveOutReset(this.hWaveOut);
         }
         if (mmResult != MmResult.NoError)
         {
             throw new MmException(mmResult, "waveOutReset");
         }
         if (this.callbackInfo.Strategy == WaveCallbackStrategy.FunctionCallback)
         {
             this.RaisePlaybackStoppedEvent(null);
         }
     }
 }
예제 #7
0
        /// <summary>
        /// Stop and reset the WaveOut device
        /// </summary>
        public void Stop()
        {
            if (Thread.CurrentThread.ManagedThreadId != waveOutThread.ManagedThreadId)
            {
                lock (actionQueue)
                {
                    actionQueue.Enqueue(new WaveOutAction(WaveOutFunction.Stop, null));
                    workAvailable.Set();
                }
                return;
            }

            playbackState = PlaybackState.Stopped;
            buffersQueued = false;
            MmResult result = WaveInterop.waveOutReset(hWaveOut);

            if (result != MmResult.NoError)
            {
                throw new MmException(result, "waveOutReset");
            }
        }