Shift up to hide dead space at the top

This commit is contained in:
Starbeamrainbowlabs 2017-12-03 11:36:47 +00:00
parent d527ac2184
commit 0d48715361
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
3 changed files with 18 additions and 7 deletions

View File

@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Melanchall.DryWetMidi.Smf.Interaction;
namespace MusicBoxConverter
@ -10,12 +10,25 @@ namespace MusicBoxConverter
public string Name { get; private set; }
public List<string> ValidNotes { get; private set; }
public Note LowestNote {
get {
return NoteUtilities.StringToNote(ValidNotes.First());
}
}
public Note HighestNote {
get {
return NoteUtilities.StringToNote(ValidNotes.Last());
}
}
private MusicBox(string inName, List<string> inValidNotes)
{
Name = inName;
ValidNotes = inValidNotes;
}
/// <summary>
/// Calculates whether the specified note can be played by this music box.
/// </summary>

View File

@ -28,15 +28,13 @@ namespace MusicBoxConverter
public int MaxNoteNumber {
get {
// TODO: Update to get the max note number supported by the music box
return AllNotes().Max((Note note) => note.NoteNumber);
return MusicBox.HighestNote.NoteNumber;
}
}
public int MinNoteNumber {
get
{
// TODO: Update to get the min note number supported by the music box
return AllNotes().Min((Note note) => note.NoteNumber);
return MusicBox.LowestNote.NoteNumber;
}
}
@ -73,7 +71,7 @@ namespace MusicBoxConverter
svg.WriteCircle(
new Vector2(
offset.X + note.Time * scaleFactor.X,
offset.Y + note.NoteNumber * scaleFactor.Y
offset.Y + note.NoteNumber * scaleFactor.Y - MinNoteNumber
),
holeSize // radius
);

View File

@ -18,7 +18,7 @@ namespace MusicBoxConverter
string noteLetter = Regex.Replace(note, "[0-9]", "").Replace("#", "Sharp");
int octave = int.Parse(Regex.Replace(note, "[^0-9]", ""));
NoteName noteName = (NoteName)Enum.Parse(typeof(NoteName), noteLetter);
return new Note(noteName, 4);
return new Note(noteName, octave);
}
}
}