Shift up to hide dead space at the top
This commit is contained in:
parent
d527ac2184
commit
0d48715361
3 changed files with 18 additions and 7 deletions
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue