Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
melanchall committed Apr 3, 2019
1 parent 672239e commit 9bb8a44
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 17 deletions.
2 changes: 1 addition & 1 deletion DryWetMidi.Tests/Devices/Playback/PlaybackTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private sealed class PlaybackContext

private static readonly PlaybackAction NoPlaybackAction = (context, playback) => { };

private static readonly object[] ParametersForDurationCheck = new[]
private static readonly object[] ParametersForDurationCheck =
{
new object[] { TimeSpan.Zero, TimeSpan.FromSeconds(2) },
new object[] { TimeSpan.FromMilliseconds(500), TimeSpan.FromSeconds(3) },
Expand Down
2 changes: 1 addition & 1 deletion DryWetMidi.Tests/Devices/Recording/RecordingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public sealed class RecordingTests

private const int RetriesNumber = 3;

private static readonly object[] ParametersForDurationCheck = new[]
private static readonly object[] ParametersForDurationCheck =
{
new object[] { TimeSpan.Zero, TimeSpan.FromSeconds(2) },
new object[] { TimeSpan.FromMilliseconds(500), TimeSpan.FromSeconds(3) },
Expand Down
2 changes: 0 additions & 2 deletions DryWetMidi.Tests/Smf.Interaction/Pattern/PatternTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ public void Note_Multiple_MetricLengths()
new NoteInfo(NoteName.B, 2, new MetricTimeSpan(0, 1, 24), new MetricTimeSpan(0, 0, 5)),
});

var tempoMap = midiFile.GetTempoMap();
Assert.AreEqual(new MetricTimeSpan(0, 1, 29), midiFile.GetDuration<MetricTimeSpan>());
}

Expand All @@ -157,7 +156,6 @@ public void Note_Multiple_MetricLengths_TempoChanged()
.Select(i => Tuple.Create(i * 1000L, new Tempo(i * 100 + 10)))
.ToArray());

var tempoMap = midiFile.GetTempoMap();
Assert.AreEqual(new MetricTimeSpan(0, 1, 29).TotalMicroseconds,
midiFile.GetDuration<MetricTimeSpan>().TotalMicroseconds);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public sealed class MetricTimeSpanTests
Tuple.Create(new MetricTimeSpan(10000), new MetricTimeSpan(10000)),
};

private static readonly object[] ParametersForValidParseCheck = new[]
private static readonly object[] ParametersForValidParseCheck =
{
new object[] { "0:0:0:0", new MetricTimeSpan() },
new object[] { "0:0:0", new MetricTimeSpan() },
Expand Down
5 changes: 1 addition & 4 deletions DryWetMidi/Devices/InputDevice/InputDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ public sealed class InputDevice : MidiDevice
private readonly MemoryStream _channelMessageMemoryStream = new MemoryStream(ChannelParametersBufferSize);
private readonly MidiReader _channelEventReader;

private readonly MemoryStream _sysExMessageMemoryStream = new MemoryStream(SysExBufferLength);
private readonly MidiReader _sysExEventReader;
private IntPtr _sysExHeaderPointer = IntPtr.Zero;

private MidiWinApi.MidiMessageCallback _callback;
Expand All @@ -67,11 +65,10 @@ public sealed class InputDevice : MidiDevice

#region Constructor

internal InputDevice(int id)
private InputDevice(int id)
: base(id)
{
_channelEventReader = new MidiReader(_channelMessageMemoryStream);
_sysExEventReader = new MidiReader(_sysExMessageMemoryStream);

SetDeviceInformation();
}
Expand Down
1 change: 0 additions & 1 deletion DryWetMidi/Devices/MidiDeviceException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public sealed class MidiDeviceException : Exception
/// Initializes a new instance of the <see cref="MidiDeviceException"/>.
/// </summary>
public MidiDeviceException()
: base()
{
}

Expand Down
2 changes: 0 additions & 2 deletions DryWetMidi/Devices/OutputDevice/OutputDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ public sealed class OutputDevice : MidiDevice
private const int ChannelEventBufferSize = 3;
private static readonly byte[] ZeroBuffer = new byte[ChannelEventBufferSize];

private const int SysExBufferLength = 2048;

#endregion

#region Events
Expand Down
1 change: 0 additions & 1 deletion DryWetMidi/Devices/Playback/Snapping/PlaybackSnapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Linq;
using Melanchall.DryWetMidi.Common;
using Melanchall.DryWetMidi.Smf.Interaction;
using Melanchall.DryWetMidi.Tools;

namespace Melanchall.DryWetMidi.Devices
{
Expand Down
2 changes: 0 additions & 2 deletions DryWetMidi/Tools/CsvConverter/Common/CsvReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ internal sealed class CsvReader : IDisposable
#region Constants

private const char Quote = '"';
private const string QuoteString = "\"";
private const string DoubleQuote = "\"\"";

#endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private static void WriteRecord(CsvWriter csvWriter,
private static object[] ProcessParameter(object parameter)
{
if (parameter == null)
return new[] { string.Empty };
return new object[] { string.Empty };

var bytes = parameter as byte[];
if (bytes != null)
Expand Down
2 changes: 1 addition & 1 deletion DryWetMidi/Tools/CsvConverter/Notes/NotesToCsvConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static void ConvertToCsv(IEnumerable<Note> notes, Stream stream, TempoMap
{
foreach (var note in notes.Where(n => n != null))
{
csvWriter.WriteRecord(new object[]
csvWriter.WriteRecord(new[]
{
note.TimeAs(settings.TimeType, tempoMap),
note.Channel,
Expand Down

0 comments on commit 9bb8a44

Please sign in to comment.