コード例 #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
ファイル: WaveOut.cs プロジェクト: hainam2101/karaoke
 /// <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
ファイル: WaveOut.cs プロジェクト: weimingtom/OtterUI
 /// <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");
            }
        }