Search Results for

    Show / Hide Table of Contents

    Class TrackChunk

    Represents a track chunk of a standard MIDI file.
    Inheritance
    object
    MidiChunk
    TrackChunk
    Inherited Members
    MidiChunk.IdLength
    MidiChunk.ChunkId
    MidiChunk.GetStandardChunkIds()
    MidiChunk.Equals(MidiChunk, MidiChunk)
    MidiChunk.Equals(MidiChunk, MidiChunk, out string)
    MidiChunk.Equals(MidiChunk, MidiChunk, MidiChunkEqualityCheckSettings)
    MidiChunk.Equals(MidiChunk, MidiChunk, MidiChunkEqualityCheckSettings, out string)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Melanchall.DryWetMidi.Core
    Assembly: Melanchall.DryWetMidi.dll
    Syntax
    public sealed class TrackChunk : MidiChunk
    Remarks

    See https://midi.org/standard-midi-files-specification for detailed MIDI file specification.

    Constructors

    TrackChunk()

    Initializes a new instance of the TrackChunk.
    Declaration
    public TrackChunk()

    TrackChunk(params MidiEvent[])

    Initializes a new instance of the TrackChunk with the specified events.
    Declaration
    public TrackChunk(params MidiEvent[] events)
    Parameters
    Type Name Description
    MidiEvent[] events Events to add to the track chunk.
    Remarks
    Note that End Of Track events cannot be added into the collection since it may cause inconsistency in a track chunk structure. End Of Track event will be written to the track chunk automatically on Write(string, bool, MidiFileFormat, WritingSettings).
    Exceptions
    Type Condition
    ArgumentNullException events is null.
    ArgumentException events contain an instance of EndOfTrackEvent; or events contain null.

    TrackChunk(IEnumerable<MidiEvent>)

    Initializes a new instance of the TrackChunk with the specified events.
    Declaration
    public TrackChunk(IEnumerable<MidiEvent> events)
    Parameters
    Type Name Description
    IEnumerable<MidiEvent> events Events to add to the track chunk.
    Remarks
    Note that End Of Track events cannot be added into the collection since it may cause inconsistency in a track chunk structure. End Of Track event will be written to the track chunk automatically on Write(string, bool, MidiFileFormat, WritingSettings).
    Exceptions
    Type Condition
    ArgumentNullException events is null.

    Fields

    Id

    ID of the track chunk. This field is constant.
    Declaration
    public const string Id = "MTrk"
    Field Value
    Type Description
    string

    Properties

    Events

    Gets the collection of events contained in the track chunk.
    Declaration
    public EventsCollection Events { get; }
    Property Value
    Type Description
    EventsCollection

    Methods

    Clone()

    Clones chunk by creating a copy of it.
    Declaration
    public override MidiChunk Clone()
    Returns
    Type Description
    MidiChunk Copy of the chunk.
    Overrides
    MidiChunk.Clone()

    GetContentSize(WritingSettings)

    Gets size of TrackChunk's content as number of bytes required to write it according to specified WritingSettings.
    Declaration
    protected override uint GetContentSize(WritingSettings settings)
    Parameters
    Type Name Description
    WritingSettings settings Settings according to which the chunk's content will be written.
    Returns
    Type Description
    uint Number of bytes required to write TrackChunk's content.
    Overrides
    MidiChunk.GetContentSize(WritingSettings)

    ReadContent(MidiReader, ReadingSettings, uint)

    Reads content of a TrackChunk.
    Declaration
    protected override void ReadContent(MidiReader reader, ReadingSettings settings, uint size)
    Parameters
    Type Name Description
    MidiReader reader Reader to read the chunk's content with.
    ReadingSettings settings Settings according to which the chunk's content must be read.
    uint size Expected size of the content taken from the chunk's header.
    Overrides
    MidiChunk.ReadContent(MidiReader, ReadingSettings, uint)
    Remarks
    Content of a TrackChunk is collection of MIDI events.
    Exceptions
    Type Condition
    ObjectDisposedException Method was called after the writer's underlying stream was disposed.
    IOException An I/O error occurred on the writer's underlying stream.
    UnexpectedRunningStatusException Unexpected running status is encountered.
    UnknownChannelEventException Reader has encountered an unknown channel event.
    NotEnoughBytesException Not enough bytes to read an event.
    InvalidChannelEventParameterValueException Value of a channel event's parameter just read is invalid.
    MissedEndOfTrackEventException Track chunk doesn't end with End Of Track event.

    ToString()

    Returns a string that represents the current object.
    Declaration
    public override string ToString()
    Returns
    Type Description
    string A string that represents the current object.
    Overrides
    object.ToString()

    WriteContent(MidiWriter, WritingSettings)

    Writes content of a TrackChunk.
    Declaration
    protected override void WriteContent(MidiWriter writer, WritingSettings settings)
    Parameters
    Type Name Description
    MidiWriter writer Writer to write the chunk's content with.
    WritingSettings settings Settings according to which the chunk's content must be written.
    Overrides
    MidiChunk.WriteContent(MidiWriter, WritingSettings)
    Remarks
    Content of a TrackChunk is collection of MIDI events.
    Exceptions
    Type Condition
    ObjectDisposedException Method was called after the writer's underlying stream was disposed.
    IOException An I/O error occurred on the writer's underlying stream.

    Extension Methods

    CsvSerializer.SerializeToCsv(MidiChunk, Stream, TempoMap, CsvSerializationSettings, ObjectType, ObjectDetectionSettings)
    CsvSerializer.SerializeToCsv(MidiChunk, string, bool, TempoMap, CsvSerializationSettings, ObjectType, ObjectDetectionSettings)
    TrackChunkUtilities.Explode(TrackChunk)
    TrackChunkUtilities.GetChannels(TrackChunk)
    ChordsManagingUtilities.GetChords(TrackChunk, ChordDetectionSettings, NoteDetectionSettings, TimedEventDetectionSettings)
    ChordsManagingUtilities.ManageChords(TrackChunk, ChordDetectionSettings, NoteDetectionSettings, TimedEventDetectionSettings, TimedObjectsComparer)
    ChordsManagingUtilities.ProcessChords(TrackChunk, Action<Chord>, ChordDetectionSettings, NoteDetectionSettings, TimedEventDetectionSettings, ChordProcessingHint)
    ChordsManagingUtilities.ProcessChords(TrackChunk, Action<Chord>, Predicate<Chord>, ChordDetectionSettings, NoteDetectionSettings, TimedEventDetectionSettings, ChordProcessingHint)
    ChordsManagingUtilities.RemoveChords(TrackChunk, ChordDetectionSettings, NoteDetectionSettings, TimedEventDetectionSettings)
    ChordsManagingUtilities.RemoveChords(TrackChunk, Predicate<Chord>, ChordDetectionSettings, NoteDetectionSettings, TimedEventDetectionSettings)
    GetObjectsUtilities.GetObjects(TrackChunk, ObjectType, ObjectDetectionSettings)
    MidiFileUtilities.GetDuration(TrackChunk, TimeSpanType, TempoMap)
    MidiFileUtilities.GetDuration<TTimeSpan>(TrackChunk, TempoMap)
    NotesManagingUtilities.GetNotes(TrackChunk, NoteDetectionSettings, TimedEventDetectionSettings)
    NotesManagingUtilities.ManageNotes(TrackChunk, NoteDetectionSettings, TimedEventDetectionSettings, TimedObjectsComparer)
    NotesManagingUtilities.ProcessNotes(TrackChunk, Action<Note>, NoteDetectionSettings, TimedEventDetectionSettings, NoteProcessingHint)
    NotesManagingUtilities.ProcessNotes(TrackChunk, Action<Note>, Predicate<Note>, NoteDetectionSettings, TimedEventDetectionSettings, NoteProcessingHint)
    NotesManagingUtilities.RemoveNotes(TrackChunk, NoteDetectionSettings, TimedEventDetectionSettings)
    NotesManagingUtilities.RemoveNotes(TrackChunk, Predicate<Note>, NoteDetectionSettings, TimedEventDetectionSettings)
    TimedEventsManagingUtilities.GetTimedEvents(TrackChunk, TimedEventDetectionSettings)
    TimedEventsManagingUtilities.ManageTimedEvents(TrackChunk, TimedEventDetectionSettings, TimedObjectsComparer)
    TimedEventsManagingUtilities.ProcessTimedEvents(TrackChunk, Action<TimedEvent>, TimedEventDetectionSettings, TimedEventProcessingHint)
    TimedEventsManagingUtilities.ProcessTimedEvents(TrackChunk, Action<TimedEvent>, Predicate<TimedEvent>, TimedEventDetectionSettings, TimedEventProcessingHint)
    TimedEventsManagingUtilities.RemoveTimedEvents(TrackChunk)
    TimedEventsManagingUtilities.RemoveTimedEvents(TrackChunk, Predicate<TimedEvent>, TimedEventDetectionSettings)
    TimedObjectUtilities.AddObjects(TrackChunk, IEnumerable<ITimedObject>)
    TimedObjectUtilities.ProcessObjects(TrackChunk, ObjectType, Action<ITimedObject>, ObjectDetectionSettings, ObjectProcessingHint)
    TimedObjectUtilities.ProcessObjects(TrackChunk, ObjectType, Action<ITimedObject>, Predicate<ITimedObject>, ObjectDetectionSettings, ObjectProcessingHint)
    TimedObjectUtilities.RemoveObjects(TrackChunk, ObjectType, ObjectDetectionSettings)
    TimedObjectUtilities.RemoveObjects(TrackChunk, ObjectType, Predicate<ITimedObject>, ObjectDetectionSettings)
    TrackChunkUtilities.ShiftEvents(TrackChunk, ITimeSpan, TempoMap)
    PlaybackUtilities.GetPlayback(TrackChunk, TempoMap, IOutputDevice, PlaybackSettings)
    PlaybackUtilities.GetPlayback(TrackChunk, TempoMap, PlaybackSettings)
    PlaybackUtilities.Play(TrackChunk, TempoMap, IOutputDevice, PlaybackSettings)
    Merger.MergeObjects(TrackChunk, ObjectType, TempoMap, ObjectsMergingSettings, ObjectDetectionSettings)
    QuantizerUtilities.QuantizeObjects(TrackChunk, ObjectType, IGrid, TempoMap, QuantizingSettings, ObjectDetectionSettings)
    QuantizerUtilities.QuantizeObjects(TrackChunk, Quantizer, ObjectType, IGrid, TempoMap, QuantizingSettings, ObjectDetectionSettings)
    RepeaterUtilities.Repeat(TrackChunk, int, TempoMap, RepeatingSettings)
    Resizer.Resize(TrackChunk, ITimeSpan, TempoMap)
    Resizer.Resize(TrackChunk, double)
    Splitter.SplitObjectsAtDistance(TrackChunk, ObjectType, ITimeSpan, LengthedObjectTarget, TempoMap, ObjectDetectionSettings, Predicate<ITimedObject>)
    Splitter.SplitObjectsAtDistance(TrackChunk, ObjectType, double, TimeSpanType, LengthedObjectTarget, TempoMap, ObjectDetectionSettings, Predicate<ITimedObject>)
    Splitter.SplitObjectsByGrid(TrackChunk, ObjectType, IGrid, TempoMap, ObjectDetectionSettings, Predicate<ITimedObject>)
    Splitter.SplitObjectsByPartsNumber(TrackChunk, ObjectType, int, TimeSpanType, TempoMap, ObjectDetectionSettings, Predicate<ITimedObject>)
    Splitter.SplitObjectsByStep(TrackChunk, ObjectType, ITimeSpan, TempoMap, ObjectDetectionSettings, Predicate<ITimedObject>)
    In this article
    Back to top 2024 / Generated by DocFX