Search Results for

    Show / Hide Table of Contents

    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
    object
    PlaybackUtilities
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Melanchall.DryWetMidi.Multimedia
    Assembly: Melanchall.DryWetMidi.dll
    Syntax
    public static class PlaybackUtilities

    Methods

    GetPlayback(Pattern, TempoMap, FourBitNumber, IOutputDevice, PlaybackSettings)

    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.

    GetPlayback(Pattern, TempoMap, FourBitNumber, PlaybackSettings)

    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.

    GetPlayback(MidiFile, IOutputDevice, PlaybackSettings)

    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.

    GetPlayback(MidiFile, PlaybackSettings)

    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
    Type Condition
    ArgumentNullException midiFile is null.

    GetPlayback(TrackChunk, TempoMap, IOutputDevice, PlaybackSettings)

    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.

    GetPlayback(TrackChunk, TempoMap, PlaybackSettings)

    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.

    GetPlayback(IEnumerable<MidiEvent>, TempoMap, IOutputDevice, PlaybackSettings)

    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
    Type Description
    Playback An instance of the Playback for playing events.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • events is null.
    • tempoMap is null.
    • outputDevice is null.

    GetPlayback(IEnumerable<MidiEvent>, TempoMap, PlaybackSettings)

    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
    Type Description
    Playback An instance of the Playback for playing events.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • events is null.
    • tempoMap is null.

    GetPlayback(IEnumerable<TrackChunk>, TempoMap, IOutputDevice, PlaybackSettings)

    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
    Type Name Description
    IEnumerable<TrackChunk> trackChunks Collection of 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 trackChunks.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • trackChunks is null.
    • tempoMap is null.
    • outputDevice is null.

    GetPlayback(IEnumerable<TrackChunk>, TempoMap, PlaybackSettings)

    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
    Type Name Description
    IEnumerable<TrackChunk> trackChunks Collection of 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 trackChunks.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • trackChunks is null.
    • tempoMap is null.

    GetPlayback<TObject>(IEnumerable<TObject>, TempoMap, IOutputDevice, SevenBitNumber, PlaybackSettings)

    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 Description
    Playback An instance of the Playback for playing objects.
    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.

    GetPlayback<TObject>(IEnumerable<TObject>, TempoMap, IOutputDevice, GeneralMidi2Program, PlaybackSettings)

    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 Description
    Playback An instance of the Playback for playing objects.
    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.
    InvalidEnumArgumentException generalMidi2Program specified an invalid value.

    GetPlayback<TObject>(IEnumerable<TObject>, TempoMap, IOutputDevice, GeneralMidiProgram, PlaybackSettings)

    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 Description
    Playback An instance of the Playback for playing objects.
    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.
    InvalidEnumArgumentException generalMidiProgram specified an invalid value.

    Play(Pattern, TempoMap, FourBitNumber, IOutputDevice, PlaybackSettings)

    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.

    Play(MidiFile, IOutputDevice, PlaybackSettings)

    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.

    Play(TrackChunk, TempoMap, IOutputDevice, PlaybackSettings)

    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.

    Play(IEnumerable<TrackChunk>, TempoMap, IOutputDevice, PlaybackSettings)

    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
    Type Name Description
    IEnumerable<TrackChunk> trackChunks Collection of 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:

    • trackChunks is null.
    • tempoMap is null.
    • outputDevice is null.

    Play<TObject>(IEnumerable<TObject>, TempoMap, IOutputDevice, SevenBitNumber, PlaybackSettings)

    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.

    Play<TObject>(IEnumerable<TObject>, TempoMap, IOutputDevice, GeneralMidi2Program, PlaybackSettings)

    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
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • objects is null.
    • tempoMap is null.
    • outputDevice is null.
    InvalidEnumArgumentException generalMidi2Program specified an invalid value.

    Play<TObject>(IEnumerable<TObject>, TempoMap, IOutputDevice, GeneralMidiProgram, PlaybackSettings)

    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
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • objects is null.
    • tempoMap is null.
    • outputDevice is null.
    InvalidEnumArgumentException generalMidiProgram specified an invalid value.
    In this article
    Back to top 2024 / Generated by DocFX