Class Recording
Provides a way to record MIDI data received by an input MIDI device. More info in the
Recording article.
Implements
Inherited Members
Namespace: Melanchall.DryWetMidi.Multimedia
Assembly: Melanchall.DryWetMidi.dll
Syntax
public sealed class Recording : IDisposable
Constructors
Recording(TempoMap, IInputDevice)
Initializes a new instance of the Recording with the specified
tempo map and input MIDI device to capture MIDI data from.
Declaration
public Recording(TempoMap tempoMap, IInputDevice inputDevice)
Parameters
| Type | Name | Description |
|---|---|---|
| TempoMap | tempoMap | Tempo map used to calculate events times. |
| IInputDevice | inputDevice | Input MIDI device to capture MIDI data from. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | One of the following errors occurred:
|
Properties
InputDevice
Gets the input MIDI device to record MIDI data from.
Declaration
public IInputDevice InputDevice { get; }
Property Value
| Type | Description |
|---|---|
| IInputDevice |
IsRunning
Gets a value indicating whether recording is currently running or not.
Declaration
public bool IsRunning { get; }
Property Value
| Type | Description |
|---|---|
| bool |
TempoMap
Gets the tempo map used to calculate recorded events times.
Declaration
public TempoMap TempoMap { get; }
Property Value
| Type | Description |
|---|---|
| TempoMap |
Methods
Dispose()
Releases all resources used by the current Recording.
Declaration
public void Dispose()
GetDuration(TimeSpanType)
Retrieves the duration of the recording in the specified format.
Declaration
public ITimeSpan GetDuration(TimeSpanType durationType)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpanType | durationType | Type that will represent the duration. |
Returns
| Type | Description |
|---|---|
| ITimeSpan | The duration of the recording as an instance of time span defined by
durationType. |
Exceptions
| Type | Condition |
|---|---|
| InvalidEnumArgumentException | durationType
specified an invalid value. |
GetDuration<TTimeSpan>()
Retrieves the duration of the recording in the specified format.
Declaration
public TTimeSpan GetDuration<TTimeSpan>() where TTimeSpan : ITimeSpan
Returns
| Type | Description |
|---|---|
| TTimeSpan | The duration of the recording as an instance of
TTimeSpan. |
Type Parameters
| Name | Description |
|---|---|
| TTimeSpan | Type that will represent the duration. |
GetEvents()
Gets MIDI events recorded by the current Recording.
Declaration
public ICollection<TimedEvent> GetEvents()
Returns
| Type | Description |
|---|---|
| ICollection<TimedEvent> | MIDI events recorded by the current Recording. |
Start()
Starts MIDI data recording.
Declaration
public void Start()
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Input device is not listening for MIDI events. |
Stop()
Stops MIDI data recording. Note that this method doesn't reset the recording time. If you
call Start(), recording will be resumed from the point where Stop() was called.
Declaration
public void Stop()
Events
EventRecorded
Occurs when a MIDI event is captured by the current recording.
Declaration
public event EventHandler<MidiEventRecordedEventArgs> EventRecorded
Event Type
| Type | Description |
|---|---|
| EventHandler<MidiEventRecordedEventArgs> |
Started
Occurs when recording started via Start() method.
Declaration
public event EventHandler Started
Event Type
| Type | Description |
|---|---|
| EventHandler |
Stopped
Occurs when recording stopped via Stop() method.
Declaration
public event EventHandler Stopped
Event Type
| Type | Description |
|---|---|
| EventHandler |