Search Results for

    Show / Hide Table of Contents

    Class MidiEventToBytesConverter

    Provides methods to convert an instance of the MidiEvent to bytes.
    Inheritance
    object
    MidiEventToBytesConverter
    Implements
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Melanchall.DryWetMidi.Core
    Assembly: Melanchall.DryWetMidi.dll
    Syntax
    public sealed class MidiEventToBytesConverter : IDisposable

    Constructors

    MidiEventToBytesConverter()

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

    MidiEventToBytesConverter(int)

    Initializes a new instance of the MidiEventToBytesConverter with the specified initial capacity of internal buffer.
    Declaration
    public MidiEventToBytesConverter(int capacity)
    Parameters
    Type Name Description
    int capacity Initial capacity of the internal buffer.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException capacity is negative.

    Properties

    BytesFormat

    Gets or sets the format of target bytes layout. The default is File.
    Declaration
    public BytesFormat BytesFormat { get; set; }
    Property Value
    Type Description
    BytesFormat
    Exceptions
    Type Condition
    InvalidEnumArgumentException value specified an invalid value.

    CustomMetaEventTypes

    Gets or sets collection of custom meta events types.
    Declaration
    public EventTypesCollection CustomMetaEventTypes { get; set; }
    Property Value
    Type Description
    EventTypesCollection
    Remarks

    Types within this collection must be derived from the MetaEvent class and have parameterless constructor. No exception will be thrown while writing a MIDI file if some types don't meet these requirements.

    NoteOffAsSilentNoteOn

    Gets or sets a value indicating whether Note Off events should be written as Note On ones with velocity of zero, or not. In conjunction with UseRunningStatus set to true can give some compression of MIDI data. The default value is false.
    Declaration
    public bool NoteOffAsSilentNoteOn { get; set; }
    Property Value
    Type Description
    bool

    TextEncoding

    Gets or sets an Encoding that will be used to write the text of a text-based meta event. The default is ASCII.
    Declaration
    public Encoding TextEncoding { get; set; }
    Property Value
    Type Description
    Encoding

    UseRunningStatus

    Gets or sets a value indicating whether 'running status' (to turn off writing of the status bytes of consecutive events of the same type) should be used or not. The default value is false.
    Declaration
    public bool UseRunningStatus { get; set; }
    Property Value
    Type Description
    bool

    WriteDeltaTimes

    Gets or sets a value indicating whether delta-times of events must be written to bytes array or not. The default value is false.
    Declaration
    public bool WriteDeltaTimes { get; set; }
    Property Value
    Type Description
    bool

    Methods

    Convert(MidiEvent)

    Converts an instance of the MidiEvent to bytes array.
    Declaration
    public byte[] Convert(MidiEvent midiEvent)
    Parameters
    Type Name Description
    MidiEvent midiEvent MIDI event to convert.
    Returns
    Type Description
    byte[] Array of bytes representing midiEvent.
    Exceptions
    Type Condition
    ArgumentNullException midiEvent is null.

    Convert(MidiEvent, int)

    Converts an instance of the MidiEvent to bytes array using the specified minimum size of resulting array.
    Declaration
    public byte[] Convert(MidiEvent midiEvent, int minSize)
    Parameters
    Type Name Description
    MidiEvent midiEvent MIDI event to convert.
    int minSize Minimum size of bytes array representing midiEvent.
    Returns
    Type Description
    byte[] Array of bytes representing midiEvent.
    Exceptions
    Type Condition
    ArgumentNullException midiEvent is null.
    ArgumentOutOfRangeException minSize is negative.

    Convert(IEnumerable<MidiEvent>)

    Converts collection of MidiEvent to bytes array.
    Declaration
    public byte[] Convert(IEnumerable<MidiEvent> midiEvents)
    Parameters
    Type Name Description
    IEnumerable<MidiEvent> midiEvents MIDI events to convert.
    Returns
    Type Description
    byte[] Array of bytes representing midiEvents.
    Exceptions
    Type Condition
    ArgumentNullException midiEvents is null.

    Dispose()

    Releases all resources used by the current instance of the MidiEventToBytesConverter class.
    Declaration
    public void Dispose()

    Implements

    IDisposable
    In this article
    Back to top 2024 / Generated by DocFX