Search Results for

    Show / Hide Table of Contents

    Class PatternUtilities

    Utilities to process an instance of the Pattern.
    Inheritance
    object
    PatternUtilities
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Melanchall.DryWetMidi.Composing
    Assembly: Melanchall.DryWetMidi.dll
    Syntax
    public static class PatternUtilities

    Methods

    MergeSequentially(IEnumerable<Pattern>)

    Combines the specified patterns into single one placing them after each other.
    Declaration
    public static Pattern MergeSequentially(this IEnumerable<Pattern> patterns)
    Parameters
    Type Name Description
    IEnumerable<Pattern> patterns Patterns to combine.
    Returns
    Type Description
    Pattern Pattern that made up from patterns following each other.
    Exceptions
    Type Condition
    ArgumentNullException patterns is null.

    MergeSimultaneously(IEnumerable<Pattern>)

    Combines the specified patterns into single one starting all them at the same time (i.e. stacking patterns).
    Declaration
    public static Pattern MergeSimultaneously(this IEnumerable<Pattern> patterns)
    Parameters
    Type Name Description
    IEnumerable<Pattern> patterns Patterns to combine.
    Returns
    Type Description
    Pattern Pattern that made up from patterns arranged into stack.
    Exceptions
    Type Condition
    ArgumentNullException patterns is null.

    SetChordsState(Pattern, ChordSelection, PatternActionState, bool)

    Sets the state of chords within the specified pattern.
    Declaration
    public static void SetChordsState(this Pattern pattern, ChordSelection chordSelection, PatternActionState state, bool recursive = true)
    Parameters
    Type Name Description
    Pattern pattern Pattern to set chords state within.
    ChordSelection chordSelection Predicate to select chords to set state.
    PatternActionState state State of chords selected with chordSelection.
    bool recursive A value indicating whether nested patterns should be processed or not. The default value is true.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • pattern is null.
    • chordSelection is null.
    InvalidEnumArgumentException state specified an invalid value.

    SetNotesState(Pattern, NoteSelection, PatternActionState, bool)

    Sets the state of notes within the specified pattern.
    Declaration
    public static void SetNotesState(this Pattern pattern, NoteSelection noteSelection, PatternActionState state, bool recursive = true)
    Parameters
    Type Name Description
    Pattern pattern Pattern to set notes state within.
    NoteSelection noteSelection Predicate to select notes to set state.
    PatternActionState state State of notes selected with noteSelection.
    bool recursive A value indicating whether nested patterns should be processed or not. The default value is true.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • pattern is null.
    • noteSelection is null.
    InvalidEnumArgumentException state specified an invalid value.

    SplitAtAllAnchors(Pattern, bool)

    Splits a pattern into subpatterns in points where anchors inserted.
    Declaration
    public static IEnumerable<Pattern> SplitAtAllAnchors(this Pattern pattern, bool removeEmptyPatterns = true)
    Parameters
    Type Name Description
    Pattern pattern Pattern to split.
    bool removeEmptyPatterns A value indicating whether empty patterns should be automatically removed or not. The default value is true.
    Returns
    Type Description
    IEnumerable<Pattern> A collection whose elements are the subpatterns from the pattern that is split at anchors.
    Exceptions
    Type Condition
    ArgumentNullException pattern is null.

    SplitAtAllMarkers(Pattern, bool)

    Splits a pattern into subpatterns in points where markers inserted.
    Declaration
    public static IEnumerable<Pattern> SplitAtAllMarkers(this Pattern pattern, bool removeEmptyPatterns = true)
    Parameters
    Type Name Description
    Pattern pattern Pattern to split.
    bool removeEmptyPatterns A value indicating whether empty patterns should be automatically removed or not. The default value is true.
    Returns
    Type Description
    IEnumerable<Pattern> A collection whose elements are the subpatterns from the pattern that is split at markers.
    Exceptions
    Type Condition
    ArgumentNullException pattern is null.

    SplitAtAnchor(Pattern, object, bool)

    Splits a pattern into subpatterns in points where the specified anchor inserted.
    Declaration
    public static IEnumerable<Pattern> SplitAtAnchor(this Pattern pattern, object anchor, bool removeEmptyPatterns = true)
    Parameters
    Type Name Description
    Pattern pattern Pattern to split.
    object anchor Anchor to split pattern at.
    bool removeEmptyPatterns A value indicating whether empty patterns should be automatically removed or not. The default value is true.
    Returns
    Type Description
    IEnumerable<Pattern> A collection whose elements are the subpatterns from the pattern that is split at anchor.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • pattern is null.
    • anchor is null.

    SplitAtMarker(Pattern, string, bool, StringComparison)

    Splits a pattern into subpatterns in points where the specified marker inserted.
    Declaration
    public static IEnumerable<Pattern> SplitAtMarker(this Pattern pattern, string marker, bool removeEmptyPatterns = true, StringComparison stringComparison = StringComparison.CurrentCulture)
    Parameters
    Type Name Description
    Pattern pattern Pattern to split.
    string marker Marker to split pattern at.
    bool removeEmptyPatterns A value indicating whether empty patterns should be automatically removed or not. The default value is true.
    StringComparison stringComparison Value that specifies how the marker strings will be compared.
    Returns
    Type Description
    IEnumerable<Pattern> A collection whose elements are the subpatterns from the pattern that is split at marker.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • pattern is null.
    • marker is null.
    InvalidEnumArgumentException stringComparison specified an invalid value.

    TransformChords(Pattern, ChordSelection, ChordTransformation, bool)

    Creates a new Pattern by transforming chords in the specified pattern using predicate to select chords to transform..
    Declaration
    public static Pattern TransformChords(this Pattern pattern, ChordSelection chordSelection, ChordTransformation chordTransformation, bool recursive = true)
    Parameters
    Type Name Description
    Pattern pattern Pattern to transform notes of.
    ChordSelection chordSelection Predicate to select chords to transform.
    ChordTransformation chordTransformation Transformation to apply to chords of the pattern.
    bool recursive A value indicating whether nested patterns should be processed or not. The default value is true.
    Returns
    Type Description
    Pattern Pattern that created by transforming chords of the pattern.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • pattern is null.
    • chordSelection is null.
    • chordTransformation is null.

    TransformChords(Pattern, ChordTransformation, bool)

    Creates a new Pattern by transforming chords in the specified pattern.
    Declaration
    public static Pattern TransformChords(this Pattern pattern, ChordTransformation chordTransformation, bool recursive = true)
    Parameters
    Type Name Description
    Pattern pattern Pattern to transform notes of.
    ChordTransformation chordTransformation Transformation to apply to chords of the pattern.
    bool recursive A value indicating whether nested patterns should be processed or not. The default value is true.
    Returns
    Type Description
    Pattern Pattern that created by transforming chords of the pattern.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • pattern is null.
    • chordTransformation is null.

    TransformNotes(Pattern, NoteSelection, NoteTransformation, bool)

    Creates a new Pattern by transforming notes in the specified pattern using predicate to select notes to transform.
    Declaration
    public static Pattern TransformNotes(this Pattern pattern, NoteSelection noteSelection, NoteTransformation noteTransformation, bool recursive = true)
    Parameters
    Type Name Description
    Pattern pattern Pattern to transform notes of.
    NoteSelection noteSelection Predicate to select notes to transform.
    NoteTransformation noteTransformation Transformation to apply to notes of the pattern.
    bool recursive A value indicating whether nested patterns should be processed or not. The default value is true.
    Returns
    Type Description
    Pattern Pattern that created by transforming notes of the pattern.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • pattern is null.
    • noteSelection is null.
    • noteTransformation is null.

    TransformNotes(Pattern, NoteTransformation, bool)

    Creates a new Pattern by transforming notes in the specified pattern.
    Declaration
    public static Pattern TransformNotes(this Pattern pattern, NoteTransformation noteTransformation, bool recursive = true)
    Parameters
    Type Name Description
    Pattern pattern Pattern to transform notes of.
    NoteTransformation noteTransformation Transformation to apply to notes of the pattern.
    bool recursive A value indicating whether nested patterns should be processed or not. The default value is true.
    Returns
    Type Description
    Pattern Pattern that created by transforming notes of the pattern.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • pattern is null.
    • noteTransformation is null.
    In this article
    Back to top 2024 / Generated by DocFX