From 5187dc7226cef2a8669200ee2904f0e257a54ca7 Mon Sep 17 00:00:00 2001 From: Maxim Dobroselsky Date: Sat, 20 Jul 2024 21:08:35 +0300 Subject: [PATCH] [Docs] Fixed docs + docfx update --- .../high-level-managing/Getting-objects.md | 15 ++++-- Docs/docfx.json | 5 +- Docs/templates/dwm/styles/main.css | 4 ++ .../Composing/PatternBuilder.PianoRoll.cs | 4 +- .../Interaction/Chords/ChordProcessingHint.cs | 2 +- .../Chords/ChordsManagingUtilities.cs | 48 ++++++++++++------ DryWetMidi/Interaction/Grid/IGrid.cs | 4 +- .../Interaction/Notes/NoteProcessingHint.cs | 2 +- .../Notes/NotesManagingUtilities.cs | 49 +++++++++++++------ .../TimedEventsManagingUtilities.cs | 16 ++++++ Resources/CI/Templates/step-build-docs.yaml | 2 +- 11 files changed, 107 insertions(+), 44 deletions(-) diff --git a/Docs/articles/high-level-managing/Getting-objects.md b/Docs/articles/high-level-managing/Getting-objects.md index 68e555c97..5e0ac70d6 100644 --- a/Docs/articles/high-level-managing/Getting-objects.md +++ b/Docs/articles/high-level-managing/Getting-objects.md @@ -102,7 +102,11 @@ Please examine [NotesManagingUtilities](xref:Melanchall.DryWetMidi.Interaction.N ### Settings -All `GetNotes` overloads can accept [NoteDetectionSettings](xref:Melanchall.DryWetMidi.Interaction.NoteDetectionSettings) as last parameter. Via this parameter you can adjust the process of notes building. Let's see each setting in details. +All `GetNotes` overloads can accept [NoteDetectionSettings](xref:Melanchall.DryWetMidi.Interaction.NoteDetectionSettings) as a parameter. Via this parameter you can adjust the process of notes building. + +More than that, notes are built on top of timed events. So you can pass [TimedEventDetectionSettings](xref:Melanchall.DryWetMidi.Interaction.TimedEventDetectionSettings) as a separate parameter to control how underlying MIDI events will be constructed. + +Let's see each setting of the [NoteDetectionSettings](xref:Melanchall.DryWetMidi.Interaction.NoteDetectionSettings) in details. #### `NoteStartDetectionPolicy` @@ -176,7 +180,6 @@ chord foreach (var note in chord.Notes) { - Console.Write($@" note {note} (note number = {note.NoteNumber}) channel = {note.Channel} @@ -232,11 +235,13 @@ Please examine [ChordsManagingUtilities](xref:Melanchall.DryWetMidi.Interaction. ### Settings -All `GetChords` overloads can accept [ChordDetectionSettings](xref:Melanchall.DryWetMidi.Interaction.ChordDetectionSettings) as last parameter. Via this parameter you can adjust the process of chords building. Let's see each setting in details. +All `GetChords` overloads can accept [ChordDetectionSettings](xref:Melanchall.DryWetMidi.Interaction.ChordDetectionSettings) as a parameter. Via this parameter you can adjust the process of chords building. + +Also note that chords are built on top of notes. So to build chords we need to build notes. The process of notes building is adjustable via [NoteDetectionSettings](xref:Melanchall.DryWetMidi.Interaction.NoteDetectionSettings) which you can pass to the methods too. Properties of the [NoteDetectionSettings](xref:Melanchall.DryWetMidi.Interaction.NoteDetectionSettings) are described in detail [above](#settings). -#### `NoteDetectionSettings` +More than that, notes are built on top of timed events as described [above](#settings). So you can pass [TimedEventDetectionSettings](xref:Melanchall.DryWetMidi.Interaction.TimedEventDetectionSettings) too. -Chords are built on top of notes. So to build chords we need to build notes. The process of notes building is adjustable via [NoteDetectionSettings](xref:Melanchall.DryWetMidi.Interaction.ChordDetectionSettings.NoteDetectionSettings) property. Properties of the [NoteDetectionSettings](xref:Melanchall.DryWetMidi.Interaction.NoteDetectionSettings) are described in detail [above](#settings). +Let's see each setting of the [ChordDetectionSettings](xref:Melanchall.DryWetMidi.Interaction.ChordDetectionSettings) in details. #### `NotesTolerance` diff --git a/Docs/docfx.json b/Docs/docfx.json index 120d7d41b..169b4d2d0 100644 --- a/Docs/docfx.json +++ b/Docs/docfx.json @@ -47,6 +47,9 @@ ], "markdownEngineName": "markdig", "dest": "_site", - "xrefService": [ "https://xref.docs.microsoft.com/query?uid={uid}" ] + "xrefService": [ "https://xref.docs.microsoft.com/query?uid={uid}" ], + "xref": [ + "https://learn.microsoft.com/en-us/dotnet/.xrefmap.json" + ] } } diff --git a/Docs/templates/dwm/styles/main.css b/Docs/templates/dwm/styles/main.css index c078110fb..58eb1d62a 100644 --- a/Docs/templates/dwm/styles/main.css +++ b/Docs/templates/dwm/styles/main.css @@ -210,6 +210,10 @@ hr { color: #ce9178; } +pre code.hljs { + padding: 0; +} + .toc .nav > li > a { color: #D5D5D5; } diff --git a/DryWetMidi/Composing/PatternBuilder.PianoRoll.cs b/DryWetMidi/Composing/PatternBuilder.PianoRoll.cs index b40c03268..f20dfc169 100644 --- a/DryWetMidi/Composing/PatternBuilder.PianoRoll.cs +++ b/DryWetMidi/Composing/PatternBuilder.PianoRoll.cs @@ -111,9 +111,9 @@ private static void ProcessLine( } else { - Action customAction; + Action customAction = null; if (settings.CustomActions?.TryGetValue(symbol, out customAction) == true) - customAction(note, patternBuilder); + customAction?.Invoke(note, patternBuilder); else if (!isNoteBuilding) patternBuilder.StepForward(); } diff --git a/DryWetMidi/Interaction/Chords/ChordProcessingHint.cs b/DryWetMidi/Interaction/Chords/ChordProcessingHint.cs index 9b12aaba0..e0f7cf3b9 100644 --- a/DryWetMidi/Interaction/Chords/ChordProcessingHint.cs +++ b/DryWetMidi/Interaction/Chords/ChordProcessingHint.cs @@ -7,7 +7,7 @@ namespace Melanchall.DryWetMidi.Interaction /// /// /// If you want to get the maximum performance of a chord processing (for example, - /// ), + /// ), /// choose a hint carefully. Note that you can always use an object manager to /// perform any manipulations with chords but dedicated methods of the will /// always be faster and will consume less memory. diff --git a/DryWetMidi/Interaction/Chords/ChordsManagingUtilities.cs b/DryWetMidi/Interaction/Chords/ChordsManagingUtilities.cs index 9360852dc..6b0f5dd18 100644 --- a/DryWetMidi/Interaction/Chords/ChordsManagingUtilities.cs +++ b/DryWetMidi/Interaction/Chords/ChordsManagingUtilities.cs @@ -230,10 +230,10 @@ public static ICollection GetChords( /// Settings according to which chords should be detected and built. /// Collection of chords contained in ordered by time. /// is null. - /// - /// - /// - /// + /// + /// + /// + /// /// public static ICollection GetChords( this EventsCollection eventsCollection, @@ -260,10 +260,10 @@ public static ICollection GetChords( /// Settings according to which chords should be detected and built. /// Collection of chords contained in ordered by time. /// is null. - /// - /// - /// - /// + /// + /// + /// + /// /// public static ICollection GetChords( this TrackChunk trackChunk, @@ -284,10 +284,10 @@ public static ICollection GetChords( /// Settings according to which chords should be detected and built. /// Collection of chords contained in ordered by time. /// is null. - /// - /// - /// - /// + /// + /// + /// + /// /// public static ICollection GetChords( this IEnumerable trackChunks, @@ -323,10 +323,10 @@ public static ICollection GetChords( /// Settings according to which chords should be detected and built. /// Collection of chords contained in ordered by time. /// is null. - /// - /// - /// - /// + /// + /// + /// + /// /// public static ICollection GetChords( this MidiFile file, @@ -383,6 +383,7 @@ public static IEnumerable GetChords( /// /// /// + /// public static int ProcessChords( this EventsCollection eventsCollection, Action action, @@ -427,6 +428,7 @@ public static int ProcessChords( /// /// /// + /// public static int ProcessChords( this EventsCollection eventsCollection, Action action, @@ -475,6 +477,7 @@ public static int ProcessChords( /// /// /// + /// public static int ProcessChords( this TrackChunk trackChunk, Action action, @@ -519,6 +522,7 @@ public static int ProcessChords( /// /// /// + /// public static int ProcessChords( this TrackChunk trackChunk, Action action, @@ -562,6 +566,7 @@ public static int ProcessChords( /// /// /// + /// public static int ProcessChords( this IEnumerable trackChunks, Action action, @@ -607,6 +612,7 @@ public static int ProcessChords( /// /// /// + /// public static int ProcessChords( this IEnumerable trackChunks, Action action, @@ -658,6 +664,7 @@ public static int ProcessChords( /// /// /// + /// public static int ProcessChords( this MidiFile file, Action action, @@ -702,6 +709,7 @@ public static int ProcessChords( /// /// /// + /// public static int ProcessChords( this MidiFile file, Action action, @@ -725,6 +733,7 @@ public static int ProcessChords( /// Settings according to which chords should be detected and built. /// Count of removed chords. /// is null. + /// public static int RemoveChords( this EventsCollection eventsCollection, ChordDetectionSettings settings = null, @@ -754,6 +763,7 @@ public static int RemoveChords( /// /// /// + /// public static int RemoveChords( this EventsCollection eventsCollection, Predicate match, @@ -792,6 +802,7 @@ public static int RemoveChords( /// Settings according to which chords should be detected and built. /// Count of removed chords. /// is null. + /// public static int RemoveChords( this TrackChunk trackChunk, ChordDetectionSettings settings = null, @@ -821,6 +832,7 @@ public static int RemoveChords( /// /// /// + /// public static int RemoveChords( this TrackChunk trackChunk, Predicate match, @@ -841,6 +853,7 @@ public static int RemoveChords( /// Settings according to which chords should be detected and built. /// Count of removed chords. /// is null. + /// public static int RemoveChords( this IEnumerable trackChunks, ChordDetectionSettings settings = null, @@ -870,6 +883,7 @@ public static int RemoveChords( /// /// /// + /// public static int RemoveChords( this IEnumerable trackChunks, Predicate match, @@ -908,6 +922,7 @@ public static int RemoveChords( /// Settings according to which chords should be detected and built. /// Count of removed chords. /// is null. + /// public static int RemoveChords( this MidiFile file, ChordDetectionSettings settings = null, @@ -937,6 +952,7 @@ public static int RemoveChords( /// /// /// + /// public static int RemoveChords( this MidiFile file, Predicate match, diff --git a/DryWetMidi/Interaction/Grid/IGrid.cs b/DryWetMidi/Interaction/Grid/IGrid.cs index 1e67a3bc0..66dae96e7 100644 --- a/DryWetMidi/Interaction/Grid/IGrid.cs +++ b/DryWetMidi/Interaction/Grid/IGrid.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; namespace Melanchall.DryWetMidi.Interaction { @@ -12,6 +13,7 @@ public interface IGrid /// /// Tempo map used to get grid's times. /// Collection of times (in MIDI ticks) of the current grid. + /// is null. IEnumerable GetTimes(TempoMap tempoMap); } } diff --git a/DryWetMidi/Interaction/Notes/NoteProcessingHint.cs b/DryWetMidi/Interaction/Notes/NoteProcessingHint.cs index 93254589e..100bc1375 100644 --- a/DryWetMidi/Interaction/Notes/NoteProcessingHint.cs +++ b/DryWetMidi/Interaction/Notes/NoteProcessingHint.cs @@ -7,7 +7,7 @@ namespace Melanchall.DryWetMidi.Interaction /// /// /// If you want to get the maximum performance of a note processing (for example, - /// ), + /// ), /// choose a hint carefully. Note that you can always use an object manager to /// perform any manipulations with notes but dedicated methods of the will /// always be faster and will consume less memory. diff --git a/DryWetMidi/Interaction/Notes/NotesManagingUtilities.cs b/DryWetMidi/Interaction/Notes/NotesManagingUtilities.cs index eebc1d792..9159c8c43 100644 --- a/DryWetMidi/Interaction/Notes/NotesManagingUtilities.cs +++ b/DryWetMidi/Interaction/Notes/NotesManagingUtilities.cs @@ -254,6 +254,7 @@ public static TimedObjectsManager ManageNotes(this TrackChunk trackChunk, /// Settings according to which notes should be detected and built. /// Collection of notes contained in ordered by time. /// is null. + /// public static ICollection GetNotes( this IEnumerable midiEvents, NoteDetectionSettings settings = null, @@ -278,10 +279,10 @@ public static ICollection GetNotes( /// Settings according to which notes should be detected and built. /// Collection of notes contained in ordered by time. /// is null. - /// - /// - /// - /// + /// + /// + /// + /// /// public static ICollection GetNotes( this EventsCollection eventsCollection, @@ -307,10 +308,10 @@ public static ICollection GetNotes( /// Settings according to which notes should be detected and built. /// Collection of notes contained in ordered by time. /// is null. - /// - /// - /// - /// + /// + /// + /// + /// /// public static ICollection GetNotes( this TrackChunk trackChunk, @@ -330,10 +331,10 @@ public static ICollection GetNotes( /// Settings according to which notes should be detected and built. /// Collection of notes contained in ordered by time. /// is null. - /// - /// - /// - /// + /// + /// + /// + /// /// public static ICollection GetNotes( this IEnumerable trackChunks, @@ -368,10 +369,10 @@ public static ICollection GetNotes( /// Settings according to which notes should be detected and built. /// Collection of notes contained in ordered by time. /// is null. - /// - /// - /// - /// + /// + /// + /// + /// /// public static ICollection GetNotes( this MidiFile file, @@ -409,6 +410,7 @@ public static ICollection GetNotes( /// /// /// + /// public static int ProcessNotes( this EventsCollection eventsCollection, Action action, @@ -452,6 +454,7 @@ public static int ProcessNotes( /// /// /// + /// public static int ProcessNotes( this EventsCollection eventsCollection, Action action, @@ -493,6 +496,7 @@ public static int ProcessNotes( /// /// /// + /// public static int ProcessNotes( this TrackChunk trackChunk, Action action, @@ -536,6 +540,7 @@ public static int ProcessNotes( /// /// /// + /// public static int ProcessNotes( this TrackChunk trackChunk, Action action, @@ -577,6 +582,7 @@ public static int ProcessNotes( /// /// /// + /// public static int ProcessNotes( this IEnumerable trackChunks, Action action, @@ -621,6 +627,7 @@ public static int ProcessNotes( /// /// /// + /// public static int ProcessNotes( this IEnumerable trackChunks, Action action, @@ -665,6 +672,7 @@ public static int ProcessNotes( /// /// /// + /// public static int ProcessNotes( this MidiFile file, Action action, @@ -708,6 +716,7 @@ public static int ProcessNotes( /// /// /// + /// public static int ProcessNotes( this MidiFile file, Action action, @@ -730,6 +739,7 @@ public static int ProcessNotes( /// Settings according to which notes should be detected and built. /// Count of removed notes. /// is null. + /// public static int RemoveNotes( this EventsCollection eventsCollection, NoteDetectionSettings settings = null, @@ -758,6 +768,7 @@ public static int RemoveNotes( /// /// /// + /// public static int RemoveNotes( this EventsCollection eventsCollection, Predicate match, @@ -788,6 +799,7 @@ public static int RemoveNotes( /// Settings according to which notes should be detected and built. /// Count of removed notes. /// is null. + /// public static int RemoveNotes( this TrackChunk trackChunk, NoteDetectionSettings settings = null, @@ -816,6 +828,7 @@ public static int RemoveNotes( /// /// /// + /// public static int RemoveNotes( this TrackChunk trackChunk, Predicate match, @@ -835,6 +848,7 @@ public static int RemoveNotes( /// Settings according to which notes should be detected and built. /// Count of removed notes. /// is null. + /// public static int RemoveNotes( this IEnumerable trackChunks, NoteDetectionSettings settings = null, @@ -863,6 +877,7 @@ public static int RemoveNotes( /// /// /// + /// public static int RemoveNotes( this IEnumerable trackChunks, Predicate match, @@ -893,6 +908,7 @@ public static int RemoveNotes( /// Settings according to which notes should be detected and built. /// Count of removed notes. /// is null. + /// public static int RemoveNotes( this MidiFile file, NoteDetectionSettings settings = null, @@ -921,6 +937,7 @@ public static int RemoveNotes( /// /// /// + /// public static int RemoveNotes( this MidiFile file, Predicate match, diff --git a/DryWetMidi/Interaction/TimedEvents/TimedEventsManagingUtilities.cs b/DryWetMidi/Interaction/TimedEvents/TimedEventsManagingUtilities.cs index ae0f5831f..5344014dc 100644 --- a/DryWetMidi/Interaction/TimedEvents/TimedEventsManagingUtilities.cs +++ b/DryWetMidi/Interaction/TimedEvents/TimedEventsManagingUtilities.cs @@ -180,6 +180,7 @@ public static ICollection GetTimedEvents(this MidiFile file, TimedEv /// /// /// + /// public static int ProcessTimedEvents(this EventsCollection eventsCollection, Action action, TimedEventDetectionSettings settings = null, TimedEventProcessingHint hint = TimedEventProcessingHint.Default) { ThrowIfArgument.IsNull(nameof(eventsCollection), eventsCollection); @@ -218,6 +219,7 @@ public static int ProcessTimedEvents(this EventsCollection eventsCollection, Act /// /// /// + /// public static int ProcessTimedEvents(this EventsCollection eventsCollection, Action action, Predicate match, TimedEventDetectionSettings settings = null, TimedEventProcessingHint hint = TimedEventProcessingHint.Default) { ThrowIfArgument.IsNull(nameof(eventsCollection), eventsCollection); @@ -253,6 +255,7 @@ public static int ProcessTimedEvents(this EventsCollection eventsCollection, Act /// /// /// + /// public static int ProcessTimedEvents(this TrackChunk trackChunk, Action action, TimedEventDetectionSettings settings = null, TimedEventProcessingHint hint = TimedEventProcessingHint.Default) { ThrowIfArgument.IsNull(nameof(trackChunk), trackChunk); @@ -291,6 +294,7 @@ public static int ProcessTimedEvents(this TrackChunk trackChunk, Action /// /// + /// public static int ProcessTimedEvents(this TrackChunk trackChunk, Action action, Predicate match, TimedEventDetectionSettings settings = null, TimedEventProcessingHint hint = TimedEventProcessingHint.Default) { ThrowIfArgument.IsNull(nameof(trackChunk), trackChunk); @@ -327,6 +331,7 @@ public static int ProcessTimedEvents(this TrackChunk trackChunk, Action /// /// + /// public static int ProcessTimedEvents(this IEnumerable trackChunks, Action action, TimedEventDetectionSettings settings = null, TimedEventProcessingHint hint = TimedEventProcessingHint.Default) { ThrowIfArgument.IsNull(nameof(trackChunks), trackChunks); @@ -366,6 +371,7 @@ public static int ProcessTimedEvents(this IEnumerable trackChunks, A /// /// /// + /// public static int ProcessTimedEvents(this IEnumerable trackChunks, Action action, Predicate match, TimedEventDetectionSettings settings = null, TimedEventProcessingHint hint = TimedEventProcessingHint.Default) { ThrowIfArgument.IsNull(nameof(trackChunks), trackChunks); @@ -404,6 +410,7 @@ public static int ProcessTimedEvents(this IEnumerable trackChunks, A /// /// /// + /// public static int ProcessTimedEvents(this MidiFile file, Action action, TimedEventDetectionSettings settings = null, TimedEventProcessingHint hint = TimedEventProcessingHint.Default) { ThrowIfArgument.IsNull(nameof(file), file); @@ -442,6 +449,7 @@ public static int ProcessTimedEvents(this MidiFile file, Action acti /// /// /// + /// public static int ProcessTimedEvents(this MidiFile file, Action action, Predicate match, TimedEventDetectionSettings settings = null, TimedEventProcessingHint hint = TimedEventProcessingHint.Default) { ThrowIfArgument.IsNull(nameof(file), file); @@ -457,6 +465,7 @@ public static int ProcessTimedEvents(this MidiFile file, Action acti /// to search for events to remove. /// Count of removed timed events. /// is null. + /// public static int RemoveTimedEvents(this EventsCollection eventsCollection) { ThrowIfArgument.IsNull(nameof(eventsCollection), eventsCollection); @@ -484,6 +493,7 @@ public static int RemoveTimedEvents(this EventsCollection eventsCollection) /// /// /// + /// public static int RemoveTimedEvents(this EventsCollection eventsCollection, Predicate match, TimedEventDetectionSettings settings = null) { ThrowIfArgument.IsNull(nameof(eventsCollection), eventsCollection); @@ -529,6 +539,7 @@ public static int RemoveTimedEvents(this EventsCollection eventsCollection, Pred /// to search for events to remove. /// Count of removed timed events. /// is null. + /// public static int RemoveTimedEvents(this TrackChunk trackChunk) { ThrowIfArgument.IsNull(nameof(trackChunk), trackChunk); @@ -556,6 +567,7 @@ public static int RemoveTimedEvents(this TrackChunk trackChunk) /// /// /// + /// public static int RemoveTimedEvents(this TrackChunk trackChunk, Predicate match, TimedEventDetectionSettings settings = null) { ThrowIfArgument.IsNull(nameof(trackChunk), trackChunk); @@ -570,6 +582,7 @@ public static int RemoveTimedEvents(this TrackChunk trackChunk, PredicateCollection of to search for events to remove. /// Count of removed timed events. /// is null. + /// public static int RemoveTimedEvents(this IEnumerable trackChunks) { ThrowIfArgument.IsNull(nameof(trackChunks), trackChunks); @@ -602,6 +615,7 @@ public static int RemoveTimedEvents(this IEnumerable trackChunks) /// /// /// + /// public static int RemoveTimedEvents(this IEnumerable trackChunks, Predicate match, TimedEventDetectionSettings settings = null) { ThrowIfArgument.IsNull(nameof(trackChunks), trackChunks); @@ -680,6 +694,7 @@ public static int RemoveTimedEvents(this IEnumerable trackChunks, Pr /// to search for events to remove. /// Count of removed timed events. /// is null. + /// public static int RemoveTimedEvents(this MidiFile file) { ThrowIfArgument.IsNull(nameof(file), file); @@ -705,6 +720,7 @@ public static int RemoveTimedEvents(this MidiFile file) /// /// /// + /// public static int RemoveTimedEvents(this MidiFile file, Predicate match, TimedEventDetectionSettings settings = null) { ThrowIfArgument.IsNull(nameof(file), file); diff --git a/Resources/CI/Templates/step-build-docs.yaml b/Resources/CI/Templates/step-build-docs.yaml index 53ad7a875..77ece533c 100644 --- a/Resources/CI/Templates/step-build-docs.yaml +++ b/Resources/CI/Templates/step-build-docs.yaml @@ -3,7 +3,7 @@ steps: displayName: Install docfx inputs: targetType: 'inline' - script: choco install docfx -y --version $(DocFxVersion) + script: dotnet tool install -g docfx --version $(DocFxVersion) - task: PowerShell@2 displayName: Setup year