Class PatternUtilities
Utilities to process an instance of the
Pattern.
Inheritance
PatternUtilities
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
Returns
Type |
Description |
Pattern |
Pattern that made up from patterns following each other. |
Exceptions
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
Returns
Type |
Description |
Pattern |
Pattern that made up from patterns arranged into stack. |
Exceptions
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
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
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
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
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
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 .
|
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 .
|
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 .
|
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 .
|