diff --git a/MidiPlayer.Droid/MainActivity.cs b/MidiPlayer.Droid/MainActivity.cs index 5073f7c..1df5946 100644 --- a/MidiPlayer.Droid/MainActivity.cs +++ b/MidiPlayer.Droid/MainActivity.cs @@ -34,7 +34,7 @@ public partial class MainActivity : AppCompatActivity { // Constructor public MainActivity() { - _playList = new PlayList(); + _playList = new(); } /////////////////////////////////////////////////////////////////////////////////////////////// @@ -253,7 +253,7 @@ void buttonDeletePlaylist_Click(object sender, EventArgs e) { void buttonSendSynth_1_Click(object sender, EventArgs e) { Log.Info("buttonSendSynth_1 clicked."); try { - var data = new Data() { + Data data = new() { Prog = FindViewById(Resource.Id.number_picker_prog_1).Value, Pan = FindViewById(Resource.Id.number_picker_pan_1).Value, Vol = FindViewById(Resource.Id.number_picker_vol_1).Value, diff --git a/MidiPlayer.FluidSynth/MidiPlayer.FluidSynth.csproj b/MidiPlayer.FluidSynth/MidiPlayer.FluidSynth.csproj index 7bcb40f..e6fdac5 100644 --- a/MidiPlayer.FluidSynth/MidiPlayer.FluidSynth.csproj +++ b/MidiPlayer.FluidSynth/MidiPlayer.FluidSynth.csproj @@ -3,7 +3,7 @@ netstandard2.1 9 - RUNTIME_LINUX + RUNTIME_WINDOWS diff --git a/MidiPlayer.FluidSynth/Synth.cs b/MidiPlayer.FluidSynth/Synth.cs index f8a78ea..897c57b 100644 --- a/MidiPlayer.FluidSynth/Synth.cs +++ b/MidiPlayer.FluidSynth/Synth.cs @@ -317,7 +317,7 @@ static class Multi { // static Constructor static Multi() { - _trackMap = new Map(); + _trackMap = new(); } /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/MidiPlayer.Midi/StandardMidiFile.cs b/MidiPlayer.Midi/StandardMidiFile.cs index ed25715..bc08f5f 100644 --- a/MidiPlayer.Midi/StandardMidiFile.cs +++ b/MidiPlayer.Midi/StandardMidiFile.cs @@ -24,19 +24,19 @@ public class StandardMidiFile { public StandardMidiFile(string target) { try { - _sequence = new Sequence(); + _sequence = new(); _sequence.Format = 1; _sequence.Load(target); Map nameAndMidiChannelMap; - nameAndMidiChannelMap = new Map(); + nameAndMidiChannelMap = new(); Enumerable.Range(0, _sequence.Count).ToList().ForEach(x => { nameAndMidiChannelMap.Add(x, getTrackNameAndMidiChannel(x)); }); - this._nameAndMidiChannelMap = new Map(); + _nameAndMidiChannelMap = new(); var idx = 0; nameAndMidiChannelMap.ToList().ForEach(x => { if (!x.Value.name.Equals("System Setup") && !(x.Value.name.Equals("") && x.Value.channel == -1)) { // no need track - this._nameAndMidiChannelMap.Add(idx++, x.Value); + _nameAndMidiChannelMap.Add(idx++, x.Value); } }); } catch (Exception ex) { diff --git a/MidiPlayer.SoundFont/SoundFont .cs b/MidiPlayer.SoundFont/SoundFont .cs index c8b7671..2109e68 100644 --- a/MidiPlayer.SoundFont/SoundFont .cs +++ b/MidiPlayer.SoundFont/SoundFont .cs @@ -23,19 +23,19 @@ public class SoundFontInfo { public SoundFontInfo(string target) { try { _soundFont = new NAudio.SoundFont.SoundFont(target); - var map = new Map>(); + Map> map = new(); _soundFont.Presets.ToList().ForEach(x => { if (!map.ContainsKey(x.Bank)) { - var newList = new List(); + List newList = new(); newList.Add(new Voice() { Prog = x.PatchNumber, Name = x.Name }); map.Add(x.Bank, newList); // new bank and new voice } else { map[x.Bank].Add(new Voice() { Prog = x.PatchNumber, Name = x.Name }); // exists bank and new voice } }); - this._map = new Map>(); + _map = new(); map.OrderBy(x => x.Key).ToList().ForEach(x => { // sort bank - this._map.Add(x.Key, x.Value.OrderBy(_x => _x.Prog).ToList()); // sort prog + _map.Add(x.Key, x.Value.OrderBy(_x => _x.Prog).ToList()); // sort prog }); } catch (Exception ex) { Log.Error(ex.Message); diff --git a/MidiPlayer.Win64/MainForm.cs b/MidiPlayer.Win64/MainForm.cs index 2939a52..4e3c3c7 100644 --- a/MidiPlayer.Win64/MainForm.cs +++ b/MidiPlayer.Win64/MainForm.cs @@ -29,7 +29,7 @@ public partial class MainForm : Form { public MainForm() { InitializeComponent(); DoubleBuffered = true; - _playList = new PlayList(); + _playList = new(); } /////////////////////////////////////////////////////////////////////////////////////////////// @@ -230,22 +230,22 @@ void initializeControl() { _listView.GridLines = true; _listView.Sorting = SortOrder.None; // do not sort automatically. _listView.View = View.Details; - var column1 = new ColumnHeader(); + ColumnHeader column1 = new(); column1.Text = "On"; column1.Width = 35; - var column2 = new ColumnHeader(); + ColumnHeader column2 = new(); column2.Text = "Name"; column2.Width = 115; - var column3 = new ColumnHeader(); + ColumnHeader column3 = new(); column3.Text = "Voice"; column3.Width = 115; - var column4 = new ColumnHeader(); + ColumnHeader column4 = new(); column4.Text = "Chan"; column4.Width = 45; - var column5 = new ColumnHeader(); + ColumnHeader column5 = new(); column5.Text = "Bank"; column5.Width = 45; - var column6 = new ColumnHeader(); + ColumnHeader column6 = new(); column6.Text = "Prog"; column6.Width = 45; ColumnHeader[] columnHeaderArray = { column1, column2, column3, column4, column5, column6 }; diff --git a/MidiPlayer.sln b/MidiPlayer.sln index f920860..c65aabd 100644 --- a/MidiPlayer.sln +++ b/MidiPlayer.sln @@ -9,7 +9,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MidiPlayer", "MidiPlayer\Mi EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MidiPlayer.FluidSynth", "MidiPlayer.FluidSynth\MidiPlayer.FluidSynth.csproj", "{D63EE98D-8A01-440E-8E7A-B924B41FAFA6}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MidiPlayerTests", "MidiPlayerTests\MidiPlayerTests.csproj", "{0C4ED722-5C23-4C5B-A478-A8D9279C413C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MidiPlayerTest", "MidiPlayerTest\MidiPlayerTest.csproj", "{0C4ED722-5C23-4C5B-A478-A8D9279C413C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MidiPlayer.Win64", "MidiPlayer.Win64\MidiPlayer.Win64.csproj", "{A99AAD96-61C9-481B-8156-DBCD279A742A}" EndProject diff --git a/MidiPlayer/Conf.cs b/MidiPlayer/Conf.cs index 832dc91..20ab5c9 100644 --- a/MidiPlayer/Conf.cs +++ b/MidiPlayer/Conf.cs @@ -49,13 +49,13 @@ public static void Load() { Log.Debug("Conf midiFileDir: " + _json.App.Synth.MidiFileDir); Log.Debug("Conf midiFileName: " + _json.App.Synth.MidiFileName); } else { - Synth synth = new Synth(); + Synth synth = new(); synth.SoundFontDir = "undefined"; synth.MidiFileDir = "undefined"; - App app = new App(); + App app = new(); app.PlayList = null; app.Synth = synth; - _json = new Json(); + _json = new(); _json.App = app; } } diff --git a/MidiPlayer/EventQueue.cs b/MidiPlayer/EventQueue.cs index 720348e..7acd1f4 100644 --- a/MidiPlayer/EventQueue.cs +++ b/MidiPlayer/EventQueue.cs @@ -18,14 +18,14 @@ public class EventQueue { /////////////////////////////////////////////////////////////////////////////////////////////// // static Fields [nouns, noun phrases] - static Map> _queueMap = new Map>(); + static Map> _queueMap = new(); /////////////////////////////////////////////////////////////////////////////////////////////// // static Constructor static EventQueue() { - _queueMap = new Map>(); - Enumerable.Range(0, 16).ToList().ForEach(x => _queueMap.Add(x, new Queue())); + _queueMap = new(); + Enumerable.Range(0, 16).ToList().ForEach(x => _queueMap.Add(x, new())); } /////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/MidiPlayer/Log.cs b/MidiPlayer/Log.cs index d5e9630..81bc856 100644 --- a/MidiPlayer/Log.cs +++ b/MidiPlayer/Log.cs @@ -18,35 +18,35 @@ public static class Log { // public static Methods [verb, verb phrases] public static void Fatal(string target) { - LogEventInfo eventInfo = new LogEventInfo(LogLevel.Fatal, _logger.Name, target); + var eventInfo = new LogEventInfo(LogLevel.Fatal, _logger.Name, target); _logger.Log(typeof(Log), eventInfo); } public static void Error(string target) { - LogEventInfo eventInfo = new LogEventInfo(LogLevel.Error, _logger.Name, target); + var eventInfo = new LogEventInfo(LogLevel.Error, _logger.Name, target); _logger.Log(typeof(Log), eventInfo); } public static void Warn(string target) { - LogEventInfo eventInfo = new LogEventInfo(LogLevel.Warn, _logger.Name, target); + var eventInfo = new LogEventInfo(LogLevel.Warn, _logger.Name, target); _logger.Log(typeof(Log), eventInfo); } public static void Info(string target) { - LogEventInfo eventInfo = new LogEventInfo(LogLevel.Info, _logger.Name, target); + var eventInfo = new LogEventInfo(LogLevel.Info, _logger.Name, target); _logger.Log(typeof(Log), eventInfo); } public static void Debug(string target) { #if DEBUG - LogEventInfo eventInfo = new LogEventInfo(LogLevel.Debug, _logger.Name, target); + var eventInfo = new LogEventInfo(LogLevel.Debug, _logger.Name, target); _logger.Log(typeof(Log), eventInfo); #endif } public static void Trace(string target) { #if DEBUG - LogEventInfo eventInfo = new LogEventInfo(LogLevel.Trace, _logger.Name, target); + var eventInfo = new LogEventInfo(LogLevel.Trace, _logger.Name, target); _logger.Log(typeof(Log), eventInfo); #endif } diff --git a/MidiPlayer/PlayList.cs b/MidiPlayer/PlayList.cs index fb73cd1..cf0ee96 100644 --- a/MidiPlayer/PlayList.cs +++ b/MidiPlayer/PlayList.cs @@ -11,7 +11,7 @@ public class PlayList { /////////////////////////////////////////////////////////////////////////////////////////////// // Fields [nouns, noun phrases] - List _targetList = new List(); + List _targetList = new(); int _idx; diff --git a/MidiPlayerTests/MidiPlayerTests.csproj b/MidiPlayerTest/MidiPlayerTest.csproj similarity index 100% rename from MidiPlayerTests/MidiPlayerTests.csproj rename to MidiPlayerTest/MidiPlayerTest.csproj diff --git a/MidiPlayerTests/NLog.config b/MidiPlayerTest/NLog.config similarity index 100% rename from MidiPlayerTests/NLog.config rename to MidiPlayerTest/NLog.config diff --git a/MidiPlayerTests/NLog.xsd b/MidiPlayerTest/NLog.xsd similarity index 100% rename from MidiPlayerTests/NLog.xsd rename to MidiPlayerTest/NLog.xsd diff --git a/MidiPlayerTests/PlayListTests.cs b/MidiPlayerTest/PlayListTests.cs similarity index 91% rename from MidiPlayerTests/PlayListTests.cs rename to MidiPlayerTest/PlayListTests.cs index be18ace..6a11049 100644 --- a/MidiPlayerTests/PlayListTests.cs +++ b/MidiPlayerTest/PlayListTests.cs @@ -2,13 +2,15 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using static Microsoft.VisualStudio.TestTools.UnitTesting.Assert; -namespace MidiPlayer.Test { +using MidiPlayer; + +namespace MidiPlayerTest { [TestClass()] public class PlayListTests { #nullable enable [TestMethod()] public void NextTest1() { - var target = new PlayList(); + PlayList target = new(); target.Add("file1.mid"); target.Add("file2.mid"); target.Add("file3.mid"); diff --git a/MidiPlayerTests/PrivateObject.cs b/MidiPlayerTest/PrivateObject.cs similarity index 98% rename from MidiPlayerTests/PrivateObject.cs rename to MidiPlayerTest/PrivateObject.cs index e71e3c9..1aa8901 100644 --- a/MidiPlayerTests/PrivateObject.cs +++ b/MidiPlayerTest/PrivateObject.cs @@ -2,7 +2,7 @@ using System; using System.Reflection; -namespace MidiPlayer { +namespace MidiPlayerTest { /// /// PrivateObject for MSTest /// diff --git a/MidiPlayerTests/SoundFontTests.cs b/MidiPlayerTest/SoundFontTests.cs similarity index 91% rename from MidiPlayerTests/SoundFontTests.cs rename to MidiPlayerTest/SoundFontTests.cs index a1388ad..52e872b 100644 --- a/MidiPlayerTests/SoundFontTests.cs +++ b/MidiPlayerTest/SoundFontTests.cs @@ -2,7 +2,9 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using static Microsoft.VisualStudio.TestTools.UnitTesting.Assert; -namespace MidiPlayer.SoundFont.Tests { +using MidiPlayer.SoundFont; + +namespace MidiPlayerTest.SoundFont { [TestClass()] public class SoundFontInfoTests { #nullable enable diff --git a/MidiPlayerTests/StandardMidiFileTests.cs b/MidiPlayerTest/StandardMidiFileTests.cs similarity index 99% rename from MidiPlayerTests/StandardMidiFileTests.cs rename to MidiPlayerTest/StandardMidiFileTests.cs index 4161906..c68715c 100644 --- a/MidiPlayerTests/StandardMidiFileTests.cs +++ b/MidiPlayerTest/StandardMidiFileTests.cs @@ -3,7 +3,7 @@ using static Microsoft.VisualStudio.TestTools.UnitTesting.Assert; using System.Collections.Generic; -namespace MidiPlayer.Midi.Test { +namespace MidiPlayerTest.Midi { [TestClass()] public class StandardMidiFileTests { #nullable enable diff --git a/MidiPlayerTests/SynthTests.cs b/MidiPlayerTest/SynthTests.cs similarity index 98% rename from MidiPlayerTests/SynthTests.cs rename to MidiPlayerTest/SynthTests.cs index a6f43f4..a47eb82 100644 --- a/MidiPlayerTests/SynthTests.cs +++ b/MidiPlayerTest/SynthTests.cs @@ -6,7 +6,9 @@ using System.Threading.Tasks; using static System.Threading.Thread; -namespace MidiPlayer.Test { +using MidiPlayer; + +namespace MidiPlayerTest { [TestClass()] public class SynthTests { #nullable enable diff --git a/MidiPlayerTests/libs/libfluidsynth-2.dll b/MidiPlayerTest/libs/libfluidsynth-2.dll similarity index 100% rename from MidiPlayerTests/libs/libfluidsynth-2.dll rename to MidiPlayerTest/libs/libfluidsynth-2.dll diff --git a/MidiPlayerTests/libs/libglib-2.0-0.dll b/MidiPlayerTest/libs/libglib-2.0-0.dll similarity index 100% rename from MidiPlayerTests/libs/libglib-2.0-0.dll rename to MidiPlayerTest/libs/libglib-2.0-0.dll diff --git a/MidiPlayerTests/libs/libgobject-2.0-0.dll b/MidiPlayerTest/libs/libgobject-2.0-0.dll similarity index 100% rename from MidiPlayerTests/libs/libgobject-2.0-0.dll rename to MidiPlayerTest/libs/libgobject-2.0-0.dll diff --git a/MidiPlayerTests/libs/libgthread-2.0-0.dll b/MidiPlayerTest/libs/libgthread-2.0-0.dll similarity index 100% rename from MidiPlayerTests/libs/libgthread-2.0-0.dll rename to MidiPlayerTest/libs/libgthread-2.0-0.dll diff --git a/MidiPlayerTests/libs/libinstpatch-2.dll b/MidiPlayerTest/libs/libinstpatch-2.dll similarity index 100% rename from MidiPlayerTests/libs/libinstpatch-2.dll rename to MidiPlayerTest/libs/libinstpatch-2.dll diff --git a/MidiPlayerTests/libs/libintl-8.dll b/MidiPlayerTest/libs/libintl-8.dll similarity index 100% rename from MidiPlayerTests/libs/libintl-8.dll rename to MidiPlayerTest/libs/libintl-8.dll diff --git a/MidiPlayerTests/libs/libsndfile-1.dll b/MidiPlayerTest/libs/libsndfile-1.dll similarity index 100% rename from MidiPlayerTests/libs/libsndfile-1.dll rename to MidiPlayerTest/libs/libsndfile-1.dll