|
|
|
@ -49,7 +49,7 @@ namespace MusicBoxConverter |
|
|
|
|
// Set the scale factor based on the strip height of the music box |
|
|
|
|
scaleFactor = new Vector2( |
|
|
|
|
scaleFactor.X, |
|
|
|
|
MusicBox.StripHeightMm / MusicBox.NoteCount |
|
|
|
|
MusicBox.StripHeightMm / (MusicBox.NoteCount-1) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
foreach(Note note in AllNotes()) { |
|
|
|
@ -60,7 +60,7 @@ namespace MusicBoxConverter |
|
|
|
|
|
|
|
|
|
public void Output(string destinationFilename) |
|
|
|
|
{ |
|
|
|
|
Vector2 area = new Vector2(TrackLength, MusicBox.NoteCount).Multiply(scaleFactor); |
|
|
|
|
Vector2 area = new Vector2(TrackLength, MusicBox.NoteCount-1).Multiply(scaleFactor); |
|
|
|
|
Vector2 size = area.Add(offset.Multiply(2)); |
|
|
|
|
|
|
|
|
|
SvgWriter svg = new SvgWriter( |
|
|
|
@ -72,10 +72,10 @@ namespace MusicBoxConverter |
|
|
|
|
for(float i = 0; i < area.Y; i += scaleFactor.Y) |
|
|
|
|
{ |
|
|
|
|
Vector2 start = offset.Add(new Vector2(0, i)); |
|
|
|
|
svg.WriteLine(start, start.Add(new Vector2(area.X, 0)), "darkgreen", 1); |
|
|
|
|
svg.WriteLine(start, start.Add(new Vector2(area.X, 0)), "darkgreen", 0.75f); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
svg.WriteRectangle(offset, area); |
|
|
|
|
svg.WriteRectangle(offset, area, "red", 0.75f); |
|
|
|
|
|
|
|
|
|
foreach(Note note in AllNotes()) |
|
|
|
|
{ |
|
|
|
@ -83,7 +83,7 @@ namespace MusicBoxConverter |
|
|
|
|
svg.WriteCircle( |
|
|
|
|
new Vector2( |
|
|
|
|
offset.X + note.Time * scaleFactor.X, |
|
|
|
|
offset.Y + (MusicBox.NoteCount - MusicBox.NoteToBoxNumber(note)) * scaleFactor.Y |
|
|
|
|
offset.Y + ((MusicBox.NoteCount-1) - MusicBox.NoteToBoxNumber(note)) * scaleFactor.Y |
|
|
|
|
), |
|
|
|
|
holeSize // radius |
|
|
|
|
); |
|
|
|
|