diff --git a/MidiPlayer.Droid/ListViewAdapter.cs b/MidiPlayer.Droid/ListViewAdapter.cs
index 8049ca2..69a52cd 100644
--- a/MidiPlayer.Droid/ListViewAdapter.cs
+++ b/MidiPlayer.Droid/ListViewAdapter.cs
@@ -1,4 +1,18 @@
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
using Android.Content;
using Android.Views;
using Android.Widget;
@@ -19,6 +33,9 @@ public class ListTitle {
///
/// an Adapter class for ListView.
///
+ ///
+ /// h.adachi (STUDIO MeowToon)
+ ///
public class ListTitleAdapter : ArrayAdapter {
#nullable enable
@@ -37,9 +54,9 @@ public override View GetView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.list_title, parent, false);
viewHolder = new();
- viewHolder.TextViewName = convertView.FindViewById(Resource.Id.text_view_title_name);
- viewHolder.TextViewInstrument = convertView.FindViewById(Resource.Id.text_view_title_instrument);
- viewHolder.TextViewChannel = convertView.FindViewById(Resource.Id.text_view_title_channel);
+ viewHolder.TextViewName = convertView.FindViewById(Resource.Id.textview_title_name);
+ viewHolder.TextViewInstrument = convertView.FindViewById(Resource.Id.textview_title_instrument);
+ viewHolder.TextViewChannel = convertView.FindViewById(Resource.Id.textview_title_channel);
convertView.SetTag(Resource.String.view_holder_tag, viewHolder);
} else {
viewHolder = (ViewHolder) convertView.GetTag(Resource.String.view_holder_tag);
@@ -96,9 +113,9 @@ public override View GetView(int position, View convertView, ViewGroup parent) {
convertView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.list_item, parent, false);
viewHolder = new();
viewHolder.CheckBox = convertView.FindViewById(Resource.Id.checkbox_item_select);
- viewHolder.TextViewName = convertView.FindViewById(Resource.Id.text_view_item_name);
- viewHolder.TextViewInstrument = convertView.FindViewById(Resource.Id.text_view_item_instrument);
- viewHolder.TextViewChannel = convertView.FindViewById(Resource.Id.text_view_item_channel);
+ viewHolder.TextViewName = convertView.FindViewById(Resource.Id.textview_item_name);
+ viewHolder.TextViewInstrument = convertView.FindViewById(Resource.Id.textview_item_instrument);
+ viewHolder.TextViewChannel = convertView.FindViewById(Resource.Id.textview_item_channel);
convertView.SetTag(Resource.String.view_holder_tag, viewHolder);
} else {
viewHolder = (ViewHolder) convertView.GetTag(Resource.String.view_holder_tag);
diff --git a/MidiPlayer.Droid/MainActivity.Component.cs b/MidiPlayer.Droid/MainActivity.Component.cs
index accabdd..d9b487b 100644
--- a/MidiPlayer.Droid/MainActivity.Component.cs
+++ b/MidiPlayer.Droid/MainActivity.Component.cs
@@ -1,4 +1,18 @@
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
using Android.Support.V7.App;
using Android.Widget;
@@ -10,6 +24,9 @@ namespace MidiPlayer.Droid {
///
/// partial class for initialize the component
///
+ ///
+ /// h.adachi (STUDIO MeowToon)
+ ///
public partial class MainActivity : AppCompatActivity {
#nullable enable
@@ -22,21 +39,21 @@ public partial class MainActivity : AppCompatActivity {
///////////////////////////////////////////////////////////////////////////////////////////////
// Fields [nouns, noun phrases]
- Button _buttonloadSoundFont;
- Button _buttonloadMidiFile;
- Button _buttonStart;
- Button _buttonStop;
- Button _buttonAddPlaylist;
- Button _buttonDeletePlaylist;
- Button _buttonSendSynth;
- TextView _textViewNo;
- TextView _textViewChannel;
- NumberPicker _numberPickerProg;
- NumberPicker _numberPickerPan;
- NumberPicker _numberPickerVol;
- CheckBox _checkBoxMute;
- ListView _titleListView;
- ListView _itemListView;
+ Button _button_load_soundfont;
+ Button _button_load_midi_file;
+ Button _button_start;
+ Button _button_stop;
+ Button _button_add_playlist;
+ Button _button_delete_playlist;
+ Button _button_send_synth;
+ TextView _textview_no;
+ TextView _textview_channel;
+ NumberPicker _numberpicker_prog;
+ NumberPicker _numberpicker_pan;
+ NumberPicker _numberpicker_vol;
+ CheckBox _checkbox_mute;
+ ListView _listview_title;
+ ListView _listview_item;
///////////////////////////////////////////////////////////////////////////////////////////////
// private Methods [verb, verb phrases]
@@ -49,9 +66,9 @@ void initializeComponent() {
///
/// buttonLoadSoundFont
///
- _buttonloadSoundFont = FindViewById(Resource.Id.button_load_soundfont);
- _buttonloadSoundFont.Click += (object sender, EventArgs e) => {
- Log.Info("buttonLoadSoundFont clicked.");
+ _button_load_soundfont = FindViewById(Resource.Id.button_load_soundfont);
+ _button_load_soundfont.Click += (object sender, EventArgs e) => {
+ Log.Info("_button_load_soundfont clicked.");
try {
if (Synth.Playing) {
stopSong();
@@ -65,9 +82,9 @@ void initializeComponent() {
///
/// buttonLoadMidiFile
///
- _buttonloadMidiFile = FindViewById(Resource.Id.button_load_midifile);
- _buttonloadMidiFile.Click += (object sender, EventArgs e) => {
- Log.Info("buttonLoadMidiFile clicked.");
+ _button_load_midi_file = FindViewById(Resource.Id.button_load_midi_file);
+ _button_load_midi_file.Click += (object sender, EventArgs e) => {
+ Log.Info("_button_load_midi_file clicked.");
try {
if (Synth.Playing) {
stopSong();
@@ -81,11 +98,11 @@ void initializeComponent() {
///
/// buttonStart
///
- _buttonStart = FindViewById(Resource.Id.button_start);
- _buttonStart.Click += (object sender, EventArgs e) => {
- Log.Info("buttonStart clicked.");
+ _button_start = FindViewById(Resource.Id.button_start);
+ _button_start.Click += (object sender, EventArgs e) => {
+ Log.Info("_button_start clicked.");
try {
- if (!_midiFilePath.HasValue()) { // FIXME: case sounFdont
+ if (!_midi_file_path.HasValue()) { // FIXME: case sounFdont
Log.Warn("midiFilePath has no value.");
return;
}
@@ -98,9 +115,9 @@ void initializeComponent() {
///
/// buttonStop
///
- _buttonStop = FindViewById(Resource.Id.button_stop);
- _buttonStop.Click += (object sender, EventArgs e) => {
- Log.Info("buttonStop clicked.");
+ _button_stop = FindViewById(Resource.Id.button_stop);
+ _button_stop.Click += (object sender, EventArgs e) => {
+ Log.Info("_button_stop clicked.");
try {
stopSong();
} catch (Exception ex) {
@@ -111,9 +128,9 @@ void initializeComponent() {
///
/// buttonAddPlaylist
///
- _buttonAddPlaylist = FindViewById(Resource.Id.button_add_playlist);
- _buttonAddPlaylist.Click += (object sender, EventArgs e) => {
- Log.Info("buttonAddPlaylist clicked.");
+ _button_add_playlist = FindViewById(Resource.Id.button_add_playlist);
+ _button_add_playlist.Click += (object sender, EventArgs e) => {
+ Log.Info("_button_add_playlist clicked.");
try {
callIntent(Env.MidiFileDir, (int) Request.AddPlayList);
} catch (Exception ex) {
@@ -124,11 +141,11 @@ void initializeComponent() {
///
/// buttonDeletePlaylist
///
- _buttonDeletePlaylist = FindViewById(Resource.Id.button_delete_playlist);
- _buttonDeletePlaylist.Click += (object sender, EventArgs e) => {
- Log.Info("buttonDeletePlaylist clicked.");
+ _button_delete_playlist = FindViewById(Resource.Id.button_delete_playlist);
+ _button_delete_playlist.Click += (object sender, EventArgs e) => {
+ Log.Info("_button_delete_playlist clicked.");
try {
- _playList.Clear();
+ _playlist.Clear();
} catch (Exception ex) {
Log.Error(ex.Message);
}
@@ -137,9 +154,9 @@ void initializeComponent() {
///
/// buttonSendSynth
///
- _buttonSendSynth = FindViewById(Resource.Id.button_send_synth);
- _buttonSendSynth.Click += (object sender, EventArgs e) => {
- Log.Info("buttonSendSynth clicked.");
+ _button_send_synth = FindViewById(Resource.Id.button_send_synth);
+ _button_send_synth.Click += (object sender, EventArgs e) => {
+ Log.Info("_button_send_synth clicked.");
try {
Mixer.Fader fader = Mixer.GetCurrent();
Log.Debug($"track index {fader.Index}: send a data to MIDI {fader.Channel} channel.");
@@ -160,74 +177,74 @@ void initializeComponent() {
///
/// textViewNo, textViewChannel
///
- _textViewNo = FindViewById(Resource.Id.text_view_no);
- _textViewChannel = FindViewById(Resource.Id.text_view_channel);
+ _textview_no = FindViewById(Resource.Id.textview_no);
+ _textview_channel = FindViewById(Resource.Id.textview_channel);
///
/// numberPickerProg
///
- _numberPickerProg = FindViewById(Resource.Id.number_picker_prog);
- _numberPickerProg.MinValue = 1;
- _numberPickerProg.MaxValue = 128;
- _numberPickerProg.ValueChanged += (object sender, NumberPicker.ValueChangeEventArgs e) => {
+ _numberpicker_prog = FindViewById(Resource.Id.numberpicker_prog);
+ _numberpicker_prog.MinValue = 1;
+ _numberpicker_prog.MaxValue = 128;
+ _numberpicker_prog.ValueChanged += (object sender, NumberPicker.ValueChangeEventArgs e) => {
var fader = Mixer.GetCurrent();
- Log.Debug($"_numberPickerProg.Value: {_numberPickerProg.Value}");
- fader.ProgramAsOneBased = _numberPickerProg.Value;
+ Log.Debug($"_numberpicker_prog.Value: {_numberpicker_prog.Value}");
+ fader.ProgramAsOneBased = _numberpicker_prog.Value;
};
///
- /// numberPickerPan
+ /// _numberpicker_pan
///
- _numberPickerPan = FindViewById(Resource.Id.number_picker_pan);
- _numberPickerPan.MinValue = 1;
- _numberPickerPan.MaxValue = 128;
- _numberPickerPan.Value = 65;
- _numberPickerPan.ValueChanged += (object sender, NumberPicker.ValueChangeEventArgs e) => {
+ _numberpicker_pan = FindViewById(Resource.Id.numberpicker_pan);
+ _numberpicker_pan.MinValue = 1;
+ _numberpicker_pan.MaxValue = 128;
+ _numberpicker_pan.Value = 65;
+ _numberpicker_pan.ValueChanged += (object sender, NumberPicker.ValueChangeEventArgs e) => {
var fader = Mixer.GetCurrent();
- Log.Debug($"_numberPickerPan.Value: {_numberPickerPan.Value}");
- fader.Pan = _numberPickerPan.Value;
+ Log.Debug($"_numberpicker_pan.Value: {_numberpicker_pan.Value}");
+ fader.Pan = _numberpicker_pan.Value;
};
///
- /// numberPickerVol
+ /// _numberpicker_vol
///
- _numberPickerVol = FindViewById(Resource.Id.number_picker_vol);
- _numberPickerVol.MinValue = 1;
- _numberPickerVol.MaxValue = 128;
- _numberPickerVol.Value = 104;
- _numberPickerVol.ValueChanged += (object sender, NumberPicker.ValueChangeEventArgs e) => {
+ _numberpicker_vol = FindViewById(Resource.Id.numberpicker_vol);
+ _numberpicker_vol.MinValue = 1;
+ _numberpicker_vol.MaxValue = 128;
+ _numberpicker_vol.Value = 104;
+ _numberpicker_vol.ValueChanged += (object sender, NumberPicker.ValueChangeEventArgs e) => {
var fader = Mixer.GetCurrent();
- Log.Debug($"_numberPickerVol.Value: {_numberPickerVol.Value}");
- fader.Volume = _numberPickerVol.Value;
+ Log.Debug($"_numberpicker_vol.Value: {_numberpicker_vol.Value}");
+ fader.Volume = _numberpicker_vol.Value;
};
///
- /// checkBoxMute
+ /// _checkbox_mute
///
- _checkBoxMute = FindViewById(Resource.Id.check_box_mute);
- _checkBoxMute.CheckedChange += (object sender, CheckBox.CheckedChangeEventArgs e) => {
+ _checkbox_mute = FindViewById(Resource.Id.checkbox_mute);
+ _checkbox_mute.CheckedChange += (object sender, CheckBox.CheckedChangeEventArgs e) => {
var fader = Mixer.GetCurrent();
- fader.Sounds = !_checkBoxMute.Checked;
+ fader.Sounds = !_checkbox_mute.Checked;
};
///
- /// titleListView
+ /// _listview_title
///
- var titleList = new List();
- titleList.Add(new ListTitle() { Name = "Name", Instrument = "Voice", Channel = "Ch" });
- _titleListView = FindViewById(Resource.Id.list_view_title);
- _titleListView.Adapter = new ListTitleAdapter(this, 0, titleList);
+ var listtitle_list = new List();
+ listtitle_list.Add(new ListTitle() { Name = "Name", Instrument = "Voice", Channel = "Ch" });
+ _listview_title = FindViewById(Resource.Id.listview_title);
+ _listview_title.Adapter = new ListTitleAdapter(this, 0, listtitle_list);
///
- /// itemListView
+ /// _listview_item
///
Enumerable.Range(MIDI_TRACK_BASE, MIDI_TRACK_COUNT).ToList().ForEach(x => {
- _itemList.Add(new ListItem() { Name = "------", Instrument = "------", Channel = "---" });
+ _listitem_list.Add(new ListItem() { Name = "------", Instrument = "------", Channel = "---" });
});
- _itemListView = FindViewById(Resource.Id.list_view_item);
- var listItemAdapter = new ListItemAdapter(this, 0, _itemList);
- _itemListView.Adapter = listItemAdapter;
- _itemListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => {
+ _listview_item = FindViewById(Resource.Id.listview_item);
+ var listitem_adapter = new ListItemAdapter(this, 0, _listitem_list);
+ _listview_item.Adapter = listitem_adapter;
+ _listview_item.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => {
Log.Debug($"setected: {e.Position}");
Mixer.Current = e.Position;
};
diff --git a/MidiPlayer.Droid/MainActivity.cs b/MidiPlayer.Droid/MainActivity.cs
index 2c363eb..fa4f433 100644
--- a/MidiPlayer.Droid/MainActivity.cs
+++ b/MidiPlayer.Droid/MainActivity.cs
@@ -1,4 +1,18 @@
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
using Android;
using Android.App;
using Android.Content;
@@ -18,7 +32,12 @@
using Xamarin.Essentials;
namespace MidiPlayer.Droid {
-
+ ///
+ /// partial class for MainActivity.
+ ///
+ ///
+ /// h.adachi (STUDIO MeowToon)
+ ///
[Activity(
Label = "@string/app_name",
Theme = "@style/Base.Theme.MaterialComponents.Light.DarkActionBar.Bridge",
@@ -37,23 +56,23 @@ public partial class MainActivity : AppCompatActivity {
///////////////////////////////////////////////////////////////////////////////////////////////
// Fields [nouns, noun phrases]
- string _soundFontPath = "undefined";
+ string _sound_font_path = "undefined";
- string _midiFilePath = "undefined";
+ string _midi_file_path = "undefined";
- PlayList _playList;
+ PlayList _playlist;
- List _itemList;
+ List _listitem_list;
- Task _refreshTimer;
+ Task _refresh_timer;
///////////////////////////////////////////////////////////////////////////////////////////////
// Constructor
public MainActivity() {
- _playList = new();
- _itemList = new();
- _refreshTimer = createRefreshTask();
+ _playlist = new();
+ _listitem_list = new();
+ _refresh_timer = createRefreshTask();
}
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -80,7 +99,7 @@ protected override void OnCreate(Bundle? savedInstanceState) {
initializeComponent();
Conf.Load();
loadPreviousSetting();
- _refreshTimer.Start();
+ _refresh_timer.Start();
///
/// add a callback function to be called when the synth is playback.
@@ -94,7 +113,7 @@ protected override void OnCreate(Bundle? savedInstanceState) {
///
Synth.Started += () => {
Log.Info("Started called.");
- MainThread.BeginInvokeOnMainThread(() => {
+ MainThread.BeginInvokeOnMainThread(action: () => {
Title = $"MidiPlayer: {Synth.MidiFilePath.ToFileName()} {Synth.SoundFontPath.ToFileName()}";
});
initializeListItem();
@@ -105,12 +124,12 @@ protected override void OnCreate(Bundle? savedInstanceState) {
///
Synth.Ended += () => {
Log.Info("Ended called.");
- if (!_playList.Ready) {
+ if (!_playlist.Ready) {
Synth.Stop();
Synth.Start();
} else {
Synth.Stop();
- Synth.MidiFilePath = _playList.Next;
+ Synth.MidiFilePath = _playlist.Next;
Synth.Start();
}
};
@@ -123,10 +142,10 @@ protected override void OnCreate(Bundle? savedInstanceState) {
///
Synth.Updated += (object sender, PropertyChangedEventArgs e) => {
var track = (Synth.Track) sender;
- ListItem listItem = _itemList[track.IndexWithExcludingConductor];
- listItem.Name = track.Name;
- listItem.Instrument = Synth.GetVoice(track.Index);
- listItem.Channel = track.ChannelAsOneBased.ToString();
+ ListItem list_item = _listitem_list[track.IndexWithExcludingConductor];
+ list_item.Name = track.Name;
+ list_item.Instrument = Synth.GetVoice(track.Index);
+ list_item.Channel = track.ChannelAsOneBased.ToString();
};
///
@@ -162,12 +181,12 @@ protected override void OnCreate(Bundle? savedInstanceState) {
Mixer.Selected += (object sender, PropertyChangedEventArgs e) => {
if (e.PropertyName is nameof(Mixer.Current)) {
Mixer.Fader fader = Mixer.GetCurrent();
- _textViewNo.Text = fader.IndexAsOneBased.ToString();
- _textViewChannel.Text = fader.ChannelAsOneBased.ToString();
- _numberPickerProg.Value = fader.ProgramAsOneBased;
- _numberPickerPan.Value = fader.Pan;
- _numberPickerVol.Value = fader.Volume;
- _checkBoxMute.Checked = !fader.Sounds;
+ _textview_no.Text = fader.IndexAsOneBased.ToString();
+ _textview_channel.Text = fader.ChannelAsOneBased.ToString();
+ _numberpicker_prog.Value = fader.ProgramAsOneBased;
+ _numberpicker_pan.Value = fader.Pan;
+ _numberpicker_vol.Value = fader.Volume;
+ _checkbox_mute.Checked = !fader.Sounds;
}
};
@@ -244,36 +263,36 @@ protected override void OnDestroy() {
protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent? data) {
switch (requestCode) {
case (int) Request.SoundFont:
- _soundFontPath = getActualPathBy(data);
- if (!(_soundFontPath.Contains(".SF2") || _soundFontPath.Contains(".sf2"))) {
+ _sound_font_path = getActualPathBy(data);
+ if (!(_sound_font_path.Contains(".SF2") || _sound_font_path.Contains(".sf2"))) {
Log.Warn("not a sound font.");
break;
}
- Log.Info($"selected: {_soundFontPath}");
- Synth.SoundFontPath = _soundFontPath;
- Env.SoundFontPath = _soundFontPath;
- Title = $"MidiPlayer: {_midiFilePath.ToFileName()} {_soundFontPath.ToFileName()}";
+ Log.Info($"selected: {_sound_font_path}");
+ Synth.SoundFontPath = _sound_font_path;
+ Env.SoundFontPath = _sound_font_path;
+ Title = $"MidiPlayer: {_midi_file_path.ToFileName()} {_sound_font_path.ToFileName()}";
break;
case (int) Request.MidiFile:
- _midiFilePath = getActualPathBy(data);
- if (!(_midiFilePath.Contains(".MID") || _midiFilePath.Contains(".mid"))) {
+ _midi_file_path = getActualPathBy(data);
+ if (!(_midi_file_path.Contains(".MID") || _midi_file_path.Contains(".mid"))) {
Log.Warn("not a midi file.");
break;
}
- Log.Info($"selected: {_midiFilePath}");
- Synth.MidiFilePath = _midiFilePath;
- Env.MidiFilePath = _midiFilePath;
- Title = $"MidiPlayer: {_midiFilePath.ToFileName()} {_soundFontPath.ToFileName()}";
+ Log.Info($"selected: {_midi_file_path}");
+ Synth.MidiFilePath = _midi_file_path;
+ Env.MidiFilePath = _midi_file_path;
+ Title = $"MidiPlayer: {_midi_file_path.ToFileName()} {_sound_font_path.ToFileName()}";
break;
case (int) Request.AddPlayList:
- var midiFilePath = getActualPathBy(data);
- if (!(midiFilePath.Contains(".MID") || midiFilePath.Contains(".mid"))) {
+ var midi_file_path = getActualPathBy(data);
+ if (!(midi_file_path.Contains(".MID") || midi_file_path.Contains(".mid"))) {
Log.Warn("not a midi file.");
break;
}
- Log.Info($"selected: {midiFilePath}");
- _playList.Add(midiFilePath); // add to playlist
- Env.MidiFilePath = midiFilePath;
+ Log.Info($"selected: {midi_file_path}");
+ _playlist.Add(midi_file_path); // add to playlist
+ Env.MidiFilePath = midi_file_path;
break;
default:
break;
@@ -298,15 +317,15 @@ void requestPermissions() {
///
/// call Intent.
///
- void callIntent(string targetDir, int requestCode) {
+ void callIntent(string target_dir, int request_code) {
var intent = new Intent(Intent.ActionOpenDocument);
- var uri = Android.Net.Uri.Parse($"content://com.android.externalstorage.documents/document/primary%3A{targetDir}");
+ var uri = Android.Net.Uri.Parse($"content://com.android.externalstorage.documents/document/primary%3A{target_dir}");
intent.SetData(uri);
intent.SetType("*/*");
intent.PutExtra("android.provider.extra.INITIAL_URI", uri);
intent.PutExtra("android.content.extra.SHOW_ADVANCED", true);
intent.AddCategory(Intent.CategoryOpenable);
- StartActivityForResult(intent, requestCode);
+ StartActivityForResult(intent, request_code);
}
///
@@ -314,13 +333,13 @@ void callIntent(string targetDir, int requestCode) {
///
static string getActualPathBy(Intent data) {
var uri = data.Data;
- string docId = DocumentsContract.GetDocumentId(uri);
- char[] charArray = { ':' };
- string[] stringArray = docId.Split(charArray);
- string type = stringArray[0]; // primary
- string path = "";
+ string doc_id = DocumentsContract.GetDocumentId(uri);
+ char[] char_array = { ':' };
+ string[] string_array = doc_id.Split(char_array);
+ string type = string_array[0]; // primary
+ string path = string.Empty;
if ("primary".Equals(type, StringComparison.OrdinalIgnoreCase)) {
- path = Android.OS.Environment.ExternalStorageDirectory + "/" + stringArray[1];
+ path = Android.OS.Environment.ExternalStorageDirectory + "/" + string_array[1];
}
return path;
}
@@ -333,8 +352,8 @@ void loadPreviousSetting() {
Synth.SoundFontPath = Env.SoundFontPath;
Synth.MidiFilePath = Env.MidiFilePath;
Title = $"MidiPlayer: {Synth.MidiFilePath.ToFileName()} {Synth.SoundFontPath.ToFileName()}";
- _soundFontPath = Env.SoundFontPath;
- _midiFilePath = Env.MidiFilePath;
+ _sound_font_path = Env.SoundFontPath;
+ _midi_file_path = Env.MidiFilePath;
}
}
@@ -343,16 +362,16 @@ void loadPreviousSetting() {
///
async void playSong() {
try {
- await Task.Run(() => {
- if (!_playList.Ready) {
- Synth.MidiFilePath = _midiFilePath;
+ await Task.Run(action: () => {
+ if (!_playlist.Ready) {
+ Synth.MidiFilePath = _midi_file_path;
Synth.Start();
} else {
- Synth.MidiFilePath = _playList.Next;
+ Synth.MidiFilePath = _playlist.Next;
Synth.Start();
}
});
- logMemoryInro();
+ logMemoryInfo();
} catch (Exception ex) {
Log.Error(ex.Message);
}
@@ -363,10 +382,10 @@ await Task.Run(() => {
///
async void stopSong() {
try {
- await Task.Run(() => Synth.Stop());
- Conf.Value.PlayList = _playList.List; // TODO: save
+ await Task.Run(action: () => Synth.Stop());
+ Conf.Value.PlayList = _playlist.List; // TODO: save
Conf.Save(); // TODO: save
- logMemoryInro();
+ logMemoryInfo();
} catch (Exception ex) {
Log.Error(ex.Message);
}
@@ -376,11 +395,11 @@ async void stopSong() {
/// refresh the view in a few seconds.
///
Task createRefreshTask() {
- return new(async () => {
- var listItemAdapter = (ListItemAdapter) _itemListView.Adapter;
+ return new(action: async () => {
+ var listitem_adapter = (ListItemAdapter) _listview_item.Adapter;
while (true) {
- RunOnUiThread(() => {
- listItemAdapter.NotifyDataSetChanged();
+ RunOnUiThread(action: () => {
+ listitem_adapter.NotifyDataSetChanged();
});
await Task.Delay(VIEW_REFRESH_TIME);
}
@@ -391,27 +410,29 @@ Task createRefreshTask() {
/// initialize listItem.
///
void initializeListItem() {
- Enumerable.Range(MIDI_TRACK_BASE, MIDI_TRACK_COUNT).ToList().ForEach(x => {
- var listItem = _itemList[x];
- listItem.Name = "------"; listItem.Instrument = "------"; listItem.Channel = "---";
+ Enumerable.Range(start: MIDI_TRACK_BASE, count: MIDI_TRACK_COUNT).ToList().ForEach(x => {
+ var listitem = _listitem_list[x];
+ listitem.Name = "------"; listitem.Instrument = "------"; listitem.Channel = "---";
});
}
///
/// show memory information to log.
- /// FIXME: delete
///
- static void logMemoryInro() {
+ ///
+ /// development
+ ///
+ static void logMemoryInfo() {
// JVM runtime.
- var jvmMaxMemory = Java.Lang.Runtime.GetRuntime().MaxMemory();
- var jvmFreeMemory = Java.Lang.Runtime.GetRuntime().FreeMemory();
- var jvmTotalMemory = Java.Lang.Runtime.GetRuntime().TotalMemory();
- Log.Debug($"JVM maxMemory: {jvmMaxMemory.ToMegabytes()}MB");
- Log.Debug($"JVM freeMemory: {jvmFreeMemory.ToMegabytes()}MB");
- Log.Debug($"JVM totalMemory: {jvmTotalMemory.ToMegabytes()}MB");
+ var jvm_max_memory = Java.Lang.Runtime.GetRuntime().MaxMemory();
+ var jvm_free_memory = Java.Lang.Runtime.GetRuntime().FreeMemory();
+ var jvm_total_memory = Java.Lang.Runtime.GetRuntime().TotalMemory();
+ Log.Debug($"JVM max memory: {jvm_max_memory.ToMegabytes()}MB");
+ Log.Debug($"JVM free memory: {jvm_free_memory.ToMegabytes()}MB");
+ Log.Debug($"JVM total memory: {jvm_total_memory.ToMegabytes()}MB");
// Mono runtime.
- var monoTotalMemory = GC.GetTotalMemory(false);
- Log.Debug($"Mono totalMemory: {monoTotalMemory.ToMegabytes()}MB");
+ var mono_total_memory = GC.GetTotalMemory(false);
+ Log.Debug($"Mono total memory: {mono_total_memory.ToMegabytes()}MB");
}
}
}
diff --git a/MidiPlayer.Droid/Resources/Resource.designer.cs b/MidiPlayer.Droid/Resources/Resource.designer.cs
index fcf88cf..b14a1e9 100644
--- a/MidiPlayer.Droid/Resources/Resource.designer.cs
+++ b/MidiPlayer.Droid/Resources/Resource.designer.cs
@@ -5665,7 +5665,7 @@ public partial class Id
public const int button_delete_playlist = 2131230814;
// aapt resource value: 0x7F08005F
- public const int button_load_midifile = 2131230815;
+ public const int button_load_midi_file = 2131230815;
// aapt resource value: 0x7F080060
public const int button_load_soundfont = 2131230816;
@@ -5700,18 +5700,18 @@ public partial class Id
// aapt resource value: 0x7F08006A
public const int chains = 2131230826;
+ // aapt resource value: 0x7F08006B
+ public const int checkbox = 2131230827;
+
// aapt resource value: 0x7F08006C
- public const int checkbox = 2131230828;
+ public const int checkbox_item_select = 2131230828;
// aapt resource value: 0x7F08006D
- public const int checkbox_item_select = 2131230829;
+ public const int checkbox_mute = 2131230829;
// aapt resource value: 0x7F08006E
public const int @checked = 2131230830;
- // aapt resource value: 0x7F08006B
- public const int check_box_mute = 2131230827;
-
// aapt resource value: 0x7F08006F
public const int chip = 2131230831;
@@ -6051,14 +6051,14 @@ public partial class Id
// aapt resource value: 0x7F0800DD
public const int listMode = 2131230941;
- // aapt resource value: 0x7F0800DE
- public const int list_item = 2131230942;
-
// aapt resource value: 0x7F0800DF
- public const int list_view_item = 2131230943;
+ public const int listview_item = 2131230943;
// aapt resource value: 0x7F0800E0
- public const int list_view_title = 2131230944;
+ public const int listview_title = 2131230944;
+
+ // aapt resource value: 0x7F0800DE
+ public const int list_item = 2131230942;
// aapt resource value: 0x7F0800E1
public const int masked = 2131230945;
@@ -6253,13 +6253,13 @@ public partial class Id
public const int NO_DEBUG = 2131230726;
// aapt resource value: 0x7F08011F
- public const int number_picker_pan = 2131231007;
+ public const int numberpicker_pan = 2131231007;
// aapt resource value: 0x7F080120
- public const int number_picker_prog = 2131231008;
+ public const int numberpicker_prog = 2131231008;
// aapt resource value: 0x7F080121
- public const int number_picker_vol = 2131231009;
+ public const int numberpicker_vol = 2131231009;
// aapt resource value: 0x7F080122
public const int off = 2131231010;
@@ -6612,23 +6612,23 @@ public partial class Id
// aapt resource value: 0x7F080191
public const int textEnd = 2131231121;
- // aapt resource value: 0x7F0801A1
- public const int textinput_counter = 2131231137;
+ // aapt resource value: 0x7F080199
+ public const int textinput_counter = 2131231129;
- // aapt resource value: 0x7F0801A2
- public const int textinput_error = 2131231138;
+ // aapt resource value: 0x7F08019A
+ public const int textinput_error = 2131231130;
- // aapt resource value: 0x7F0801A3
- public const int textinput_helper_text = 2131231139;
+ // aapt resource value: 0x7F08019B
+ public const int textinput_helper_text = 2131231131;
- // aapt resource value: 0x7F0801A4
- public const int textinput_placeholder = 2131231140;
+ // aapt resource value: 0x7F08019C
+ public const int textinput_placeholder = 2131231132;
- // aapt resource value: 0x7F0801A5
- public const int textinput_prefix_text = 2131231141;
+ // aapt resource value: 0x7F08019D
+ public const int textinput_prefix_text = 2131231133;
- // aapt resource value: 0x7F0801A6
- public const int textinput_suffix_text = 2131231142;
+ // aapt resource value: 0x7F08019E
+ public const int textinput_suffix_text = 2131231134;
// aapt resource value: 0x7F080192
public const int textSpacerNoButtons = 2131231122;
@@ -6642,38 +6642,38 @@ public partial class Id
// aapt resource value: 0x7F080195
public const int textTop = 2131231125;
- // aapt resource value: 0x7F080196
- public const int text_input_end_icon = 2131231126;
+ // aapt resource value: 0x7F08019F
+ public const int textview_channel = 2131231135;
- // aapt resource value: 0x7F080197
- public const int text_input_error_icon = 2131231127;
+ // aapt resource value: 0x7F0801A0
+ public const int textview_item_channel = 2131231136;
- // aapt resource value: 0x7F080198
- public const int text_input_start_icon = 2131231128;
+ // aapt resource value: 0x7F0801A1
+ public const int textview_item_instrument = 2131231137;
- // aapt resource value: 0x7F080199
- public const int text_view_channel = 2131231129;
+ // aapt resource value: 0x7F0801A2
+ public const int textview_item_name = 2131231138;
- // aapt resource value: 0x7F08019A
- public const int text_view_item_channel = 2131231130;
+ // aapt resource value: 0x7F0801A3
+ public const int textview_no = 2131231139;
- // aapt resource value: 0x7F08019B
- public const int text_view_item_instrument = 2131231131;
+ // aapt resource value: 0x7F0801A4
+ public const int textview_title_channel = 2131231140;
- // aapt resource value: 0x7F08019C
- public const int text_view_item_name = 2131231132;
+ // aapt resource value: 0x7F0801A5
+ public const int textview_title_instrument = 2131231141;
- // aapt resource value: 0x7F08019D
- public const int text_view_no = 2131231133;
+ // aapt resource value: 0x7F0801A6
+ public const int textview_title_name = 2131231142;
- // aapt resource value: 0x7F08019E
- public const int text_view_title_channel = 2131231134;
+ // aapt resource value: 0x7F080196
+ public const int text_input_end_icon = 2131231126;
- // aapt resource value: 0x7F08019F
- public const int text_view_title_instrument = 2131231135;
+ // aapt resource value: 0x7F080197
+ public const int text_input_error_icon = 2131231127;
- // aapt resource value: 0x7F0801A0
- public const int text_view_title_name = 2131231136;
+ // aapt resource value: 0x7F080198
+ public const int text_input_start_icon = 2131231128;
// aapt resource value: 0x7F0801A7
public const int time = 2131231143;
diff --git a/MidiPlayer.Droid/Resources/layout/activity_main.xml b/MidiPlayer.Droid/Resources/layout/activity_main.xml
index a58f54e..f67cdff 100644
--- a/MidiPlayer.Droid/Resources/layout/activity_main.xml
+++ b/MidiPlayer.Droid/Resources/layout/activity_main.xml
@@ -27,7 +27,7 @@
android:layout_weight="1"
/>
@@ -104,7 +104,7 @@
android:id="@+id/table_row_track"
android:layout_width="match_parent"
android:layout_height="25dp"
- android:layout_below="@id/list_view_item"
+ android:layout_below="@id/listview_item"
android:background="@android:color/holo_blue_light">
.
+ */
+
using System.Runtime.InteropServices;
using void_ptr = System.IntPtr;
using fluid_settings_t = System.IntPtr;
@@ -8,7 +22,12 @@
using fluid_midi_event_t = System.IntPtr;
namespace NativeFuncs {
-
+ ///
+ /// class for Fluidsynth API definitions.
+ ///
+ ///
+ /// h.adachi (STUDIO MeowToon)
+ ///
internal static class Fluidsynth {
#nullable enable
diff --git a/MidiPlayer.FluidSynth/Synth.cs b/MidiPlayer.FluidSynth/Synth.cs
index 81a2ecb..d07d44e 100644
--- a/MidiPlayer.FluidSynth/Synth.cs
+++ b/MidiPlayer.FluidSynth/Synth.cs
@@ -1,4 +1,18 @@
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -16,7 +30,12 @@
using MidiPlayer.SoundFont;
namespace MidiPlayer {
-
+ ///
+ /// the synth class.
+ ///
+ ///
+ /// h.adachi (STUDIO MeowToon)
+ ///
public class Synth {
#nullable enable
@@ -54,21 +73,21 @@ public class Synth {
static handle_midi_event_func_t _event_callback;
- static Func _onPlaybacking;
+ static Func _on_playbacking;
- static Action _onStarted;
+ static Action _on_started;
- static Action _onEnded;
+ static Action _on_ended;
- static PropertyChangedEventHandler _onUpdated;
+ static PropertyChangedEventHandler _on_updated;
- static string _soundFontPath = string.Empty;
+ static string _sound_font_path = string.Empty;
- static string _midiFilePath = string.Empty;
+ static string _midi_file_path = string.Empty;
- static SoundFontInfo _soundFontInfo;
+ static SoundFontInfo _sound_font_info;
- static StandardMidiFile _standardMidiFile;
+ static StandardMidiFile _standard_midi_file;
static bool _ready = false;
@@ -78,7 +97,7 @@ public class Synth {
// static Constructor
static Synth() {
- _onPlaybacking += (void_ptr data, fluid_midi_event_t evt) => {
+ _on_playbacking += (void_ptr data, fluid_midi_event_t evt) => {
var type = fluid_midi_event_get_type(evt);
var channel = fluid_midi_event_get_channel(evt);
var control = fluid_midi_event_get_control(evt);
@@ -98,18 +117,18 @@ static Synth() {
Multi.ApplyControlChange(channel, control, value);
}
});
- Enumerable.Range(MIDI_TRACK_BASE, MIDI_TRACK_COUNT).ToList().ForEach(trackIdx => {
- var eventData = EventQueue.Dequeue(trackIdx);
- if (eventData is not null) {
- fluid_synth_program_change(_synth, eventData.Channel, eventData.Program);
- fluid_synth_cc(_synth, eventData.Channel, (int) ControlChange.Pan, eventData.Pan);
- if (eventData.Mute) {
- fluid_synth_cc(_synth, eventData.Channel, (int) ControlChange.Volume, MUTE_VOLUME);
+ Enumerable.Range(start: MIDI_TRACK_BASE, count: MIDI_TRACK_COUNT).ToList().ForEach(track_index => {
+ var event_data = EventQueue.Dequeue(track_index);
+ if (event_data is not null) {
+ fluid_synth_program_change(_synth, event_data.Channel, event_data.Program);
+ fluid_synth_cc(_synth, event_data.Channel, (int) ControlChange.Pan, event_data.Pan);
+ if (event_data.Mute) {
+ fluid_synth_cc(_synth, event_data.Channel, (int) ControlChange.Volume, MUTE_VOLUME);
} else {
- fluid_synth_cc(_synth, eventData.Channel, (int) ControlChange.Volume, eventData.Volume);
+ fluid_synth_cc(_synth, event_data.Channel, (int) ControlChange.Volume, event_data.Volume);
}
Task.Run(() => {
- Multi.ApplyProgramChange(eventData.Channel, eventData.Program);
+ Multi.ApplyProgramChange(event_data.Channel, event_data.Program);
});
}
});
@@ -121,29 +140,29 @@ static Synth() {
// static Properties [noun, noun phrase, adjective]
public static string SoundFontPath {
- get => _soundFontPath;
+ get => _sound_font_path;
set {
- _soundFontPath = value;
- _soundFontInfo = new SoundFontInfo(_soundFontPath);
+ _sound_font_path = value;
+ _sound_font_info = new SoundFontInfo(_sound_font_path);
Log.Info("Synth set soundFontPath.");
}
}
public static string MidiFilePath {
- get => _midiFilePath;
+ get => _midi_file_path;
set {
- _midiFilePath = value;
- _standardMidiFile = new StandardMidiFile(_midiFilePath);
+ _midi_file_path = value;
+ _standard_midi_file = new StandardMidiFile(_midi_file_path);
Log.Info("Synth set midiFilePath.");
}
}
public static List MidiChannelList {
- get => _standardMidiFile.MidiChannelList;
+ get => _standard_midi_file.MidiChannelList;
}
public static int TrackCount {
- get => _standardMidiFile.TrackCount;
+ get => _standard_midi_file.TrackCount;
}
public static bool Playing {
@@ -155,25 +174,25 @@ public static bool Playing {
public static event Func Playbacking {
add {
- _onPlaybacking += value;
- _event_callback = new handle_midi_event_func_t(_onPlaybacking);
+ _on_playbacking += value;
+ _event_callback = new handle_midi_event_func_t(_on_playbacking);
}
- remove => _onPlaybacking -= value;
+ remove => _on_playbacking -= value;
}
public static event Action Started {
- add => _onStarted += value;
- remove => _onStarted -= value;
+ add => _on_started += value;
+ remove => _on_started -= value;
}
public static event Action Ended {
- add => _onEnded += value;
- remove => _onEnded -= value;
+ add => _on_ended += value;
+ remove => _on_ended -= value;
}
public static event PropertyChangedEventHandler Updated {
- add => _onUpdated += value;
- remove => _onUpdated -= value;
+ add => _on_updated += value;
+ remove => _on_updated -= value;
}
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -207,7 +226,7 @@ public static void Init() {
Log.Error("not a midi file.");
return;
}
- Multi.StandardMidiFile = _standardMidiFile;
+ Multi.StandardMidiFile = _standard_midi_file;
int result = fluid_player_add(_player, MidiFilePath);
if (result == FLUID_FAILED) {
Log.Error("failed to load the midi file.");
@@ -235,11 +254,11 @@ public static void Start() {
}
fluid_player_play(_player);
Log.Info("start :)");
- _onStarted();
+ _on_started();
fluid_player_join(_player);
Log.Info("end :D");
if (_stopping == false) {
- _onEnded();
+ _on_ended();
}
} catch (Exception ex) {
Log.Error(ex.Message);
@@ -266,42 +285,43 @@ public static int HandleEvent(IntPtr data, IntPtr evt) {
}
public static int GetChannel(IntPtr evt) {
- var channel = fluid_midi_event_get_channel(evt);
+ int channel = fluid_midi_event_get_channel(evt);
return channel;
}
- public static int GetChannel(int track) {
- var channel = Multi.GetBy(track).Channel;
+ public static int GetChannel(int track_index) {
+ int channel = Multi.GetBy(track_index).Channel;
return channel;
}
- public static int GetBank(int track) {
- var bank = Multi.GetBy(track).Bank;
+ public static int GetBank(int track_index) {
+ int bank = Multi.GetBy(track_index).Bank;
if (bank == -1) { // unset BANK_SELECT_LSB = 32
bank = 0;
}
return bank;
}
- public static int GetProgram(int track) {
- var program = Multi.GetBy(track).Program;
+ public static int GetProgram(int track_index) {
+ int program = Multi.GetBy(track_index).Program;
return program;
}
- public static string GetVoice(int track) {
- var bank = GetBank(track);
- var program = GetProgram(track);
- var voice = _soundFontInfo.GetVoice(bank, program);
+ public static string GetVoice(int track_index) {
+ int bank = GetBank(track_index);
+ int program = GetProgram(track_index);
+ string voice = _sound_font_info.GetVoice(bank, program);
return voice;
}
- public static string GetTrackName(int track) {
- var name = Multi.GetBy(track).Name;
+ public static string GetTrackName(int track_index) {
+ string name = Multi.GetBy(track_index).Name;
return name;
}
- public static bool IsSounded(int channel) {
- return Multi.GetBy(channel).Sounds;
+ public static bool IsSounded(int track_index) {
+ bool sounds = Multi.GetBy(track_index).Sounds;
+ return sounds;
}
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -327,7 +347,7 @@ static void final() {
}
static void onPropertyChanged(object sender, PropertyChangedEventArgs e) {
- _onUpdated(sender, e);
+ _on_updated(sender, e);
}
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -339,28 +359,28 @@ static class Multi {
///////////////////////////////////////////////////////////////////////////////////////////
// static Fields [nouns, noun phrases]
- static Map _trackMap;
+ static Map _track_map;
- static StandardMidiFile _standardMidiFile;
+ static StandardMidiFile _standard_midi_file;
///////////////////////////////////////////////////////////////////////////////////////////
// static Constructor
static Multi() {
- _trackMap = new();
+ _track_map = new();
}
///////////////////////////////////////////////////////////////////////////////////////////
// internal static Properties [noun, noun phrase, adjective]
internal static List List {
- get => _trackMap.Select(x => x.Value).ToList();
+ get => _track_map.Select(x => x.Value).ToList();
}
internal static StandardMidiFile StandardMidiFile {
- get => _standardMidiFile;
+ get => _standard_midi_file;
set {
- _standardMidiFile = value;
+ _standard_midi_file = value;
init();
}
}
@@ -372,21 +392,21 @@ internal static StandardMidiFile StandardMidiFile {
/// NOTE_ON = 144
///
internal static void ApplyNoteOn(int channel) {
- _trackMap.Where(x => x.Value.Channel == channel).ToList().ForEach(x => x.Value.Sounds = true);
+ _track_map.Where(x => x.Value.Channel == channel).ToList().ForEach(x => x.Value.Sounds = true);
}
///
/// NOTE_OFF = 128
///
internal static void ApplyNoteOff(int channel) {
- _trackMap.Where(x => x.Value.Channel == channel).ToList().ForEach(x => x.Value.Sounds = false);
+ _track_map.Where(x => x.Value.Channel == channel).ToList().ForEach(x => x.Value.Sounds = false);
}
///
/// PROGRAM_CHANGE = 192
///
internal static void ApplyProgramChange(int channel, int program) {
- _trackMap.Where(x => x.Value.Channel == channel).ToList().ForEach(x => x.Value.Program = program);
+ _track_map.Where(x => x.Value.Channel == channel).ToList().ForEach(x => x.Value.Program = program);
}
///
@@ -404,19 +424,19 @@ internal static void ApplyControlChange(int channel, int control, int value) {
switch (control) {
case BANK_SELECT_MSB: // BANK_SELECT_MSB
if (channel == 9) { // Drum
- _trackMap.Where(x => x.Value.Channel == channel).ToList().ForEach(x => x.Value.Bank = value + 1); // 128
+ _track_map.Where(x => x.Value.Channel == channel).ToList().ForEach(x => x.Value.Bank = value + 1); // 128
}
break;
case BANK_SELECT_LSB: // BANK_SELECT_LSB
if (channel != 9) { // not Drum
- _trackMap.Where(x => x.Value.Channel == channel).ToList().ForEach(x => x.Value.Bank = value);
+ _track_map.Where(x => x.Value.Channel == channel).ToList().ForEach(x => x.Value.Bank = value);
}
break;
case VOLUME_MSB: // VOLUME_MSB
- _trackMap.Where(x => x.Value.Channel == channel).ToList().ForEach(x => x.Value.Volume = value);
+ _track_map.Where(x => x.Value.Channel == channel).ToList().ForEach(x => x.Value.Volume = value);
break;
case PAN_MSB: // PAN_MSB
- _trackMap.Where(x => x.Value.Channel == channel).ToList().ForEach(x => x.Value.Pan = value);
+ _track_map.Where(x => x.Value.Channel == channel).ToList().ForEach(x => x.Value.Pan = value);
break;
default:
break;
@@ -424,10 +444,10 @@ internal static void ApplyControlChange(int channel, int control, int value) {
}
///
- /// get a trak by index.
+ /// gets a trak by index.
///
internal static Track GetBy(int index) {
- var track = _trackMap[index];
+ Track track = _track_map[index];
return track;
}
@@ -435,14 +455,14 @@ internal static Track GetBy(int index) {
// private static Methods [verb, verb phrases]
static void init() {
- _trackMap.Clear();
- Enumerable.Range(MIDI_TRACK_BASE, MIDI_TRACK_COUNT).ToList().ForEach(x => _trackMap.Add(x, new Track(x)));
- _trackMap[0].Name = _standardMidiFile.GetTrackName(0); // a song name.
- Enumerable.Range(MIDI_TRACK_BASE, MIDI_TRACK_COUNT).ToList().ForEach(x => GetBy(x).Updated += onPropertyChanged);
- var list = _standardMidiFile.MidiChannelList;
- for (var idx = 0; idx < MidiChannelList.Count; idx++) {
- _trackMap[idx + 1].Channel = list[idx]; // exclude conductor track;
- _trackMap[idx + 1].Name = _standardMidiFile.GetTrackName(idx + 1);
+ _track_map.Clear();
+ Enumerable.Range(start: MIDI_TRACK_BASE, count: MIDI_TRACK_COUNT).ToList().ForEach(x => _track_map.Add(x, new Track(index: x)));
+ _track_map[0].Name = _standard_midi_file.GetTrackName(track_index: 0); // a song name.
+ Enumerable.Range(start: MIDI_TRACK_BASE, count: MIDI_TRACK_COUNT).ToList().ForEach(x => GetBy(index: x).Updated += onPropertyChanged);
+ var list = _standard_midi_file.MidiChannelList;
+ for (var index = 0; index < MidiChannelList.Count; index++) {
+ _track_map[index + 1].Channel = list[index]; // exclude conductor track;
+ _track_map[index + 1].Name = _standard_midi_file.GetTrackName(track_index: index + 1);
}
}
}
@@ -494,7 +514,7 @@ public int Index {
get => _index;
set {
_index = value;
- Updated?.Invoke(this, new(nameof(Index)));
+ Updated?.Invoke(sender: this, e: new(nameof(Index)));
}
}
@@ -509,7 +529,7 @@ public bool Sounds {
get => _sounds;
set {
_sounds = value;
- Updated?.Invoke(this, new(nameof(Sounds)));
+ Updated?.Invoke(sender: this, e: new(nameof(Sounds)));
}
}
@@ -517,7 +537,7 @@ public string Name {
get => _name;
set {
_name = value;
- Updated?.Invoke(this, new(nameof(Name)));
+ Updated?.Invoke(sender: this, e: new(nameof(Name)));
}
}
@@ -525,7 +545,7 @@ public int Channel {
get => _channel;
set {
_channel = value;
- Updated?.Invoke(this, new(nameof(Channel)));
+ Updated?.Invoke(sender: this, e: new(nameof(Channel)));
}
}
@@ -545,7 +565,7 @@ public int Bank {
}
set {
_bank = value;
- Updated?.Invoke(this, new(nameof(Bank)));
+ Updated?.Invoke(sender: this, e: new(nameof(Bank)));
}
}
@@ -553,7 +573,7 @@ public int Program {
get => _program;
set {
_program = value;
- Updated?.Invoke(this, new(nameof(Program)));
+ Updated?.Invoke(sender: this, e: new(nameof(Program)));
}
}
@@ -561,7 +581,7 @@ public int Volume {
get => _volume;
set {
_volume = value;
- Updated?.Invoke(this, new(nameof(Volume)));
+ Updated?.Invoke(sender: this, e: new(nameof(Volume)));
}
}
@@ -569,7 +589,7 @@ public int Pan {
get => _pan;
set {
_pan = value;
- Updated?.Invoke(this, new(nameof(Pan)));
+ Updated?.Invoke(sender: this, e: new(nameof(Pan)));
}
}
}
diff --git a/MidiPlayer.Midi/StandardMidiFile.cs b/MidiPlayer.Midi/StandardMidiFile.cs
index bc08f5f..7972275 100644
--- a/MidiPlayer.Midi/StandardMidiFile.cs
+++ b/MidiPlayer.Midi/StandardMidiFile.cs
@@ -1,4 +1,18 @@
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
using System;
using System.Collections.Generic;
using System.Linq;
@@ -9,6 +23,9 @@ namespace MidiPlayer.Midi {
///
/// class for standard midi file
///
+ ///
+ /// h.adachi (STUDIO MeowToon)
+ ///
public class StandardMidiFile {
#nullable enable
@@ -17,26 +34,26 @@ public class StandardMidiFile {
Sequence _sequence;
- Map _nameAndMidiChannelMap;
+ Map _name_and_midi_channel_map;
///////////////////////////////////////////////////////////////////////////////////////////////
// Constructor
- public StandardMidiFile(string target) {
+ public StandardMidiFile(string file_path) {
try {
_sequence = new();
_sequence.Format = 1;
- _sequence.Load(target);
- Map nameAndMidiChannelMap;
- nameAndMidiChannelMap = new();
+ _sequence.Load(file_path);
+ Map name_and_midi_channel_map;
+ name_and_midi_channel_map = new();
Enumerable.Range(0, _sequence.Count).ToList().ForEach(x => {
- nameAndMidiChannelMap.Add(x, getTrackNameAndMidiChannel(x));
+ name_and_midi_channel_map.Add(x, getTrackNameAndMidiChannel(x));
});
- _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
- _nameAndMidiChannelMap.Add(idx++, x.Value);
+ _name_and_midi_channel_map = new();
+ var index = 0;
+ name_and_midi_channel_map.ToList().ForEach(x => {
+ if (!x.Value.name.Equals("System Setup") && !(x.Value.name.Equals(string.Empty) && x.Value.channel == -1)) { // no need track
+ _name_and_midi_channel_map.Add(index++, x.Value);
}
});
} catch (Exception ex) {
@@ -48,59 +65,59 @@ public StandardMidiFile(string target) {
// Properties [noun, noun phrase, adjective]
public int TrackCount {
- get => _nameAndMidiChannelMap.Where(x => x.Value.channel != -1).Count(); // exclude conductor track;
+ get => _name_and_midi_channel_map.Where(x => x.Value.channel != -1).Count(); // exclude conductor track;
}
public List MidiChannelList {
- get => _nameAndMidiChannelMap.Where(x => x.Value.channel != -1).Select(x => x.Value.channel).ToList();
+ get => _name_and_midi_channel_map.Where(x => x.Value.channel != -1).Select(x => x.Value.channel).ToList();
}
///////////////////////////////////////////////////////////////////////////////////////////////
// public Methods [verb, verb phrases]
- public string GetTrackName(int trackIndex) {
- return _nameAndMidiChannelMap[trackIndex].name;
+ public string GetTrackName(int track_index) {
+ return _name_and_midi_channel_map[track_index].name;
}
///////////////////////////////////////////////////////////////////////////////////////////////
// private Methods [verb, verb phrases]
- string getTrackName(int trackIndex) {
- var trackName = "undefined";
- var track = _sequence[trackIndex];
- for (var idx = 0; idx < track.Count; idx++) {
- var evt = track.GetMidiEvent(idx);
+ string getTrackName(int track_index) {
+ var track_name = "undefined";
+ var track = _sequence[track_index];
+ for (var index = 0; index < track.Count; index++) {
+ var evt = track.GetMidiEvent(index);
var msg = evt.MidiMessage;
if (msg.MessageType == MessageType.Meta) {
- var metaMsg = (MetaMessage) msg;
- if (metaMsg.MetaType == MetaType.TrackName) {
- var data = metaMsg.GetBytes();
+ var meta_msg = (MetaMessage) msg;
+ if (meta_msg.MetaType == MetaType.TrackName) {
+ var data = meta_msg.GetBytes();
var text = Encoding.UTF8.GetString(data);
- trackName = text;
+ track_name = text;
break;
}
}
}
- return trackName;
+ return track_name;
}
- int getMidiChannel(int trackIndex) {
+ int getMidiChannel(int track_index) {
var channel = -1; // conductor track gets -1;
- var track = _sequence[trackIndex];
- for (var idx = 0; idx < track.Count; idx++) {
- var evt = track.GetMidiEvent(idx);
+ var track = _sequence[track_index];
+ for (var index = 0; index < track.Count; index++) {
+ var evt = track.GetMidiEvent(index);
var msg = evt.MidiMessage;
if (msg.MessageType == MessageType.Channel) {
- var chanMsg = (ChannelMessage) msg;
- channel = chanMsg.MidiChannel;
+ var chan_msg = (ChannelMessage) msg;
+ channel = chan_msg.MidiChannel;
break;
}
}
return channel;
}
- (string name, int channel) getTrackNameAndMidiChannel(int trackIndex) {
- return (getTrackName(trackIndex), getMidiChannel(trackIndex));
+ (string name, int channel) getTrackNameAndMidiChannel(int track_index) {
+ return (getTrackName(track_index), getMidiChannel(track_index));
}
}
}
diff --git a/MidiPlayer.SoundFont/SoundFont .cs b/MidiPlayer.SoundFont/SoundFont .cs
index 482c5bc..9603571 100644
--- a/MidiPlayer.SoundFont/SoundFont .cs
+++ b/MidiPlayer.SoundFont/SoundFont .cs
@@ -1,4 +1,18 @@
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
using System;
using System.Collections.Generic;
using System.Linq;
@@ -7,35 +21,38 @@ namespace MidiPlayer.SoundFont {
///
/// class for soundfont information
///
+ ///
+ /// h.adachi (STUDIO MeowToon)
+ ///
public class SoundFontInfo {
#nullable enable
///////////////////////////////////////////////////////////////////////////////////////////////
// Fields [nouns, noun phrases]
- NAudio.SoundFont.SoundFont _soundFont;
+ NAudio.SoundFont.SoundFont _sound_font;
Map> _map;
///////////////////////////////////////////////////////////////////////////////////////////////
// Constructor
- public SoundFontInfo(string target) {
+ public SoundFontInfo(string file_path) {
try {
- _soundFont = new NAudio.SoundFont.SoundFont(target);
+ _sound_font = new NAudio.SoundFont.SoundFont(file_path);
Map> map = new();
- _soundFont.Presets.ToList().ForEach(x => {
- if (!map.ContainsKey(x.Bank)) {
- List newList = new();
- newList.Add(new Voice() { Prog = x.PatchNumber, Name = x.Name });
- map.Add(x.Bank, newList); // new bank and new voice
+ _sound_font.Presets.ToList().ForEach(x => {
+ if (!map.ContainsKey(key: x.Bank)) {
+ List new_list = new();
+ new_list.Add(item: new Voice() { Prog = x.PatchNumber, Name = x.Name });
+ map.Add(key: x.Bank, value: new_list); // new bank and new voice
} else {
- map[x.Bank].Add(new Voice() { Prog = x.PatchNumber, Name = x.Name }); // exists bank and new voice
+ map[x.Bank].Add(item: new Voice() { Prog = x.PatchNumber, Name = x.Name }); // exists bank and new voice
}
});
_map = new();
map.OrderBy(x => x.Key).ToList().ForEach(x => { // sort bank
- _map.Add(x.Key, x.Value.OrderBy(_x => _x.Prog).ToList()); // sort prog
+ _map.Add(key: x.Key, value: x.Value.OrderBy(_x => _x.Prog).ToList()); // sort prog
});
} catch (Exception ex) {
Log.Error(ex.Message);
diff --git a/MidiPlayer.Win64/BufferedListView.cs b/MidiPlayer.Win64/BufferedListView.cs
index e4ff282..455aa33 100644
--- a/MidiPlayer.Win64/BufferedListView.cs
+++ b/MidiPlayer.Win64/BufferedListView.cs
@@ -1,10 +1,27 @@
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
using System.Windows.Forms;
namespace MidiPlayer.Win64 {
///
/// double buffered ListView
///
+ ///
+ /// h.adachi (STUDIO MeowToon)
+ ///
public class BufferedListView : ListView {
///////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/MidiPlayer.Win64/MainForm.Designer.cs b/MidiPlayer.Win64/MainForm.Designer.cs
index 13f154c..b0a9c61 100644
--- a/MidiPlayer.Win64/MainForm.Designer.cs
+++ b/MidiPlayer.Win64/MainForm.Designer.cs
@@ -24,81 +24,81 @@ protected override void Dispose(bool disposing) {
/// the contents of this method with the code editor.
///
private void InitializeComponent() {
- this._buttonLoadSoundFont = new System.Windows.Forms.Button();
- this._buttonLoadMidiFile = new System.Windows.Forms.Button();
- this._buttonStart = new System.Windows.Forms.Button();
- this._buttonStop = new System.Windows.Forms.Button();
- this._openFileDialog = new System.Windows.Forms.OpenFileDialog();
- this._listView = new MidiPlayer.Win64.BufferedListView();
+ this._button_load_soundfont = new System.Windows.Forms.Button();
+ this._button_load_midi_file = new System.Windows.Forms.Button();
+ this._button_start = new System.Windows.Forms.Button();
+ this._button_stop = new System.Windows.Forms.Button();
+ this._openfiledialog = new System.Windows.Forms.OpenFileDialog();
+ this._listview = new MidiPlayer.Win64.BufferedListView();
this.SuspendLayout();
//
- // _buttonLoadSoundFont
+ // _button_load_soundfont
//
- this._buttonLoadSoundFont.Font = new System.Drawing.Font("Yu Gothic UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
- this._buttonLoadSoundFont.Location = new System.Drawing.Point(12, 12);
- this._buttonLoadSoundFont.Name = "_buttonLoadSoundFont";
- this._buttonLoadSoundFont.Size = new System.Drawing.Size(84, 40);
- this._buttonLoadSoundFont.TabIndex = 0;
- this._buttonLoadSoundFont.Text = "SOUND";
- this._buttonLoadSoundFont.UseVisualStyleBackColor = true;
- this._buttonLoadSoundFont.Click += new System.EventHandler(this.buttonLoadSoundFont_Click);
+ this._button_load_soundfont.Font = new System.Drawing.Font("Yu Gothic UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this._button_load_soundfont.Location = new System.Drawing.Point(12, 12);
+ this._button_load_soundfont.Name = "_button_load_soundfont";
+ this._button_load_soundfont.Size = new System.Drawing.Size(84, 40);
+ this._button_load_soundfont.TabIndex = 0;
+ this._button_load_soundfont.Text = "SOUND";
+ this._button_load_soundfont.UseVisualStyleBackColor = true;
+ this._button_load_soundfont.Click += new System.EventHandler(this.buttonLoadSoundFont_Click);
//
- // _buttonLoadMidiFile
+ // _button_load_midi_file
//
- this._buttonLoadMidiFile.Font = new System.Drawing.Font("Yu Gothic UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
- this._buttonLoadMidiFile.Location = new System.Drawing.Point(107, 12);
- this._buttonLoadMidiFile.Name = "_buttonLoadMidiFile";
- this._buttonLoadMidiFile.Size = new System.Drawing.Size(84, 40);
- this._buttonLoadMidiFile.TabIndex = 1;
- this._buttonLoadMidiFile.Text = "SONG";
- this._buttonLoadMidiFile.UseVisualStyleBackColor = true;
- this._buttonLoadMidiFile.Click += new System.EventHandler(this.buttonLoadMidiFile_Click);
+ this._button_load_midi_file.Font = new System.Drawing.Font("Yu Gothic UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this._button_load_midi_file.Location = new System.Drawing.Point(107, 12);
+ this._button_load_midi_file.Name = "_button_load_midi_file";
+ this._button_load_midi_file.Size = new System.Drawing.Size(84, 40);
+ this._button_load_midi_file.TabIndex = 1;
+ this._button_load_midi_file.Text = "SONG";
+ this._button_load_midi_file.UseVisualStyleBackColor = true;
+ this._button_load_midi_file.Click += new System.EventHandler(this.buttonLoadMidiFile_Click);
//
- // _buttonStart
+ // _button_start
//
- this._buttonStart.Font = new System.Drawing.Font("Yu Gothic UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
- this._buttonStart.Location = new System.Drawing.Point(202, 12);
- this._buttonStart.Name = "_buttonStart";
- this._buttonStart.Size = new System.Drawing.Size(84, 40);
- this._buttonStart.TabIndex = 2;
- this._buttonStart.Text = "START";
- this._buttonStart.UseVisualStyleBackColor = true;
- this._buttonStart.Click += new System.EventHandler(this.buttonStart_Click);
+ this._button_start.Font = new System.Drawing.Font("Yu Gothic UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this._button_start.Location = new System.Drawing.Point(202, 12);
+ this._button_start.Name = "_button_start";
+ this._button_start.Size = new System.Drawing.Size(84, 40);
+ this._button_start.TabIndex = 2;
+ this._button_start.Text = "START";
+ this._button_start.UseVisualStyleBackColor = true;
+ this._button_start.Click += new System.EventHandler(this.buttonStart_Click);
//
- // _buttonStop
+ // _button_stop
//
- this._buttonStop.Font = new System.Drawing.Font("Yu Gothic UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
- this._buttonStop.Location = new System.Drawing.Point(297, 12);
- this._buttonStop.Name = "_buttonStop";
- this._buttonStop.Size = new System.Drawing.Size(84, 40);
- this._buttonStop.TabIndex = 3;
- this._buttonStop.Text = "STOP";
- this._buttonStop.UseVisualStyleBackColor = true;
- this._buttonStop.Click += new System.EventHandler(this.buttonStop_Click);
+ this._button_stop.Font = new System.Drawing.Font("Yu Gothic UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this._button_stop.Location = new System.Drawing.Point(297, 12);
+ this._button_stop.Name = "_button_stop";
+ this._button_stop.Size = new System.Drawing.Size(84, 40);
+ this._button_stop.TabIndex = 3;
+ this._button_stop.Text = "STOP";
+ this._button_stop.UseVisualStyleBackColor = true;
+ this._button_stop.Click += new System.EventHandler(this.buttonStop_Click);
//
- // _openFileDialog
+ // _openfiledialog
//
- this._openFileDialog.FileName = "openFileDialog";
+ this._openfiledialog.FileName = "openFileDialog";
//
- // _listView
+ // _listview
//
- this._listView.HideSelection = false;
- this._listView.Location = new System.Drawing.Point(12, 74);
- this._listView.Name = "_listView";
- this._listView.Size = new System.Drawing.Size(415, 423);
- this._listView.TabIndex = 4;
- this._listView.UseCompatibleStateImageBehavior = false;
+ this._listview.HideSelection = false;
+ this._listview.Location = new System.Drawing.Point(12, 74);
+ this._listview.Name = "_listview";
+ this._listview.Size = new System.Drawing.Size(415, 423);
+ this._listview.TabIndex = 4;
+ this._listview.UseCompatibleStateImageBehavior = false;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(439, 575);
- this.Controls.Add(this._listView);
- this.Controls.Add(this._buttonStop);
- this.Controls.Add(this._buttonStart);
- this.Controls.Add(this._buttonLoadMidiFile);
- this.Controls.Add(this._buttonLoadSoundFont);
+ this.Controls.Add(this._listview);
+ this.Controls.Add(this._button_stop);
+ this.Controls.Add(this._button_start);
+ this.Controls.Add(this._button_load_midi_file);
+ this.Controls.Add(this._button_load_soundfont);
this.Name = "MainForm";
this.Text = "MIDIPlayer";
this.Load += new System.EventHandler(this.MainForm_Load);
@@ -108,12 +108,12 @@ private void InitializeComponent() {
#endregion
- private System.Windows.Forms.Button _buttonLoadSoundFont;
- private System.Windows.Forms.Button _buttonLoadMidiFile;
- private System.Windows.Forms.Button _buttonStart;
- private System.Windows.Forms.Button _buttonStop;
- private System.Windows.Forms.OpenFileDialog _openFileDialog;
- private BufferedListView _listView;
+ private System.Windows.Forms.Button _button_load_soundfont;
+ private System.Windows.Forms.Button _button_load_midi_file;
+ private System.Windows.Forms.Button _button_start;
+ private System.Windows.Forms.Button _button_stop;
+ private System.Windows.Forms.OpenFileDialog _openfiledialog;
+ private BufferedListView _listview;
}
}
diff --git a/MidiPlayer.Win64/MainForm.cs b/MidiPlayer.Win64/MainForm.cs
index 4e3c3c7..90634c5 100644
--- a/MidiPlayer.Win64/MainForm.cs
+++ b/MidiPlayer.Win64/MainForm.cs
@@ -1,4 +1,18 @@
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
using System;
using System.ComponentModel;
using System.Drawing;
@@ -11,17 +25,20 @@ namespace MidiPlayer.Win64 {
///
/// main form for the application.
///
+ ///
+ /// h.adachi (STUDIO MeowToon)
+ ///
public partial class MainForm : Form {
#nullable enable
///////////////////////////////////////////////////////////////////////////////////////////////
// Fields [nouns, noun phrases]
- string _soundFontPath = "undefined";
+ string _soundfont_path = "undefined";
- string _midiFilePath = "undefined";
+ string _midi_file_path = "undefined";
- PlayList _playList;
+ PlayList _playlist;
///////////////////////////////////////////////////////////////////////////////////////////////
// Constructor
@@ -29,7 +46,7 @@ public partial class MainForm : Form {
public MainForm() {
InitializeComponent();
DoubleBuffered = true;
- _playList = new();
+ _playlist = new();
}
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -46,8 +63,8 @@ void MainForm_Load(object sender, EventArgs e) {
if (Env.ExistsSoundFont && Env.ExistsMidiFile) {
Synth.SoundFontPath = Env.SoundFontPath;
Synth.MidiFilePath = Env.MidiFilePath;
- _soundFontPath = Env.SoundFontPath;
- _midiFilePath = Env.MidiFilePath;
+ _soundfont_path = Env.SoundFontPath;
+ _midi_file_path = Env.MidiFilePath;
}
///
@@ -64,9 +81,9 @@ void MainForm_Load(object sender, EventArgs e) {
Log.Info("Started called.");
Invoke((MethodInvoker) (() => {
Text = $"MidiPlayer: {Synth.MidiFilePath.ToFileName()} {Synth.SoundFontPath.ToFileName()}";
- _listView.Items.Clear();
+ _listview.Items.Clear();
Enumerable.Range(0, Synth.TrackCount).ToList().ForEach(x => {
- _listView.Items.Add(new ListViewItem(new string[] { " ●", "--", "--", "--", "--", "--" }));
+ _listview.Items.Add(new ListViewItem(new string[] { " ●", "--", "--", "--", "--", "--" }));
});
}));
};
@@ -76,12 +93,12 @@ void MainForm_Load(object sender, EventArgs e) {
///
Synth.Ended += () => {
Log.Info("Ended called.");
- if (!_playList.Ready) {
+ if (!_playlist.Ready) {
Synth.Stop();
Synth.Start();
} else {
Synth.Stop();
- Synth.MidiFilePath = _playList.Next;
+ Synth.MidiFilePath = _playlist.Next;
Synth.Start();
}
};
@@ -101,12 +118,12 @@ void buttonLoadSoundFont_Click(object sender, EventArgs e) {
if (Synth.Playing) {
stopSong();
}
- _openFileDialog.InitialDirectory = Env.SoundFontDir;
- var dialog = _openFileDialog.ShowDialog();
+ _openfiledialog.InitialDirectory = Env.SoundFontDir;
+ var dialog = _openfiledialog.ShowDialog();
if (dialog == DialogResult.OK) {
- _soundFontPath = Path.GetFullPath(_openFileDialog.FileName);
- Synth.SoundFontPath = _soundFontPath;
- Env.SoundFontPath = _soundFontPath;
+ _soundfont_path = Path.GetFullPath(_openfiledialog.FileName);
+ Synth.SoundFontPath = _soundfont_path;
+ Env.SoundFontPath = _soundfont_path;
}
} catch (Exception ex) {
Log.Error(ex.Message);
@@ -119,12 +136,12 @@ void buttonLoadMidiFile_Click(object sender, EventArgs e) {
if (Synth.Playing) {
stopSong();
}
- _openFileDialog.InitialDirectory = Env.MidiFileDir;
- var dialog = _openFileDialog.ShowDialog();
+ _openfiledialog.InitialDirectory = Env.MidiFileDir;
+ var dialog = _openfiledialog.ShowDialog();
if (dialog == DialogResult.OK) {
- _midiFilePath = Path.GetFullPath(_openFileDialog.FileName);
- Synth.MidiFilePath = _midiFilePath;
- Env.MidiFilePath = _midiFilePath;
+ _midi_file_path = Path.GetFullPath(_openfiledialog.FileName);
+ Synth.MidiFilePath = _midi_file_path;
+ Env.MidiFilePath = _midi_file_path;
}
} catch (Exception ex) {
Log.Error(ex.Message);
@@ -134,7 +151,7 @@ void buttonLoadMidiFile_Click(object sender, EventArgs e) {
void buttonStart_Click(object sender, EventArgs e) {
Log.Info("buttonStart clicked.");
try {
- if (!_midiFilePath.HasValue()) {
+ if (!_midi_file_path.HasValue()) {
return;
}
playSong();
@@ -162,11 +179,11 @@ void buttonStop_Click(object sender, EventArgs e) {
async void playSong() {
try {
await Task.Run(() => {
- if (!_playList.Ready) {
- Synth.MidiFilePath = _midiFilePath;
+ if (!_playlist.Ready) {
+ Synth.MidiFilePath = _midi_file_path;
Synth.Start();
} else {
- Synth.MidiFilePath = _playList.Next;
+ Synth.MidiFilePath = _playlist.Next;
Synth.Start();
}
});
@@ -181,10 +198,10 @@ await Task.Run(() => {
async void stopSong() {
try {
await Task.Run(() => Synth.Stop());
- if (_listView.Items.Count != 0) {
+ if (_listview.Items.Count != 0) {
Invoke((MethodInvoker) (() => {
Enumerable.Range(0, Synth.TrackCount).ToList().ForEach(x => {
- _listView.Items[x].SubItems[0].ForeColor = Color.Black;
+ _listview.Items[x].SubItems[0].ForeColor = Color.Black;
});
}));
}
@@ -198,10 +215,10 @@ async void stopSong() {
/// a callback function to be called when the synth updated.
///
MethodInvoker updateList(Synth.Track track) {
- const int _column1Idx = 0;
- var trackIdx = track.Index - 1; // exclude conductor track;
+ const int COLUMN_1_INDEX = 0;
+ var track_index = track.Index - 1; // exclude conductor track;
return () => {
- var listViewItem = new ListViewItem(new string[] {
+ var listview_item = new ListViewItem(new string[] {
" ●",
track.Name,
Synth.GetVoice(track.Index),
@@ -209,15 +226,16 @@ MethodInvoker updateList(Synth.Track track) {
track.Bank.ToString(),
track.Program.ToString()
});
- _listView.BeginUpdate();
- _listView.Items[trackIdx] = listViewItem;
- _listView.Items[trackIdx].UseItemStyleForSubItems = false;
+ _listview.BeginUpdate();
+ _listview.Items[track_index] = listview_item;
+ _listview.Items[track_index].UseItemStyleForSubItems = false;
if (track.Sounds) {
- _listView.Items[trackIdx].SubItems[_column1Idx].ForeColor = Color.Lime;
- } else {
- _listView.Items[trackIdx].SubItems[_column1Idx].ForeColor = Color.Black;
+ _listview.Items[track_index].SubItems[COLUMN_1_INDEX].ForeColor = Color.Lime;
+ }
+ else {
+ _listview.Items[track_index].SubItems[COLUMN_1_INDEX].ForeColor = Color.Black;
}
- _listView.EndUpdate();
+ _listview.EndUpdate();
};
}
@@ -226,10 +244,10 @@ MethodInvoker updateList(Synth.Track track) {
///
void initializeControl() {
// initialize ListView
- _listView.FullRowSelect = true;
- _listView.GridLines = true;
- _listView.Sorting = SortOrder.None; // do not sort automatically.
- _listView.View = View.Details;
+ _listview.FullRowSelect = true;
+ _listview.GridLines = true;
+ _listview.Sorting = SortOrder.None; // do not sort automatically.
+ _listview.View = View.Details;
ColumnHeader column1 = new();
column1.Text = "On";
column1.Width = 35;
@@ -249,7 +267,7 @@ void initializeControl() {
column6.Text = "Prog";
column6.Width = 45;
ColumnHeader[] columnHeaderArray = { column1, column2, column3, column4, column5, column6 };
- _listView.Columns.AddRange(columnHeaderArray);
+ _listview.Columns.AddRange(columnHeaderArray);
}
}
}
diff --git a/MidiPlayer.Win64/MidiPlayer.Win64.csproj b/MidiPlayer.Win64/MidiPlayer.Win64.csproj
index df6d0a0..a36e234 100644
--- a/MidiPlayer.Win64/MidiPlayer.Win64.csproj
+++ b/MidiPlayer.Win64/MidiPlayer.Win64.csproj
@@ -38,9 +38,6 @@
Always
-
- Always
-
Always
diff --git a/MidiPlayer.Win64/Program.cs b/MidiPlayer.Win64/Program.cs
index aba8a94..7a72bc9 100644
--- a/MidiPlayer.Win64/Program.cs
+++ b/MidiPlayer.Win64/Program.cs
@@ -1,16 +1,31 @@
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace MidiPlayer.Win64 {
+ ///
+ /// the application.
+ ///
+ ///
+ /// h.adachi (STUDIO MeowToon)
+ ///
static class Program {
#nullable enable
- ///
- /// The main entry point for the application.
- ///
[STAThread]
static void Main() {
Application.SetHighDpiMode(HighDpiMode.SystemAware);
diff --git a/MidiPlayer/Conf.cs b/MidiPlayer/Conf.cs
index 95db864..53d117b 100644
--- a/MidiPlayer/Conf.cs
+++ b/MidiPlayer/Conf.cs
@@ -1,4 +1,18 @@
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
using System;
using System.IO;
using System.Runtime.Serialization;
@@ -9,6 +23,9 @@ namespace MidiPlayer {
///
/// config file for for the application.
///
+ ///
+ /// h.adachi (STUDIO MeowToon)
+ ///
public class Conf {
#nullable enable
@@ -124,9 +141,9 @@ public static string ConfDir {
get {
var os = Environment.OSVersion;
if (os.Platform == PlatformID.Win32NT) {
- return WIN64_PATH.Replace("\\app_conf.json", "");
+ return WIN64_PATH.Replace("\\app_conf.json", string.Empty);
} else if (os.Platform == PlatformID.Unix) {
- return ANDROID_PATH.Replace("/app_conf.json", "");
+ return ANDROID_PATH.Replace("/app_conf.json", string.Empty);
}
return string.Empty;
}
diff --git a/MidiPlayer/Enums.cs b/MidiPlayer/Enums.cs
index 9ee2919..05c8613 100644
--- a/MidiPlayer/Enums.cs
+++ b/MidiPlayer/Enums.cs
@@ -1,8 +1,25 @@
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
namespace MidiPlayer {
///
/// common enums for app
///
+ ///
+ /// h.adachi (STUDIO MeowToon)
+ ///
public enum Request {
SoundFont = 128,
diff --git a/MidiPlayer/Env.cs b/MidiPlayer/Env.cs
index 98f3e96..747fd39 100644
--- a/MidiPlayer/Env.cs
+++ b/MidiPlayer/Env.cs
@@ -1,10 +1,27 @@
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
using System.IO;
namespace MidiPlayer {
///
/// environment value for the application.
///
+ ///
+ /// h.adachi (STUDIO MeowToon)
+ ///
public class Env {
#nullable enable
@@ -26,7 +43,7 @@ public static string SoundFontDirForIntent {
if (!ExistsSoundFont) {
return "Music";
}
- return SoundFontDir.Replace("/storage/emulated/0/", "").Replace("/", "%2F");
+ return SoundFontDir.Replace("/storage/emulated/0/", string.Empty).Replace("/", "%2F");
}
}
@@ -35,7 +52,7 @@ public static string MidiFileDirForIntent {
if (!ExistsMidiFile) {
return "Music";
}
- return MidiFileDir.Replace("/storage/emulated/0/", "").Replace("/", "%2F");
+ return MidiFileDir.Replace("/storage/emulated/0/", string.Empty).Replace("/", "%2F");
}
}
diff --git a/MidiPlayer/EventQueue.cs b/MidiPlayer/EventQueue.cs
index c315a63..23f3d52 100644
--- a/MidiPlayer/EventQueue.cs
+++ b/MidiPlayer/EventQueue.cs
@@ -1,17 +1,28 @@
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
using System.Collections.Generic;
using System.Linq;
namespace MidiPlayer {
- ///
- /// rename Dictionary to Map
- ///
- public class Map : Dictionary {
- }
-
///
/// event queue class to send synth
///
+ ///
+ /// h.adachi (STUDIO MeowToon)
+ ///
public class EventQueue {
#nullable enable
@@ -24,27 +35,27 @@ public class EventQueue {
///////////////////////////////////////////////////////////////////////////////////////////////
// static Fields [nouns, noun phrases]
- static Map> _queueMap;
+ static Map> _queue_map;
///////////////////////////////////////////////////////////////////////////////////////////////
// static Constructor
static EventQueue() {
- _queueMap = new();
- Enumerable.Range(MIDI_TRACK_BASE, MIDI_TRACK_COUNT).ToList().ForEach(
- trackIdx => _queueMap.Add(trackIdx, new())
+ _queue_map = new();
+ Enumerable.Range(start: MIDI_TRACK_BASE, count: MIDI_TRACK_COUNT).ToList().ForEach(
+ track_index => _queue_map.Add(key: track_index, value: new())
);
}
///////////////////////////////////////////////////////////////////////////////////////////////
// public static Methods [verb, verb phrases]
- public static void Enqueue(int trackIdx, Data value) {
- _queueMap[trackIdx].Enqueue(value);
+ public static void Enqueue(int track_index, Data value) {
+ _queue_map[track_index].Enqueue(item: value);
}
- public static Data Dequeue(int trackIdx) {
- return _queueMap[trackIdx].Count == 0 ? null : _queueMap[trackIdx].Dequeue();
+ public static Data Dequeue(int track_index) {
+ return _queue_map[track_index].Count == 0 ? null : _queue_map[track_index].Dequeue();
}
}
@@ -94,4 +105,10 @@ public bool Mute {
set => _mute = value;
}
}
+
+ ///
+ /// rename Dictionary to Map
+ ///
+ public class Map : Dictionary {
+ }
}
diff --git a/MidiPlayer/Extensions.cs b/MidiPlayer/Extensions.cs
index a8f0b4d..e2e7844 100644
--- a/MidiPlayer/Extensions.cs
+++ b/MidiPlayer/Extensions.cs
@@ -1,4 +1,18 @@
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
using System;
using System.IO;
using System.Text;
@@ -7,6 +21,9 @@ namespace MidiPlayer {
///
/// common extension method
///
+ ///
+ /// h.adachi (STUDIO MeowToon)
+ ///
public static class Extensions {
#nullable enable
@@ -14,21 +31,21 @@ public static class Extensions {
/// to memory stream
///
public static MemoryStream ToMemoryStream(this string source) {
- return new MemoryStream(Encoding.UTF8.GetBytes(source));
+ return new MemoryStream(buffer: Encoding.UTF8.GetBytes(source));
}
///
/// to directory name
///
public static string ToDirectoryName(this string source) {
- return Path.GetDirectoryName(source);
+ return Path.GetDirectoryName(path: source);
}
///
/// to file name
///
public static string ToFileName(this string source) {
- return Path.GetFileName(source);
+ return Path.GetFileName(path: source);
}
///
@@ -42,7 +59,7 @@ public static long ToMegabytes(this long source) {
/// returns true if the string is not null or an empty string "" or "undefined".
///
public static bool HasValue(this string source) {
- return !(source is null || source.Equals("") || source.Equals("undefined"));
+ return !(source is null || source.Equals(string.Empty) || source.Equals("undefined"));
}
///
diff --git a/MidiPlayer/Log.cs b/MidiPlayer/Log.cs
index 81bc856..e7533b9 100644
--- a/MidiPlayer/Log.cs
+++ b/MidiPlayer/Log.cs
@@ -1,4 +1,18 @@
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
using NLog;
namespace MidiPlayer {
@@ -6,6 +20,9 @@ namespace MidiPlayer {
/// Facade class for log
/// NOTE: using NLog
///
+ ///
+ /// h.adachi (STUDIO MeowToon)
+ ///
public static class Log {
#nullable enable
diff --git a/MidiPlayer/Mixer.cs b/MidiPlayer/Mixer.cs
index c636ec8..a759129 100644
--- a/MidiPlayer/Mixer.cs
+++ b/MidiPlayer/Mixer.cs
@@ -1,13 +1,28 @@
-
-using System;
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
using System.ComponentModel;
using System.Linq;
namespace MidiPlayer {
-
///
/// Mixer object.
///
+ ///
+ /// h.adachi (STUDIO MeowToon)
+ ///
public static class Mixer {
#nullable enable
@@ -43,12 +58,12 @@ public static class Mixer {
///
/// func object to be called when a fader is selected.
///
- static PropertyChangedEventHandler _onSelected;
+ static PropertyChangedEventHandler? _on_selected;
///
/// func object to be called when a fader is updated.
///
- static PropertyChangedEventHandler _onUpdated;
+ static PropertyChangedEventHandler? _on_updated;
///////////////////////////////////////////////////////////////////////////////////////////////
// static Constructor
@@ -59,7 +74,7 @@ public static class Mixer {
static Mixer() {
_mixer = new();
_current = 0;
- Enumerable.Range(MIDI_TRACK_BASE, MIDI_TRACK_COUNT).ToList().ForEach(x => {
+ Enumerable.Range(start: MIDI_TRACK_BASE, count: MIDI_TRACK_COUNT).ToList().ForEach(x => {
Fader fader = new(x);
fader.Updated += onUpdate;
_mixer.Add(x, fader);
@@ -72,23 +87,23 @@ static Mixer() {
///
/// selected event handler.
///
- ///
+ ///
/// called when Mixer's channel is clicked.
- ///
+ ///
public static event PropertyChangedEventHandler? Selected {
- add => _onSelected += value;
- remove => _onSelected -= value;
+ add => _on_selected += value;
+ remove => _on_selected -= value;
}
///
/// updated event handler.
///
- ///
+ ///
/// called when Fader's properties change.
- ///
+ ///
public static event PropertyChangedEventHandler? Updated {
- add => _onUpdated += value;
- remove => _onUpdated -= value;
+ add => _on_updated += value;
+ remove => _on_updated -= value;
}
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -97,16 +112,16 @@ public static event PropertyChangedEventHandler? Updated {
///
/// get selected fader number.
///
- ///
+ ///
/// base index value is 0.
- ///
+ ///
public static int Current {
get => _current;
set {
_previous = _current;
_current = value;
Log.Info($"current: {_current}");
- _onSelected(null, new(nameof(Current)));
+ _on_selected(null, new(nameof(Current)));
}
}
@@ -148,7 +163,7 @@ public static Fader GetBy(int index) {
/// called when a fader value is updated.
///
static void onUpdate(object sender, PropertyChangedEventArgs e) {
- _onUpdated(sender, e);
+ _on_updated(sender, e);
}
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -166,9 +181,9 @@ public class Fader {
///
/// a track index value of a fader.
///
- ///
+ ///
/// base index value is 0, maxim value is MIDI_TRACK_COUNT.
- ///
+ ///
int _index = -1;
///
@@ -184,41 +199,41 @@ public class Fader {
///
/// a midi channel number of a fader.
///
- ///
+ ///
/// base index value is 0, maxim value is MIDI_TRACK_COUNT.
- ///
+ ///
int _channel = -1;
///
/// a midi bank number of a fader.
///
- ///
+ ///
/// minimum value is 0, maxim value is 127.
- ///
+ ///
int _bank = -1;
///
/// a midi program number of a fader.
///
- ///
+ ///
/// minimum value is 0, maxim value is 127.
- ///
+ ///
int _program = 0;
///
/// a midi volume value of a fader.
///
- ///
+ ///
/// minimum value is 0, maxim value is 127.
- ///
+ ///
int _volume = 104;
///
/// a midi pan value of a fader.
///
- ///
+ ///
/// full left value is 0, center value is 64, full right value is 127.
- ///
+ ///
int _pan = 64; // center
///////////////////////////////////////////////////////////////////////////////////////////
@@ -250,7 +265,7 @@ public int Index {
set {
if (value != _index) {
_index = value;
- Updated?.Invoke(this, new(nameof(Index)));
+ Updated?.Invoke(sender: this, e: new(nameof(Index)));
}
}
}
@@ -271,7 +286,7 @@ public bool Sounds {
set {
if (value != _sounds) {
_sounds = value;
- Updated?.Invoke(this, new(nameof(Sounds)));
+ Updated?.Invoke(sender: this, e: new(nameof(Sounds)));
}
}
}
@@ -284,7 +299,7 @@ public string Name {
set {
if (value != _name) {
_name = value;
- Updated?.Invoke(this, new(nameof(Name)));
+ Updated?.Invoke(sender: this, e: new(nameof(Name)));
}
}
}
@@ -297,7 +312,7 @@ public int Channel {
set {
if (value != _channel) {
_channel = value;
- Updated?.Invoke(this, new(nameof(Channel)));
+ Updated?.Invoke(sender: this, e: new(nameof(Channel)));
}
}
}
@@ -323,7 +338,7 @@ public int Bank {
set {
if (value != _bank) {
_bank = value;
- Updated?.Invoke(this, new(nameof(Bank)));
+ Updated?.Invoke(sender: this, e: new(nameof(Bank)));
}
}
}
@@ -344,7 +359,7 @@ public int Program {
set {
if (value != _program) {
_program = value;
- Updated?.Invoke(this, new(nameof(Program)));
+ Updated?.Invoke(sender: this, e: new(nameof(Program)));
}
}
}
@@ -365,7 +380,7 @@ public int Volume {
set {
if (value != _volume) {
_volume = value;
- Updated?.Invoke(this, new(nameof(Volume)));
+ Updated?.Invoke(sender: this, e: new(nameof(Volume)));
}
}
}
@@ -378,7 +393,7 @@ public int Pan {
set {
if (value != _pan) {
_pan = value;
- Updated?.Invoke(this, new(nameof(Pan)));
+ Updated?.Invoke(sender: this, e: new(nameof(Pan)));
}
}
}
diff --git a/MidiPlayer/PlayList.cs b/MidiPlayer/PlayList.cs
index cf0ee96..42acaba 100644
--- a/MidiPlayer/PlayList.cs
+++ b/MidiPlayer/PlayList.cs
@@ -1,48 +1,65 @@
-
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
using System.Collections.Generic;
namespace MidiPlayer {
///
/// playlist for synth
///
+ ///
+ /// h.adachi (STUDIO MeowToon)
+ ///
public class PlayList {
#nullable enable
///////////////////////////////////////////////////////////////////////////////////////////////
// Fields [nouns, noun phrases]
- List _targetList = new();
+ List _target_list = new();
- int _idx;
+ int _index;
///////////////////////////////////////////////////////////////////////////////////////////////
// Constructor
public PlayList() {
- _idx = 0;
+ _index = 0;
}
///////////////////////////////////////////////////////////////////////////////////////////////
// Properties [noun, noun phrase, adjective]
public bool Ready {
- get => _targetList.Count == 0 ? false : true;
+ get => _target_list.Count == 0 ? false : true;
}
public string[] List {
- get => _targetList.ToArray();
+ get => _target_list.ToArray();
}
public string Current {
- get => _targetList[_idx];
+ get => _target_list[_index];
}
public string Next {
get {
- if (_idx == _targetList.Count) {
- _idx = 0;
+ if (_index == _target_list.Count) {
+ _index = 0;
}
- return _targetList[_idx++];
+ return _target_list[_index++];
}
}
@@ -50,11 +67,11 @@ public string Next {
// public Methods [verb, verb phrases]
public void Add(string target) {
- _targetList.Add(target);
+ _target_list.Add(target);
}
public void Clear() {
- _targetList.Clear();
+ _target_list.Clear();
}
}
}