Class PlaybackUtilities
Contains methods to play MIDI data and retrieving an instance of the
Playback
which provides advanced features for MIDI data playing. More info in the
Playback article.
Inheritance
PlaybackUtilities
Assembly: Melanchall.DryWetMidi.dll
public static class PlaybackUtilities
Methods
Retrieves an instance of the
Playback for playing MIDI events that will be
produced by specified
Pattern.
Declaration
public static Playback GetPlayback(this Pattern pattern, TempoMap tempoMap, FourBitNumber channel, IOutputDevice outputDevice, PlaybackSettings playbackSettings = null)
Parameters
Type |
Name |
Description |
Pattern |
pattern |
Pattern producing events to play. |
TempoMap |
tempoMap |
Tempo map used to calculate events times. |
FourBitNumber |
channel |
MIDI channel to play channel events on. |
IOutputDevice |
outputDevice |
Output MIDI device to play events through. |
PlaybackSettings |
playbackSettings |
Settings according to which a playback should be created. |
Returns
Type |
Description |
Playback |
An instance of the Playback for playing MIDI events that will be
produced by the pattern . |
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
-
pattern is null . -
tempoMap is null . -
outputDevice is null .
|
Retrieves an instance of the
Playback for playing MIDI events that will be
produced by specified
Pattern.
Declaration
public static Playback GetPlayback(this Pattern pattern, TempoMap tempoMap, FourBitNumber channel, PlaybackSettings playbackSettings = null)
Parameters
Type |
Name |
Description |
Pattern |
pattern |
Pattern producing events to play. |
TempoMap |
tempoMap |
Tempo map used to calculate events times. |
FourBitNumber |
channel |
MIDI channel to play channel events on. |
PlaybackSettings |
playbackSettings |
Settings according to which a playback should be created. |
Returns
Type |
Description |
Playback |
An instance of the Playback for playing MIDI events that will be
produced by the pattern . |
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
-
pattern is null . -
tempoMap is null .
|
Retrieves an instance of the
Playback for playing MIDI events contained in
the specified
MidiFile.
Declaration
public static Playback GetPlayback(this MidiFile midiFile, IOutputDevice outputDevice, PlaybackSettings playbackSettings = null)
Parameters
Type |
Name |
Description |
MidiFile |
midiFile |
MidiFile containing events to play. |
IOutputDevice |
outputDevice |
Output MIDI device to play events through. |
PlaybackSettings |
playbackSettings |
Settings according to which a playback should be created. |
Returns
Type |
Description |
Playback |
An instance of the Playback for playing MIDI events contained in
the midiFile . |
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
-
midiFile is null . -
outputDevice is null .
|
Retrieves an instance of the
Playback for playing MIDI events contained in
the specified
MidiFile.
Declaration
public static Playback GetPlayback(this MidiFile midiFile, PlaybackSettings playbackSettings = null)
Parameters
Type |
Name |
Description |
MidiFile |
midiFile |
MidiFile containing events to play. |
PlaybackSettings |
playbackSettings |
Settings according to which a playback should be created. |
Returns
Type |
Description |
Playback |
An instance of the Playback for playing MIDI events contained in
the midiFile . |
Exceptions
Retrieves an instance of the
Playback for playing MIDI events contained in
the specified
TrackChunk.
Declaration
public static Playback GetPlayback(this TrackChunk trackChunk, TempoMap tempoMap, IOutputDevice outputDevice, PlaybackSettings playbackSettings = null)
Parameters
Type |
Name |
Description |
TrackChunk |
trackChunk |
TrackChunk containing events to play. |
TempoMap |
tempoMap |
Tempo map used to calculate events times. |
IOutputDevice |
outputDevice |
Output MIDI device to play events through. |
PlaybackSettings |
playbackSettings |
Settings according to which a playback should be created. |
Returns
Type |
Description |
Playback |
An instance of the Playback for playing MIDI events contained in
the trackChunk . |
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
-
trackChunk is null . -
tempoMap is null . -
outputDevice is null .
|
Retrieves an instance of the
Playback for playing MIDI events contained in
the specified
TrackChunk.
Declaration
public static Playback GetPlayback(this TrackChunk trackChunk, TempoMap tempoMap, PlaybackSettings playbackSettings = null)
Parameters
Type |
Name |
Description |
TrackChunk |
trackChunk |
TrackChunk containing events to play. |
TempoMap |
tempoMap |
Tempo map used to calculate events times. |
PlaybackSettings |
playbackSettings |
Settings according to which a playback should be created. |
Returns
Type |
Description |
Playback |
An instance of the Playback for playing MIDI events contained in
the trackChunk . |
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
-
trackChunk is null . -
tempoMap is null .
|
Retrieves an instance of the
Playback for playing MIDI events collection.
Events will be scheduled for playback according to their delta-times.
Declaration
public static Playback GetPlayback(this IEnumerable<MidiEvent> events, TempoMap tempoMap, IOutputDevice outputDevice, PlaybackSettings playbackSettings = null)
Parameters
Type |
Name |
Description |
IEnumerable<MidiEvent> |
events |
MIDI events to play. |
TempoMap |
tempoMap |
Tempo map used to calculate events times. |
IOutputDevice |
outputDevice |
Output MIDI device to play events through. |
PlaybackSettings |
playbackSettings |
Settings according to which a playback should be created. |
Returns
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
-
events is null . -
tempoMap is null . -
outputDevice is null .
|
Retrieves an instance of the
Playback for playing MIDI events collection.
Events will be scheduled for playback according to their delta-times.
Declaration
public static Playback GetPlayback(this IEnumerable<MidiEvent> events, TempoMap tempoMap, PlaybackSettings playbackSettings = null)
Parameters
Type |
Name |
Description |
IEnumerable<MidiEvent> |
events |
MIDI events to play. |
TempoMap |
tempoMap |
Tempo map used to calculate events times. |
PlaybackSettings |
playbackSettings |
Settings according to which a playback should be created. |
Returns
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
-
events is null . -
tempoMap is null .
|
Retrieves an instance of the
Playback for playing MIDI events contained in
the specified collection of
TrackChunk.
Declaration
public static Playback GetPlayback(this IEnumerable<TrackChunk> trackChunks, TempoMap tempoMap, IOutputDevice outputDevice, PlaybackSettings playbackSettings = null)
Parameters
Returns
Type |
Description |
Playback |
An instance of the Playback for playing MIDI events contained in
the trackChunks . |
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
-
trackChunks is null . -
tempoMap is null . -
outputDevice is null .
|
Retrieves an instance of the
Playback for playing MIDI events contained in
the specified collection of
TrackChunk.
Declaration
public static Playback GetPlayback(this IEnumerable<TrackChunk> trackChunks, TempoMap tempoMap, PlaybackSettings playbackSettings = null)
Parameters
Returns
Type |
Description |
Playback |
An instance of the Playback for playing MIDI events contained in
the trackChunks . |
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
-
trackChunks is null . -
tempoMap is null .
|
Retrieves an instance of the
Playback for playing musical objects using
the specified program.
Declaration
public static Playback GetPlayback<TObject>(this IEnumerable<TObject> objects, TempoMap tempoMap, IOutputDevice outputDevice, SevenBitNumber programNumber, PlaybackSettings playbackSettings = null) where TObject : IMusicalObject, ITimedObject
Parameters
Type |
Name |
Description |
IEnumerable<TObject> |
objects |
Objects to play. |
TempoMap |
tempoMap |
Tempo map used to calculate events times. |
IOutputDevice |
outputDevice |
Output MIDI device to play objects through. |
SevenBitNumber |
programNumber |
Program that should be used to play objects . |
PlaybackSettings |
playbackSettings |
Settings according to which a playback should be created. |
Returns
Type Parameters
Name |
Description |
TObject |
The type of objects to play. |
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
-
objects is null . -
tempoMap is null . -
outputDevice is null .
|
Retrieves an instance of the
Playback for playing musical objects using
the specified General MIDI 2 program.
Declaration
public static Playback GetPlayback<TObject>(this IEnumerable<TObject> objects, TempoMap tempoMap, IOutputDevice outputDevice, GeneralMidi2Program generalMidi2Program, PlaybackSettings playbackSettings = null) where TObject : IMusicalObject, ITimedObject
Parameters
Type |
Name |
Description |
IEnumerable<TObject> |
objects |
Objects to play. |
TempoMap |
tempoMap |
Tempo map used to calculate events times. |
IOutputDevice |
outputDevice |
Output MIDI device to play objects through. |
GeneralMidi2Program |
generalMidi2Program |
Program that should be used to play objects . |
PlaybackSettings |
playbackSettings |
Settings according to which a playback should be created. |
Returns
Type Parameters
Name |
Description |
TObject |
The type of objects to play. |
Exceptions
Retrieves an instance of the
Playback for playing musical objects using
the specified General MIDI 1 program.
Declaration
public static Playback GetPlayback<TObject>(this IEnumerable<TObject> objects, TempoMap tempoMap, IOutputDevice outputDevice, GeneralMidiProgram generalMidiProgram, PlaybackSettings playbackSettings = null) where TObject : IMusicalObject, ITimedObject
Parameters
Type |
Name |
Description |
IEnumerable<TObject> |
objects |
Objects to play. |
TempoMap |
tempoMap |
Tempo map used to calculate events times. |
IOutputDevice |
outputDevice |
Output MIDI device to play objects through. |
GeneralMidiProgram |
generalMidiProgram |
Program that should be used to play objects . |
PlaybackSettings |
playbackSettings |
Settings according to which a playback should be created. |
Returns
Type Parameters
Name |
Description |
TObject |
The type of objects to play. |
Exceptions
Plays MIDI events that will be produced by specified
Pattern.
Declaration
public static void Play(this Pattern pattern, TempoMap tempoMap, FourBitNumber channel, IOutputDevice outputDevice, PlaybackSettings playbackSettings = null)
Parameters
Type |
Name |
Description |
Pattern |
pattern |
Pattern producing events to play. |
TempoMap |
tempoMap |
Tempo map used to calculate events times. |
FourBitNumber |
channel |
MIDI channel to play channel events on. |
IOutputDevice |
outputDevice |
Output MIDI device to play events through. |
PlaybackSettings |
playbackSettings |
Settings according to which a playback should be created. |
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
-
pattern is null . -
tempoMap is null . -
outputDevice is null .
|
Plays MIDI events contained in the specified
MidiFile.
Declaration
public static void Play(this MidiFile midiFile, IOutputDevice outputDevice, PlaybackSettings playbackSettings = null)
Parameters
Type |
Name |
Description |
MidiFile |
midiFile |
MidiFile containing events to play. |
IOutputDevice |
outputDevice |
Output MIDI device to play events through. |
PlaybackSettings |
playbackSettings |
Settings according to which a playback should be created. |
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
-
midiFile is null . -
outputDevice is null .
|
Plays MIDI events contained in the specified
TrackChunk.
Declaration
public static void Play(this TrackChunk trackChunk, TempoMap tempoMap, IOutputDevice outputDevice, PlaybackSettings playbackSettings = null)
Parameters
Type |
Name |
Description |
TrackChunk |
trackChunk |
TrackChunk containing events to play. |
TempoMap |
tempoMap |
Tempo map used to calculate events times. |
IOutputDevice |
outputDevice |
Output MIDI device to play events through. |
PlaybackSettings |
playbackSettings |
Settings according to which a playback should be created. |
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
-
trackChunk is null . -
tempoMap is null . -
outputDevice is null .
|
Plays MIDI events contained in the specified collection of
TrackChunk.
Declaration
public static void Play(this IEnumerable<TrackChunk> trackChunks, TempoMap tempoMap, IOutputDevice outputDevice, PlaybackSettings playbackSettings = null)
Parameters
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
-
trackChunks is null . -
tempoMap is null . -
outputDevice is null .
|
Plays musical objects using the specified program.
Declaration
public static void Play<TObject>(this IEnumerable<TObject> objects, TempoMap tempoMap, IOutputDevice outputDevice, SevenBitNumber programNumber, PlaybackSettings playbackSettings = null) where TObject : IMusicalObject, ITimedObject
Parameters
Type |
Name |
Description |
IEnumerable<TObject> |
objects |
Objects to play. |
TempoMap |
tempoMap |
Tempo map used to calculate events times. |
IOutputDevice |
outputDevice |
Output MIDI device to play objects through. |
SevenBitNumber |
programNumber |
Program that should be used to play objects . |
PlaybackSettings |
playbackSettings |
Settings according to which a playback should be created. |
Type Parameters
Name |
Description |
TObject |
The type of objects to play. |
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
-
objects is null . -
tempoMap is null . -
outputDevice is null .
|
Plays musical objects using the specified General MIDI 2 program.
Declaration
public static void Play<TObject>(this IEnumerable<TObject> objects, TempoMap tempoMap, IOutputDevice outputDevice, GeneralMidi2Program generalMidi2Program, PlaybackSettings playbackSettings = null) where TObject : IMusicalObject, ITimedObject
Parameters
Type |
Name |
Description |
IEnumerable<TObject> |
objects |
Objects to play. |
TempoMap |
tempoMap |
Tempo map used to calculate events times. |
IOutputDevice |
outputDevice |
Output MIDI device to play objects through. |
GeneralMidi2Program |
generalMidi2Program |
Program that should be used to play objects . |
PlaybackSettings |
playbackSettings |
Settings according to which a playback should be created. |
Type Parameters
Name |
Description |
TObject |
The type of objects to play. |
Exceptions
Plays musical objects using the specified General MIDI 1 program.
Declaration
public static void Play<TObject>(this IEnumerable<TObject> objects, TempoMap tempoMap, IOutputDevice outputDevice, GeneralMidiProgram generalMidiProgram, PlaybackSettings playbackSettings = null) where TObject : IMusicalObject, ITimedObject
Parameters
Type |
Name |
Description |
IEnumerable<TObject> |
objects |
Objects to play. |
TempoMap |
tempoMap |
Tempo map used to calculate events times. |
IOutputDevice |
outputDevice |
Output MIDI device to play objects through. |
GeneralMidiProgram |
generalMidiProgram |
Program that should be used to play objects . |
PlaybackSettings |
playbackSettings |
Settings according to which a playback should be created. |
Type Parameters
Name |
Description |
TObject |
The type of objects to play. |
Exceptions