Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Commit

Permalink
Add tie selection to MUCOM88
Browse files Browse the repository at this point in the history
  • Loading branch information
rerrahkr committed Jun 11, 2019
1 parent c527b4a commit 1520212
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 28 deletions.
29 changes: 25 additions & 4 deletions ConvFMML/ConvFMML/Data/MML/Command/MUCOM88/MUCOM88Note.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@ public class MUCOM88Note : Note
protected override string GenerateString(Settings settings, SoundModule module)
{
int len = Length[0];
string str = Name + len.ToString();
string str = string.Empty;
Settings.NoteRest nrSettings = settings.noteRest;

if (nrSettings.TieStyle == 0 ||
(!CommandRelation.HasFlag(MMLCommandRelation.TieBefore) || CommandRelation.HasFlag(MMLCommandRelation.PrevControl)))
{
str += Name;
}
str += len.ToString();

int dotlen = 0;
for (int i = 1; i < Length.Count; i++)
{
Expand All @@ -24,17 +31,31 @@ protected override string GenerateString(Settings settings, SoundModule module)
str += ".";
dotlen++;
}
else // Tie and Name
else
{
str = str + "&" + Name + Length[i];
if (nrSettings.TieStyle == 0) // Tie and Name
{
str = str + "&" + Name + Length[i];
}
else // Tie only
{
str = str + "^" + Length[i];
}
dotlen = 0;
}
len = Length[i];
}

if (CommandRelation.HasFlag(MMLCommandRelation.TieAfter))
{
str += "&";
if (nrSettings.TieStyle == 1 && !CommandRelation.HasFlag(MMLCommandRelation.NextControl))
{
str += "^";
}
else
{
str += "&";
}
}

return str;
Expand Down
23 changes: 20 additions & 3 deletions ConvFMML/ConvFMML/Data/MML/Command/MUCOM88/MUCOM88Rest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@ public class MUCOM88Rest : Rest
protected override string GenerateString(Settings settings, SoundModule module)
{
int len = Length[0];
string str = "r" + len.ToString();
string str = string.Empty;
Settings.NoteRest nrSettings = settings.noteRest;

if (nrSettings.UnuseTiedRest || nrSettings.TieStyle == 0 ||
(!CommandRelation.HasFlag(MMLCommandRelation.TieBefore) || CommandRelation.HasFlag(MMLCommandRelation.PrevControl)))
{
str += "r";
}
str += len.ToString();

int dotlen = 0;
for (int i = 1; i < Length.Count; i++)
{
Expand All @@ -26,15 +33,25 @@ protected override string GenerateString(Settings settings, SoundModule module)
}
else
{
str = str + "r" + Length[i];
if (nrSettings.UnuseTiedRest || nrSettings.TieStyle == 0) // No Tie
{
str = str + "r" + Length[i];
}
else // Tie only
{
str = str + "^" + Length[i];
}
dotlen = 0;
}
len = Length[i];
}

if (!nrSettings.UnuseTiedRest && CommandRelation.HasFlag(MMLCommandRelation.TieAfter) && !CommandRelation.HasFlag(MMLCommandRelation.NextControl))
{
str += "&";
if (nrSettings.TieStyle == 1)
{
str += "^";
}
}

return str;
Expand Down
31 changes: 12 additions & 19 deletions ConvFMML/ConvFMML/Form/NoteRestPanel2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,14 @@ public override void UpdateSelections(MMLStyle mmlStyle)
{
case MMLStyle.MXDRV:
case MMLStyle.NRTDRV:
comboBox2.Items.AddRange(new string[] { Resources.TieLengthStyleC4AndC16, Resources.TieLengthStyleC4Hat16 });
break;
case MMLStyle.MUCOM88:
comboBox2.Items.AddRange(new string[] { Resources.TieLengthStyleC4AndC16, Resources.TieLengthStyleC4Hat16 });
break;
default:
comboBox2.Items.AddRange(new string[] { Resources.TieLengthStyleC4AndC16, Resources.TieLengthStyleC4And16 });
break;
}
if (mmlStyle == MMLStyle.MUCOM88)
{
label5.Enabled = false;
comboBox2.Enabled = false;
}
else
{
label5.Enabled = true;
comboBox2.Enabled = true;
comboBox2.SelectedIndex = settings.TieStyle;
}
comboBox2.SelectedIndex = settings.TieStyle;

if (mmlStyle == MMLStyle.Custom)
{
Expand All @@ -78,10 +67,12 @@ public override void UpdateSelections(MMLStyle mmlStyle)
{
case MMLStyle.FMP:
case MMLStyle.FMP7:
case MMLStyle.MUCOM88:
case MMLStyle.Mml2vgm:
checkBox3.Enabled = false;
break;
case MMLStyle.MUCOM88:
checkBox3.Enabled = (comboBox2.SelectedIndex != 0);
break;
default:
checkBox3.Enabled = true;
break;
Expand All @@ -93,18 +84,15 @@ public override void UpdateSelections(MMLStyle mmlStyle)

private void UpdateCheckBox2()
{
checkBox2.Enabled = (
comboBox1.SelectedIndex == 1
&& (!comboBox2.Enabled || comboBox2.SelectedIndex == 0)
);
checkBox2.Enabled = (comboBox1.SelectedIndex == 1 && comboBox2.SelectedIndex == 0);
}

private void UpdateComboBox1(ComboBox comboBox2)
{
comboBox1.Items.Clear();

string[] items;
if (!comboBox2.Enabled || comboBox2.SelectedIndex == 0)
if (comboBox2.SelectedIndex == 0)
{
items = new string[] { Resources.OverMeasureC4, Resources.OverMeasureC8AndC8 };
}
Expand Down Expand Up @@ -151,6 +139,11 @@ private void comboBox2_SelectionChangeCommitted(object sender, EventArgs e)
var cb = (ComboBox)sender;
settings.TieStyle = cb.SelectedIndex;
UpdateComboBox1(cb);

if (mmlStyle == MMLStyle.MUCOM88)
{
checkBox3.Enabled = (cb.SelectedIndex != 0);
}
}

private void checkBox3_CheckedChanged(object sender, EventArgs e)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ These parts are generated by splitting polyphony.
### Tips
- The number of MML parts increases by the number of polyphonic notes in MIDI.
- It is possible to change MML note names according to the scale by MIDI key signature events.
- If no beat, tempo and key signature events are set in the MIDI file, ConvFMML uses the default settings about them: 4/4 beat, 120 bpm and C major.
- Notes and rests are removed automatically if they cannot be expressed its length in MML resolution.
- If no beat, tempo and key signature events are set in the MIDI file, ConvFMML uses the default settings about them: 4/4 beat, bpm 120 and C major.
- Notes and rests are removed automatically if they cannot be expressed its length in MML clock count.
- The higher MML resolution, the better conversion accuracy but the shorter notes appear.
- Optimization processing for control commands is performed in the following order. In some cases, some commands may not be processed properly.
1. Remove commands not affected notes
Expand Down

0 comments on commit 1520212

Please sign in to comment.