Skip to content

Commit 1748f93

Browse files
committed
[Release] Code cleanup
1 parent dfa4550 commit 1748f93

30 files changed

+47
-65
lines changed

Docs/docfx.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"_enableSearch": true,
3939
"_appLogoPath": "images/logo.png",
4040
"_appFaviconPath": "images/favicon.png",
41-
"_appFooter": "2024 / Generated by <a href=\"https://dotnet.github.io/docfx\">DocFX</a>",
41+
"_appFooter": "2023 / Generated by <a href=\"https://dotnet.github.io/docfx\">DocFX</a>",
4242
"_disableContribution": true
4343
},
4444
"template": [

DryWetMidi/Common/MathUtilities.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,9 @@ public static long LeastCommonMultiple(long a, long b)
133133

134134
public static long GreatestCommonDivisor(long a, long b)
135135
{
136-
long remainder;
137-
138136
while (b != 0)
139137
{
140-
remainder = a % b;
138+
var remainder = a % b;
141139
a = b;
142140
b = remainder;
143141
}

DryWetMidi/Composing/Actions/StepAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ internal abstract class StepAction : PatternAction
66
{
77
#region Constructor
88

9-
public StepAction(ITimeSpan step)
9+
protected StepAction(ITimeSpan step)
1010
{
1111
Step = step;
1212
}

DryWetMidi/Core/Events/Base/MidiEvent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public abstract class MidiEvent
3434
/// Initializes a new instance of the <see cref="MidiEvent"/> with the specified event type.
3535
/// </summary>
3636
/// <param name="eventType">The type of event.</param>
37-
public MidiEvent(MidiEventType eventType)
37+
protected MidiEvent(MidiEventType eventType)
3838
{
3939
EventType = eventType;
4040
}

DryWetMidi/Core/Events/Meta/BaseTextEvent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public abstract class BaseTextEvent : MetaEvent
1818
/// <summary>
1919
/// Initializes a new instance of the <see cref="BaseTextEvent"/>.
2020
/// </summary>
21-
public BaseTextEvent(MidiEventType eventType)
21+
protected BaseTextEvent(MidiEventType eventType)
2222
: base(eventType)
2323
{
2424
}
@@ -29,7 +29,7 @@ public BaseTextEvent(MidiEventType eventType)
2929
/// <param name="eventType">The type of event.</param>
3030
/// <param name="text">Text contained in the event.</param>
3131
/// <exception cref="InvalidEnumArgumentException"><paramref name="eventType"/> specified an invalid value.</exception>
32-
public BaseTextEvent(MidiEventType eventType, string text)
32+
protected BaseTextEvent(MidiEventType eventType, string text)
3333
: this(eventType)
3434
{
3535
Text = text;

DryWetMidi/Core/MidiReader.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,11 @@ public int ReadVlqNumber()
298298
public long ReadVlqLongNumber()
299299
{
300300
long result = 0;
301-
byte b;
302301

303302
try
304303
{
304+
byte b;
305+
305306
do
306307
{
307308
b = ReadByte();

DryWetMidi/Interaction/Chords/ChordsBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ private class ChordDescriptor
1111
{
1212
private readonly int _notesMinCount;
1313

14-
public ChordDescriptor(Note firstNote, int notesMinCount)
14+
protected ChordDescriptor(Note firstNote, int notesMinCount)
1515
{
1616
Time = firstNote.Time;
1717
Notes.Add(firstNote);

DryWetMidi/Interaction/Chords/ChordsManagingUtilities.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ internal static int ProcessChordsInternal(
10521052
: null;
10531053

10541054
var chordsBuilder = new ChordsBuilder(settings);
1055-
var chords = chordsBuilder.GetChordsLazy(eventsCollections.GetTimedEventsLazy(eventsCount, settings?.NoteDetectionSettings?.TimedEventDetectionSettings, false), collectedTimedEvents != null, collectedTimedEvents);
1055+
var chords = chordsBuilder.GetChordsLazy(eventsCollections.GetTimedEventsLazy(eventsCount, settings.NoteDetectionSettings?.TimedEventDetectionSettings, false), collectedTimedEvents != null, collectedTimedEvents);
10561056

10571057
foreach (var chordAt in chords)
10581058
{

DryWetMidi/Interaction/GetObjects/GetObjectsUtilities.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,6 @@ private static IEnumerable<ITimedObject> EnumerateObjectsFromSortedTimedObjects(
414414
?? (getChords ? settings.ChordDetectionSettings?.NoteDetectionSettings : null)
415415
?? new NoteDetectionSettings();
416416
var chordDetectionSettings = settings.ChordDetectionSettings ?? new ChordDetectionSettings();
417-
var restDetectionSettings = settings.RestDetectionSettings ?? new RestDetectionSettings();
418417

419418
var timedObjects = processedTimedObjects;
420419

@@ -429,11 +428,6 @@ private static IEnumerable<ITimedObject> EnumerateObjectsFromSortedTimedObjects(
429428

430429
//
431430

432-
var notesLastEndTimes = new Dictionary<object, long>();
433-
var noteDescriptorProvider = NoteDescriptorProviders[restDetectionSettings.RestSeparationPolicy];
434-
var setRestChannel = SetRestChannel[restDetectionSettings.RestSeparationPolicy];
435-
var setRestNoteNumber = SetRestNoteNumber[restDetectionSettings.RestSeparationPolicy];
436-
437431
foreach (var timedObject in timedObjects)
438432
{
439433
var processed = false;

DryWetMidi/Interaction/Notes/NotesManagingUtilities.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ private abstract class NoteOnsHolderBase<TDescriptor> where TDescriptor : IObjec
2222
private readonly Stack<LinkedListNode<TDescriptor>> _nodesStack;
2323
private readonly Queue<LinkedListNode<TDescriptor>> _nodesQueue;
2424

25-
public NoteOnsHolderBase(NoteStartDetectionPolicy noteStartDetectionPolicy)
25+
protected NoteOnsHolderBase(NoteStartDetectionPolicy noteStartDetectionPolicy)
2626
{
2727
switch (noteStartDetectionPolicy)
2828
{
@@ -110,13 +110,13 @@ private interface IObjectDescriptorIndexed : IObjectDescriptor
110110

111111
private class NoteDescriptor : IObjectDescriptor
112112
{
113+
private TimedEvent _noteOnTimedEvent;
114+
113115
public NoteDescriptor(TimedEvent noteOnTimedEvent)
114116
{
115-
NoteOnTimedEvent = noteOnTimedEvent;
117+
_noteOnTimedEvent = noteOnTimedEvent;
116118
}
117119

118-
public TimedEvent NoteOnTimedEvent { get; }
119-
120120
public TimedEvent NoteOffTimedEvent { get; set; }
121121

122122
public bool IsCompleted => NoteOffTimedEvent != null;
@@ -125,9 +125,9 @@ public ITimedObject GetObject(Func<NoteData, Note> constructor)
125125
{
126126
return IsCompleted
127127
? (constructor == null
128-
? new Note(NoteOnTimedEvent, NoteOffTimedEvent, false)
129-
: constructor(new NoteData(NoteOnTimedEvent, NoteOffTimedEvent)))
130-
: (ITimedObject)NoteOnTimedEvent;
128+
? new Note(_noteOnTimedEvent, NoteOffTimedEvent, false)
129+
: constructor(new NoteData(_noteOnTimedEvent, NoteOffTimedEvent)))
130+
: (ITimedObject)_noteOnTimedEvent;
131131
}
132132
}
133133

@@ -166,18 +166,18 @@ public TimedObjectAt<ITimedObject> GetIndexedObject(Func<NoteData, Note> constru
166166

167167
private class TimedEventDescriptor : IObjectDescriptor
168168
{
169+
private TimedEvent _timedEvent;
170+
169171
public TimedEventDescriptor(TimedEvent timedEvent)
170172
{
171-
TimedEvent = timedEvent;
173+
_timedEvent = timedEvent;
172174
}
173175

174-
public TimedEvent TimedEvent { get; }
175-
176176
public bool IsCompleted { get; } = true;
177177

178178
public ITimedObject GetObject(Func<NoteData, Note> constructor)
179179
{
180-
return TimedEvent;
180+
return _timedEvent;
181181
}
182182
}
183183

0 commit comments

Comments
 (0)