Class PlaybackCurrentTimeWatcher
Provides notifications about playback's current time changed.
Inherited Members
Namespace: Melanchall.DryWetMidi.Multimedia
Assembly: Melanchall.DryWetMidi.dll
Syntax
public sealed class PlaybackCurrentTimeWatcher : IDisposable, IClockDrivenObject
Constructors
PlaybackCurrentTimeWatcher(PlaybackCurrentTimeWatcherSettings)
Initializes a new instance of the PlaybackCurrentTimeWatcher.
Declaration
public PlaybackCurrentTimeWatcher(PlaybackCurrentTimeWatcherSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
PlaybackCurrentTimeWatcherSettings | settings | Settings for playbacks watching. |
Properties
Instance
Gets the default instance of PlaybackCurrentTimeWatcher.
Declaration
public static PlaybackCurrentTimeWatcher Instance { get; }
Property Value
Type | Description |
---|---|
PlaybackCurrentTimeWatcher |
IsWatching
Gets a value indicating whether the watcher polls playbacks current times or not.
Declaration
public bool IsWatching { get; }
Property Value
Type | Description |
---|---|
bool |
Playbacks
Gets playbacks the watcher polls current time of.
Declaration
public IEnumerable<Playback> Playbacks { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Playback> |
PollingInterval
Gets or sets the interval of playbacks current times polling.
Declaration
public TimeSpan PollingInterval { get; set; }
Property Value
Type | Description |
---|---|
TimeSpan |
TimeType
Gets or sets the type of a playback's time to convert to in case of playback
was added in the watcher via AddPlayback(Playback) method (without
specifying desired time type). The default value is Midi.
Declaration
public TimeSpanType TimeType { get; set; }
Property Value
Type | Description |
---|---|
TimeSpanType |
Remarks
The current time of a playback will be converted to this time type only if the playback
was added in the watcher via AddPlayback(Playback) method. If
AddPlayback(Playback, TimeSpanType) method was used, its second parameter
overrides the global type defined by the TimeType property.
Exceptions
Type | Condition |
---|---|
InvalidEnumArgumentException | value specified an invalid value. |
Methods
AddPlayback(Playback)
Adds a playback to the list of ones to watch current times of. The time will be reported
in the type defined by TimeType property.
Declaration
public void AddPlayback(Playback playback)
Parameters
Type | Name | Description |
---|---|---|
Playback | playback | Playback to watch current time of. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | playback is null . |
ObjectDisposedException | The current PlaybackCurrentTimeWatcher is disposed. |
AddPlayback(Playback, TimeSpanType)
Adds a playback to the list of ones to watch current times of. The time will be reported
in the specified type.
Declaration
public void AddPlayback(Playback playback, TimeSpanType timeType)
Parameters
Type | Name | Description |
---|---|---|
Playback | playback | Playback to watch current time of. |
TimeSpanType | timeType | Type of current time to convert to. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | playback is null . |
InvalidEnumArgumentException | timeType specified an invalid value. |
ObjectDisposedException | The current PlaybackCurrentTimeWatcher is disposed. |
Dispose()
Releases all resources used by the current PlaybackCurrentTimeWatcher.
Declaration
public void Dispose()
RemoveAllPlaybacks()
Removes all playbacks from the list of ones to watch current times of.
Declaration
public void RemoveAllPlaybacks()
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The current PlaybackCurrentTimeWatcher is disposed. |
RemovePlayback(Playback)
Removes a playback from the list of ones to watch current times of.
Declaration
public void RemovePlayback(Playback playback)
Parameters
Type | Name | Description |
---|---|---|
Playback | playback | Playback to exclude current time watching of. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | playback is null . |
ObjectDisposedException | The current PlaybackCurrentTimeWatcher is disposed. |
SetPlaybackTimeType(Playback, TimeSpanType)
Sets the type the current time of the specified playback should be converted to.
Declaration
public void SetPlaybackTimeType(Playback playback, TimeSpanType timeType)
Parameters
Type | Name | Description |
---|---|---|
Playback | playback | Playback to set time type for. |
TimeSpanType | timeType | Type to convert current time of the playback to. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | playback is null . |
InvalidEnumArgumentException | timeType specified an invalid value. |
ObjectDisposedException | The current PlaybackCurrentTimeWatcher is disposed. |
ArgumentOutOfRangeException | playback is not added to the current watcher. |
Start()
Starts current times watching.
Declaration
public void Start()
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The current PlaybackCurrentTimeWatcher is disposed. |
Stop()
Stops current times watching.
Declaration
public void Stop()
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The current PlaybackCurrentTimeWatcher is disposed. |
TickClock()
Ticks internal clock.
Declaration
public void TickClock()
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The current PlaybackCurrentTimeWatcher is disposed. |
Events
CurrentTimeChanged
Occurs when current times of playbacks are changed.
Declaration
public event EventHandler<PlaybackCurrentTimeChangedEventArgs> CurrentTimeChanged
Event Type
Type | Description |
---|---|
EventHandler<PlaybackCurrentTimeChangedEventArgs> |