/// <summary> /// Sets playback position to the time of next snap point (relative to the current /// time of playback) holding the specified data. /// </summary> /// <returns><c>true</c> if playback position successfully changed to the time of a next snap point /// with the specified data; otherwise, <c>false</c>.</returns> /// <exception cref="ObjectDisposedException">The current <see cref="Playback"/> is disposed.</exception> /// <exception cref="MidiDeviceException">An error occurred on device.</exception> public bool MoveToNextSnapPoint <TData>(TData data) { EnsureIsNotDisposed(); var snapPoint = Snapping.GetNextSnapPoint(_clock.CurrentTime, data); return(TryToMoveToSnapPoint(snapPoint)); }
/// <summary> /// Sets playback position to the time of first snap point holding the specified data. /// </summary> /// <param name="data">Data of a snap point to move to.</param> /// <returns><c>true</c> if playback position successfully changed to the time of first snap point /// with the specified data; otherwise, <c>false</c>.</returns> /// <exception cref="ObjectDisposedException">The current <see cref="Playback"/> is disposed.</exception> /// <exception cref="MidiDeviceException">An error occurred on device.</exception> public bool MoveToFirstSnapPoint <TData>(TData data) { EnsureIsNotDisposed(); var snapPoint = Snapping.GetNextSnapPoint(TimeSpan.Zero, data); return(TryToMoveToSnapPoint(snapPoint)); }
/// <summary> /// Sets playback position to the time of next snap point (relative to the current /// time of playback) that belongs to the specified <see cref="SnapPointsGroup"/>. /// </summary> /// <param name="snapPointsGroup"><see cref="SnapPointsGroup"/> that defines snap points to /// select the one from.</param> /// <returns><c>true</c> if playback position successfully changed to the time of a next snap point /// within <paramref name="snapPointsGroup"/>; otherwise, <c>false</c>.</returns> /// <exception cref="ArgumentNullException"><paramref name="snapPointsGroup"/> is <c>null</c>.</exception> /// <exception cref="ObjectDisposedException">The current <see cref="Playback"/> is disposed.</exception> /// <exception cref="MidiDeviceException">An error occurred on device.</exception> public bool MoveToNextSnapPoint(SnapPointsGroup snapPointsGroup) { ThrowIfArgument.IsNull(nameof(snapPointsGroup), snapPointsGroup); EnsureIsNotDisposed(); var snapPoint = Snapping.GetNextSnapPoint(_clock.CurrentTime, snapPointsGroup); return(TryToMoveToSnapPoint(snapPoint)); }
/// <summary> /// Sets playback position to the time of the next snap point (relative to the current /// time of playback). /// </summary> /// <exception cref="ObjectDisposedException">The current <see cref="Playback"/> is disposed.</exception> /// <exception cref="MidiDeviceException">An error occurred on device.</exception> public void MoveToNextSnapPoint() { EnsureIsNotDisposed(); var snapPoint = Snapping.GetNextSnapPoint(_clock.CurrentTime); if (snapPoint != null) { MoveToTime((MetricTimeSpan)snapPoint.Time); } }
/// <summary> /// Sets playback position to the time of the next snap point (relative to the current /// time of playback) that belongs to the specified <see cref="SnapPointsGroup"/>. /// </summary> /// <param name="snapPointsGroup"><see cref="SnapPointsGroup"/> that defines snap points to /// select the one from.</param> /// <exception cref="ArgumentNullException"><paramref name="snapPointsGroup"/> is null.</exception> /// <exception cref="ObjectDisposedException">The current <see cref="Playback"/> is disposed.</exception> /// <exception cref="MidiDeviceException">An error occurred on device.</exception> public void MoveToNextSnapPoint(SnapPointsGroup snapPointsGroup) { ThrowIfArgument.IsNull(nameof(snapPointsGroup), snapPointsGroup); EnsureIsNotDisposed(); var snapPoint = Snapping.GetNextSnapPoint(_clock.CurrentTime, snapPointsGroup); if (snapPoint != null) { MoveToTime((MetricTimeSpan)snapPoint.Time); } }