public void Pausar() { if (_salida != null) { _salida.Pause(); } }
public bool Pause() { if (_soundOut != null) { if (_soundOut.PlaybackState != CSCore.SoundOut.PlaybackState.Paused) { _soundOut.Pause(); return(true); } } return(false); }
public async Task TogglePlayPause() { if (IsLoading || _soundSource == null || _soundOut == null) { return; } if (_fadingService.IsFading) { _fadingService.Cancel(); } if (_soundOut.PlaybackState == PlaybackState.Playing) { _playTimeStopwatch.Stop(); _isPausing = true; CurrentStateChanged(); await _fadingService.FadeOut(_soundOut, Volume); _soundOut?.Pause(); _isPausing = false; CurrentStateChanged(); } else { _playTimeStopwatch.Start(); _soundOut?.Play(); CurrentStateChanged(); await _fadingService.FadeIn(_soundOut, Volume); } }
public void Pause() { _soundOut.Pause(); this.PlayState = PlayState.Paused; Paused?.Invoke(); }
private void StopTheAlarm(ref VolumeCheckArgs vca, bool disableSound, bool disableOverlay) { if (vca.resetOverlay && vca.resetSound) { vca.meterColor = VOLUME_OK; } if (disableSound) { _soundOut.Pause(); if (_timerAlarmDelay.IsEnabled) { _timerAlarmDelay.Stop(); } } if (disableOverlay) { if (_timerOverlayShow.IsEnabled) { _timerOverlayShow.Stop(); } if (_overlayWorking) { _overlayWorking = false; } } }
private void btn_pause_Click(object sender, EventArgs e) { if (soundOut != null) { soundOut.Pause(); } }
public void Pause() { if (_soundOut != null) { _soundOut.Pause(); } }
public override void Pause() { lock (locker) { soundOut.Pause(); } }
/// <summary> /// 暂停 /// </summary> public void Pause() { if (_soundOut.PlaybackState == PlaybackState.Playing) { _soundOut.Pause(); //暂停播放 } }
public void Pause() { if (mSoundOut != null) { mSoundOut.Pause(); } }
public override void Pause() { if (_soundOut != null) { _soundOut.Pause(); } }
public void Pausar() { if (_output != null) { _output.Pause(); } }
public void PauseScore() { IsPlaying = false; if (SoundOut != null) { SoundOut.Pause(); } }
public void Pause() { if (State == SoundState.Playing) { _soundOut.Pause(); } OnSoundStateChanged(new SoundStateChangedEventArgs(SoundState.Paused)); }
private void GameBoy_PauseRequested() { if ((_soundOut != null) && (_soundOut.PlaybackState == PlaybackState.Playing)) { _soundOut.Pause(); } }
//Pause private void button_pause_Click(object sender, EventArgs e) { if (db > 0) { device.Pause(); paused = 1; } }
public void Pause() { if (_soundOut != null) { _soundOut.Pause(); } PlaybackChanged(null, null); }
public void Pause() { CheckForCreated(); if (IsPlaying) { _soundOut.Pause(); } }
public async void TogglePlayPause() { try { if (IsLoading) { _playAfterLoading = !_playAfterLoading; return; } if (CurrentTrack == null) { return; } if (_fader != null && _fader.IsFading) { _fader.CancelFading(); _fader.WaitForCancel(); } if (_soundOut.PlaybackState == PlaybackState.Playing) { if (_crossfade != null && _crossfade.IsCrossfading) { _crossfade.CancelFading(); } _isfadingout = true; CurrentStateChanged(); if (_fader != null) { await _fader.FadeOut(_soundOut, Volume); } _soundOut.Pause(); CurrentStateChanged(); _isfadingout = false; } else { try { _soundOut.Play(); } catch (Exception) { return; } CurrentStateChanged(); if (_fader != null) { await _fader.FadeIn(_soundOut, Volume); } } } catch (ObjectDisposedException) { //Nearly everywhere in this code block can an ObjectDisposedException get thrown. We can safely ignore that } }
void Pause() { if (soundOut.PlaybackState == PlaybackState.Playing) { soundOut.Pause(); timer_ctime.Enabled = false; btn_Play.Visible = true; btn_pause.Visible = false; } }
public bool Pause() { if (CurrentPlaybackState == PlaybackState.Playing) { _soundOut.Pause(); return(true); } return(false); }
public void Pause() { if (state != SOUNDSTATE.PAUSED && state != SOUNDSTATE.STOPPED && state != SOUNDSTATE.FORMING && soundOut != null) { soundOut.Pause(); state = SOUNDSTATE.PAUSED; } else if (state == SOUNDSTATE.PAUSED && state != SOUNDSTATE.STOPPED && state != SOUNDSTATE.FORMING && soundOut != null) { Play(); } }
public void TooglePlayPause() { if (_soundOut?.PlaybackState == PlaybackState.Playing) { _soundOut?.Pause(); } else { _soundOut?.Play(); } CurrentStateChanged(); }
private void button1_Click(object sender, EventArgs e) { if (soundOut.PlaybackState == PlaybackState.Paused || soundOut.PlaybackState == PlaybackState.Stopped) { Play.Text = "Pause"; soundOut.Play(); } else { Play.Text = "Play"; soundOut.Pause(); } }
public void ThrowsInvalidCallerThread() { Exception exception = null; using (var source = new NotificationSource(GetLoopingWaveSource().ToSampleSource())) { using (var waitHandle = new ManualResetEvent(false)) { _soundOut.Initialize(source.ToWaveSource()); //the play method sometimes won't cause an InvalidOperationException //for example the waveout class will read from the source which fires up the BlockRead event BUT not on the playbackthread. _soundOut.Play(); source.BlockRead += (s, e) => { try { _soundOut.Pause(); //hopefully throws InvalidOperationException } catch (InvalidOperationException ex) { exception = ex; } finally { // ReSharper disable once AccessToDisposedClosure waitHandle.Set(); } }; waitHandle.WaitOne(); _soundOut.Stop(); } } if (exception != null) { throw exception; } }
private void mainWindow_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Space) { if (waveOut.PlaybackState != PlaybackState.Playing) { waveOut.Play(); } else { waveOut.Pause(); } } }
public void Pause() { var resourceItem = Items[SelectedIndex]; if (PlaybackState == PlaybackState.Playing) { _soundOut.Pause(); PlayPaused(resourceItem); } else if (PlaybackState == PlaybackState.Paused) { _soundOut.Play(); PlayContinue(resourceItem); } }
private void CanHandleEOFTestInternal(ISoundOut soundOut, IWaveSource source) { int sourceLength = (int)source.GetLength().TotalMilliseconds; Debug.WriteLine(soundOut.GetType().FullName); for (int i = 0; i < BasicIterationCount; i++) { soundOut.Initialize(source); soundOut.Play(); Thread.Sleep(sourceLength + 500); Assert.AreEqual(source.Length, source.Position, "Source is not EOF"); soundOut.Stop(); source.Position = 0; soundOut.Initialize(source); soundOut.Play(); Thread.Sleep(sourceLength + 500); Assert.AreEqual(source.Length, source.Position, "Source is not EOF"); soundOut.Pause(); soundOut.Resume(); Thread.Sleep(10); soundOut.Stop(); source.Position = 0; soundOut.Initialize(source); soundOut.Play(); Thread.Sleep(sourceLength + 1000); Assert.AreEqual(source.Length, source.Position, "Source is not EOF"); Assert.AreEqual(PlaybackState.Stopped, soundOut.PlaybackState); source.Position = 0; soundOut.Play(); Thread.Sleep(sourceLength + 500); Assert.AreEqual(source.Length, source.Position, "Source is not EOF"); } }
private void CanHandleEOFTestInternal(ISoundOut soundOut, IWaveSource source) { int sourceLength = (int)source.GetLength().TotalMilliseconds; for (int i = 0; i < basic_iteration_count; i++) { soundOut.Initialize(source); soundOut.Play(); Thread.Sleep(sourceLength + 500); Assert.AreEqual(source.Length, source.Position, "Source is not EOF"); soundOut.Stop(); source.Position = 0; soundOut.Initialize(source); soundOut.Play(); Thread.Sleep(sourceLength + 500); Assert.AreEqual(source.Length, source.Position, "Source is not EOF"); soundOut.Pause(); soundOut.Resume(); Thread.Sleep(10); soundOut.Stop(); source.Position = 0; soundOut.Initialize(source); soundOut.Play(); Thread.Sleep(sourceLength + 500); Assert.AreEqual(source.Length, source.Position, "Source is not EOF"); source.Position = 0; soundOut.Play(); Thread.Sleep(sourceLength + 500); Assert.AreEqual(source.Length, source.Position, "Source is not EOF"); } }
//*********************************************************************************************************************************************************************************************************** /// <summary> /// Pause a record /// </summary> public void PauseRecord() { try { if (RecordState == RecordStates.RECORDING) { _silenceOut.Pause(); RecordState = RecordStates.PAUSED; _logHandle.Report(new LogEventInfo("Record (\"" + TrackInfo?.TrackName + "\") paused.")); WasRecordPaused = true; double recordLength_s = (_wavWriterPositionBytes / _wavWriterFormat.BytesPerSecond); _recordPauseTimes_s.Add(recordLength_s); } } catch (Exception ex) { _logHandle.Report(new LogEventError("Error while pausing record: " + ex.Message)); } }
private void PlayPauseResumeBehaviourTestInternal(ISoundOut soundOut, IWaveSource source) { for (int i = 0; i < BasicIterationCount; i++) { soundOut.Initialize(source); //-- Assert.AreEqual(PlaybackState.Stopped, soundOut.PlaybackState); soundOut.Play(); Assert.AreEqual(PlaybackState.Playing, soundOut.PlaybackState); Thread.Sleep(50); soundOut.Play(); Assert.AreEqual(PlaybackState.Playing, soundOut.PlaybackState); soundOut.Pause(); Assert.AreEqual(PlaybackState.Paused, soundOut.PlaybackState); soundOut.Pause(); Assert.AreEqual(PlaybackState.Paused, soundOut.PlaybackState); soundOut.Play(); Assert.AreEqual(PlaybackState.Playing, soundOut.PlaybackState); soundOut.Pause(); Assert.AreEqual(PlaybackState.Paused, soundOut.PlaybackState); soundOut.Resume(); Assert.AreEqual(PlaybackState.Playing, soundOut.PlaybackState); //-- Thread.Sleep(250); //-- soundOut.Play(); Assert.AreEqual(PlaybackState.Playing, soundOut.PlaybackState); Thread.Sleep(50); soundOut.Play(); Assert.AreEqual(PlaybackState.Playing, soundOut.PlaybackState); soundOut.Pause(); Assert.AreEqual(PlaybackState.Paused, soundOut.PlaybackState); soundOut.Pause(); Assert.AreEqual(PlaybackState.Paused, soundOut.PlaybackState); soundOut.Play(); Assert.AreEqual(PlaybackState.Playing, soundOut.PlaybackState); soundOut.Pause(); Assert.AreEqual(PlaybackState.Paused, soundOut.PlaybackState); soundOut.Resume(); Assert.AreEqual(PlaybackState.Playing, soundOut.PlaybackState); //-- soundOut.Stop(); Assert.AreEqual(PlaybackState.Stopped, soundOut.PlaybackState); soundOut.Play(); Assert.AreEqual(PlaybackState.Playing, soundOut.PlaybackState); Thread.Sleep(10); soundOut.Stop(); Assert.AreEqual(PlaybackState.Stopped, soundOut.PlaybackState); soundOut.Play(); Assert.AreEqual(PlaybackState.Playing, soundOut.PlaybackState); soundOut.Pause(); Assert.AreEqual(PlaybackState.Paused, soundOut.PlaybackState); Thread.Sleep(50); //-- soundOut.Stop(); Assert.AreEqual(PlaybackState.Stopped, soundOut.PlaybackState); source.Position = 0; } }