Skip to content

Commit

Permalink
Completed changes for numericMIDI 18.01.2017
Browse files Browse the repository at this point in the history
All test scores now compile, and create <score:midi>
elements having the form documented in Moritz
issue #2.
Final bug fixes: InputVoices must contain InputRestDefs,
not MidiRestDefs. This error corrected in both
Study3Sketch2Algorithm.cs and Block.cs.
  • Loading branch information
notator committed Jan 18, 2017
1 parent b44b0d6 commit 1106967
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Moritz.Algorithm/Study 3.2/Study3Sketch2Algorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private InputVoiceDef GetBar1InputVoiceDef(Seq bar1Seq)
MidiChordDef tmcd = tIud as MidiChordDef;
if(tRestDef != null)
{
MidiRestDef iRestDef = new MidiRestDef(tRestDef.MsPositionReFirstUD, tRestDef.MsDuration);
InputRestDef iRestDef = new InputRestDef(tRestDef.MsPositionReFirstUD, tRestDef.MsDuration);
ivd.Add(iRestDef);
}
else if(tmcd != null)
Expand Down
18 changes: 16 additions & 2 deletions Moritz.Spec/Block.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,28 @@ protected void Blockify()
int startRestMsDuration = voiceDef.MsPositionReContainer;
if(startRestMsDuration > 0)
{
voiceDef.Insert(0, new MidiRestDef(0, startRestMsDuration));
if(voiceDef is InputVoiceDef)
{
voiceDef.Insert(0, new InputRestDef(0, startRestMsDuration));
}
else
{
voiceDef.Insert(0, new MidiRestDef(0, startRestMsDuration));
}
}

int endOfTrkMsPositionReFirstIUD = voiceDef.EndMsPositionReFirstIUD;
int endRestMsDuration = blockMsDuration - endOfTrkMsPositionReFirstIUD;
if(endRestMsDuration > 0)
{
voiceDef.UniqueDefs.Add(new MidiRestDef(endOfTrkMsPositionReFirstIUD, endRestMsDuration));
if(voiceDef is InputVoiceDef)
{
voiceDef.UniqueDefs.Add(new InputRestDef(endOfTrkMsPositionReFirstIUD, endRestMsDuration));
}
else
{
voiceDef.UniqueDefs.Add(new MidiRestDef(endOfTrkMsPositionReFirstIUD, endRestMsDuration));
}
}
voiceDef.AgglomerateRests();
}
Expand Down
2 changes: 1 addition & 1 deletion Moritz.Spec/InputChordDef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void Transpose(int interval)

public override string ToString()
{
return ("MsPositionReFirstIUD=" + MsPositionReFirstUD.ToString() + " MsDuration=" + MsDuration.ToString() + " InputChordDef");
return ("InputChordDef: MsPositionReFirstIUD=" + MsPositionReFirstUD.ToString() + " MsDuration=" + MsDuration.ToString());
}

/// <summary>
Expand Down

0 comments on commit 1106967

Please sign in to comment.