Show / Hide Table of Contents

    Class ReaderSettings

    Settings according to which MidiReader should read MIDI data.
    Inheritance
    Object
    ReaderSettings
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: Melanchall.DryWetMidi.Core
    Assembly: Melanchall.DryWetMidi.dll
    Syntax
    public sealed class ReaderSettings

    Properties

    Buffer

    Gets or sets the buffer that will be used by MidiReader in case of UseCustomBuffer policy used for BufferingPolicy.
    Declaration
    public byte[] Buffer { get; set; }
    Property Value
    Type Description
    Byte[]

    BufferingPolicy

    Gets or sets a rule according to which MIDI data should be buffered before reading. The default is UseFixedSizeBuffer.
    Declaration
    public BufferingPolicy BufferingPolicy { get; set; }
    Property Value
    Type Description
    BufferingPolicy
    Exceptions
    Type Condition
    InvalidEnumArgumentException value specified an invalid value.

    BufferSize

    Gets or sets the size of a buffer that will be used by MidiReader in case of UseFixedSizeBuffer policy used for BufferingPolicy.
    Declaration
    public int BufferSize { get; set; }
    Property Value
    Type Description
    Int32
    Exceptions
    Type Condition
    ArgumentOutOfRangeException value is zero or negative.

    NonSeekableStreamBufferSize

    Gets or sets internal buffer for reading MIDI data from non-seekable stream.
    Declaration
    public int NonSeekableStreamBufferSize { get; set; }
    Property Value
    Type Description
    Int32
    Remarks

    During reading MIDI data there are cases when reader should move current stream's position back. If stream doesn't support seeking, it will fail. So for non-seekable stream reading engine should maintain buffer of last N bytes to have ability to jump back. That N value is controlled by this property.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException Value is zero or negative.

    NonSeekableStreamIncrementalBytesReadingStep

    Gets or sets size of chunk for incremental reading of MIDI data from non-seekable stream.
    Declaration
    public int NonSeekableStreamIncrementalBytesReadingStep { get; set; }
    Property Value
    Type Description
    Int32
    Remarks

    This property works in conjunction with NonSeekableStreamIncrementalBytesReadingThreshold.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException Value is zero or negative.

    NonSeekableStreamIncrementalBytesReadingThreshold

    Gets or sets minimum count of bytes to read them from non-seekable stream incrementally instead of reading them all at once.
    Declaration
    public int NonSeekableStreamIncrementalBytesReadingThreshold { get; set; }
    Property Value
    Type Description
    Int32
    Remarks

    If count of bytes to read is greater than or equal to the value of this property, reading engine will read data by chunks of N bytes where N is a value of NonSeekableStreamIncrementalBytesReadingStep property. This property applies for non-seekable streams only. Since there is no way to determine available count of bytes within such streams, incremental reading can prevent OutOfMemoryException.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException Value is zero or negative.

    ReadFromMemory

    Gets or sets a value indicating whether all MIDI data should be put to memory and read from there. The default value is false.
    Declaration
    [Obsolete("OBS2: Use ReaderSettings.BufferingPolicy = BufferingPolicy.BufferAllData. More info: https://melanchall.github.io/drywetmidi/obsolete/obsolete.html#obs2.")]
    public bool ReadFromMemory { get; set; }
    Property Value
    Type Description
    Boolean
    Remarks

    If the property set to true, it can significantly speed up reading MIDI data. For almost all real MIDI files it shouldn't be a problem to place entire file to memory since the size of most MIDI files is relatively small.

    Back to top Generated by DocFX