Skip to content

Commit

Permalink
2.5.1.0 Improved MIDI file Player UI.
Browse files Browse the repository at this point in the history
  • Loading branch information
110-kenichi committed Nov 7, 2020
1 parent ee22a33 commit e79105f
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 17 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MAmidiMEmo V2.5.0.0 / Itoken (c)2019, 2020 / GPL-2.0
MAmidiMEmo V2.5.1.0 / Itoken (c)2019, 2020 / GPL-2.0

*** What is the MAmidiMEmo? ***

Expand Down Expand Up @@ -234,6 +234,7 @@ e.g.) YM2151 has 8ch FM sounds, so you can play 8 chords on MIDI 1ch or sharing

*** Changes ***

2.5.1.0 Improved MIDI file Player UI.
2.5.0.0 Added MIDI file Player tab.
Supported MAmidi file that is MAmi file and midi file are archived file. To create MAmidi file, load midi file and export MAmidi file.
Fixed portamento time (Almost the same as the GS module portamento time).
Expand Down
21 changes: 17 additions & 4 deletions src/mamidimemo/Gui/FormMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions src/mamidimemo/Gui/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ public FormMain()
pianoControl1.NoteOff += PianoControl1_NoteOff;
pianoControl1.EntryDataChanged += PianoControl1_EntryDataChanged;

MidiManager.MidiEventReceived += MidiManager_MidiEventReceived;

ImageUtility.AdjustControlImagesDpiScale(this);
}

Expand Down Expand Up @@ -825,7 +827,10 @@ private void timer1_Tick(object sender, EventArgs e)
if (tabControlBottom.SelectedTab == tabPage1)
tabPage1.Invalidate();
else if (tabControlBottom.SelectedTab == tabPage4)
{
panelOsc2.Invalidate();
panelChDisp.Invalidate();
}

clockCounter++;
if (clockCounter > 100 / timerOsc.Interval)
Expand Down Expand Up @@ -1397,5 +1402,53 @@ private void exportMAmidiToolStripMenuItem_Click(object sender, EventArgs e)
}
}
}

private void MidiManager_MidiEventReceived(object sender, MidiEvent e)
{
if (e.EventType == MidiEventType.NoteOn)
{
NoteOnEvent noe = (NoteOnEvent)e;
if (noe.Velocity != 0)
{
lock (chNoteOnData)
chNoteOnData[noe.Channel] = noe.Velocity;
}
}
}

private int[] chNoteOnData = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

private Brush chDispBarBrush = new SolidBrush(Color.FromArgb(115, 63, 0));

private Brush chDispBackBrush = new SolidBrush(Color.FromArgb(229, 126, 0));

/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void panelChDisp_Paint(object sender, PaintEventArgs e)
{
int w = (panelChDisp.Width / 16);
int bw = w - (2 * 2);
int h = panelChDisp.Height;
int bh = h - (2 * 2);
var g = e.Graphics;

for (int i = 0; i < 16; i++)
{
var vel = chNoteOnData[i];

int x = i * w + 2;
int y = bh * (127 - vel) / 127;
g.FillRectangle(chDispBackBrush, x, 2, bw, y);
g.FillRectangle(chDispBarBrush, x, 2 + y, bw, bh - y);

vel -= 8;
if (vel < 0)
vel = 0;
chNoteOnData[i] = vel;
}
}
}
}
52 changes: 41 additions & 11 deletions src/mamidimemo/Gui/FormMain.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1816,14 +1816,14 @@
<data name="tableLayoutPanel1.ColumnCount" type="System.Int32, mscorlib">
<value>8</value>
</data>
<data name="metroTrackBarVol.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
<data name="metroTrackBarVol.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>None</value>
</data>
<data name="metroTrackBarVol.Location" type="System.Drawing.Point, System.Drawing">
<value>245, 45</value>
</data>
<data name="metroTrackBarVol.Size" type="System.Drawing.Size, System.Drawing">
<value>127, 41</value>
<value>144, 41</value>
</data>
<data name="metroTrackBarVol.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
Expand Down Expand Up @@ -1876,23 +1876,23 @@
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="labelClock.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>None</value>
</data>
<data name="labelClock.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="labelClock.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="labelClock.Font" type="System.Drawing.Font, System.Drawing">
<value>MS UI Gothic, 24pt</value>
</data>
<data name="labelClock.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="labelClock.Location" type="System.Drawing.Point, System.Drawing">
<value>69, 3</value>
<value>93, 3</value>
</data>
<data name="labelClock.Size" type="System.Drawing.Size, System.Drawing">
<value>133, 39</value>
<value>84, 39</value>
</data>
<data name="labelClock.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
Expand All @@ -1915,6 +1915,9 @@
<data name="&gt;&gt;labelClock.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="panelOsc2.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>None</value>
</data>
<data name="panelOsc2.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 45</value>
</data>
Expand Down Expand Up @@ -2092,6 +2095,9 @@
<data name="&gt;&gt;label4.ZOrder" xml:space="preserve">
<value>8</value>
</data>
<data name="labelCpuLoad.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>None</value>
</data>
<data name="labelCpuLoad.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
Expand All @@ -2102,7 +2108,7 @@
<value>NoControl</value>
</data>
<data name="labelCpuLoad.Location" type="System.Drawing.Point, System.Drawing">
<value>774, 42</value>
<value>774, 46</value>
</data>
<data name="labelCpuLoad.Size" type="System.Drawing.Size, System.Drawing">
<value>61, 39</value>
Expand All @@ -2128,6 +2134,30 @@
<data name="&gt;&gt;labelCpuLoad.ZOrder" xml:space="preserve">
<value>9</value>
</data>
<data name="panelChDisp.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="panelChDisp.Location" type="System.Drawing.Point, System.Drawing">
<value>395, 45</value>
</data>
<data name="panelChDisp.Size" type="System.Drawing.Size, System.Drawing">
<value>324, 41</value>
</data>
<data name="panelChDisp.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="&gt;&gt;panelChDisp.Name" xml:space="preserve">
<value>panelChDisp</value>
</data>
<data name="&gt;&gt;panelChDisp.Type" xml:space="preserve">
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;panelChDisp.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;panelChDisp.ZOrder" xml:space="preserve">
<value>10</value>
</data>
<data name="tableLayoutPanel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
Expand Down Expand Up @@ -2159,7 +2189,7 @@
<value>0</value>
</data>
<data name="tableLayoutPanel1.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="metroTrackBarVol" Row="1" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="label1" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="labelClock" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="panelOsc2" Row="1" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;Control Name="labelTitle" Row="0" RowSpan="1" Column="4" ColumnSpan="4" /&gt;&lt;Control Name="labelStat" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="label2" Row="1" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="label3" Row="0" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="label4" Row="1" RowSpan="1" Column="6" ColumnSpan="1" /&gt;&lt;Control Name="labelCpuLoad" Row="1" RowSpan="1" Column="7" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Percent,50,AutoSize,50,AutoSize,50" /&gt;&lt;Rows Styles="AutoSize,0,AutoSize,0,Percent,100" /&gt;&lt;/TableLayoutSettings&gt;</value>
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="metroTrackBarVol" Row="1" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="label1" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="labelClock" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="panelOsc2" Row="1" RowSpan="1" Column="0" ColumnSpan="3" /&gt;&lt;Control Name="labelTitle" Row="0" RowSpan="1" Column="4" ColumnSpan="4" /&gt;&lt;Control Name="labelStat" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="label2" Row="1" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="label3" Row="0" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="label4" Row="1" RowSpan="1" Column="6" ColumnSpan="1" /&gt;&lt;Control Name="labelCpuLoad" Row="1" RowSpan="1" Column="7" ColumnSpan="1" /&gt;&lt;Control Name="panelChDisp" Row="1" RowSpan="1" Column="5" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Percent,50,AutoSize,50,AutoSize,50" /&gt;&lt;Rows Styles="AutoSize,0,AutoSize,0,Percent,100" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="panel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
Expand Down Expand Up @@ -2468,7 +2498,7 @@
<value>&amp;FILE</value>
</data>
<data name="settingsToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>180, 22</value>
<value>125, 22</value>
</data>
<data name="settingsToolStripMenuItem.Text" xml:space="preserve">
<value>&amp;Settings...</value>
Expand Down
2 changes: 1 addition & 1 deletion src/mamidimemo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static class Program
/// <summary>
///
/// </summary>
public const string FILE_VERSION = "2.5.0.0";
public const string FILE_VERSION = "2.5.1.0";

public const string FILE_COPYRIGHT = @"Virtual chiptune sound MIDI module ""MAmidiMEmo"" Version {0}
Copyright(C) 2019, 2020 Itoken.All rights reserved.";
Expand Down

0 comments on commit e79105f

Please sign in to comment.