Search Results for

    Show / Hide Table of Contents

    Class KeySignatureEvent

    Represents a Key Signature meta event.
    Inheritance
    object
    MidiEvent
    MetaEvent
    KeySignatureEvent
    Inherited Members
    MetaEvent.GetStandardMetaEventStatusBytes()
    MidiEvent.UnknownContentSize
    MidiEvent.EventType
    MidiEvent.DeltaTime
    MidiEvent.Clone()
    MidiEvent.Equals(MidiEvent, MidiEvent)
    MidiEvent.Equals(MidiEvent, MidiEvent, out string)
    MidiEvent.Equals(MidiEvent, MidiEvent, MidiEventEqualityCheckSettings)
    MidiEvent.Equals(MidiEvent, MidiEvent, MidiEventEqualityCheckSettings, 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 KeySignatureEvent : MetaEvent
    Remarks
    The MIDI key signature meta message specifies the key signature and scale of a MIDI file.

    Constructors

    KeySignatureEvent()

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

    KeySignatureEvent(sbyte, byte)

    Initializes a new instance of the KeySignatureEvent with the specified key and scale.
    Declaration
    public KeySignatureEvent(sbyte key, byte scale)
    Parameters
    Type Name Description
    sbyte key The number of flats (if negative) or sharps (if positive).
    byte scale The scale (0 for major or 1 for minor).
    Exceptions
    Type Condition
    ArgumentOutOfRangeException One of the following errors occurred:
    • key is out of [MinKey; MaxKey] range.
    • scale is out of [MinScale; MaxScale] range.

    Fields

    DefaultKey

    Default key (C).
    Declaration
    public const sbyte DefaultKey = 0
    Field Value
    Type Description
    sbyte

    DefaultScale

    Default scale (major).
    Declaration
    public const byte DefaultScale = 0
    Field Value
    Type Description
    byte

    MaxKey

    Represents the largest possible key value.
    Declaration
    public const sbyte MaxKey = 7
    Field Value
    Type Description
    sbyte

    MaxScale

    Represents the largest possible scale value.
    Declaration
    public const byte MaxScale = 1
    Field Value
    Type Description
    byte

    MinKey

    Represents the smallest possible key value.
    Declaration
    public const sbyte MinKey = -7
    Field Value
    Type Description
    sbyte

    MinScale

    Represents the smallest possible scale value.
    Declaration
    public const byte MinScale = 0
    Field Value
    Type Description
    byte

    Properties

    Key

    Gets or sets key signature in terms of number of flats (if negative) or sharps (if positive).
    Declaration
    public sbyte Key { get; set; }
    Property Value
    Type Description
    sbyte
    Exceptions
    Type Condition
    ArgumentOutOfRangeException value is out of [MinKey; MaxKey] range.

    Scale

    Gets or sets scale (0 for major or 1 for minor).
    Declaration
    public byte Scale { get; set; }
    Property Value
    Type Description
    byte
    Exceptions
    Type Condition
    ArgumentOutOfRangeException value is out of [MinScale; MaxScale] range.

    Methods

    CloneEvent()

    Clones event by creating a copy of it.
    Declaration
    protected override MidiEvent CloneEvent()
    Returns
    Type Description
    MidiEvent Copy of the event.
    Overrides
    MidiEvent.CloneEvent()

    GetContentSize(WritingSettings)

    Gets the size of the content of a MIDI meta event.
    Declaration
    protected override int GetContentSize(WritingSettings settings)
    Parameters
    Type Name Description
    WritingSettings settings Settings according to which the event's content must be written.
    Returns
    Type Description
    int Size of the event's content.
    Overrides
    MetaEvent.GetContentSize(WritingSettings)

    ReadContent(MidiReader, ReadingSettings, int)

    Reads content of a MIDI meta event.
    Declaration
    protected override void ReadContent(MidiReader reader, ReadingSettings settings, int size)
    Parameters
    Type Name Description
    MidiReader reader Reader to read the content with.
    ReadingSettings settings Settings according to which the event's content must be read.
    int size Size of the event's content.
    Overrides
    MetaEvent.ReadContent(MidiReader, ReadingSettings, int)

    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 MIDI meta event.
    Declaration
    protected override void WriteContent(MidiWriter writer, WritingSettings settings)
    Parameters
    Type Name Description
    MidiWriter writer Writer to write the content with.
    WritingSettings settings Settings according to which the event's content must be written.
    Overrides
    MetaEvent.WriteContent(MidiWriter, WritingSettings)
    In this article
    Back to top 2024 / Generated by DocFX