Bugfix: Correct MusicBox.IsValidNote() logic
This commit is contained in:
parent
a6cf844c4b
commit
42ab1f8494
2 changed files with 7 additions and 8 deletions
|
@ -47,13 +47,14 @@ namespace MusicBoxConverter
|
|||
public bool IsValidNote(Note note)
|
||||
{
|
||||
return ValidNotes.Contains(
|
||||
(note.NoteName.ToString() + note.Octave).Replace("Sharp", "")
|
||||
$"{note.NoteName}{note.Octave}".Replace("Sharp", "#")
|
||||
);
|
||||
}
|
||||
|
||||
public int NoteToBoxNumber(Note note)
|
||||
{
|
||||
return ValidNotes.FindIndex((string playableNote) => $"{note.NoteName}{note.Octave}".Replace("Sharp", "#") == playableNote);
|
||||
string noteCompare = $"{note.NoteName}{note.Octave}".Replace("Sharp", "#");
|
||||
return ValidNotes.FindIndex((string playableNote) => noteCompare == playableNote);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
|
|
@ -109,11 +109,9 @@ namespace MusicBoxConverter
|
|||
{
|
||||
if(Debug) {
|
||||
Console.WriteLine(
|
||||
"[Note] {0}: {1}{2}/{3}",
|
||||
note.Time,
|
||||
note.NoteName,
|
||||
note.Octave,
|
||||
note.NoteNumber
|
||||
$"[Note] {note.Time}: " +
|
||||
$"{note.NoteName}{note.Octave}/{note.NoteNumber} " +
|
||||
$"-> {SelectedMusicBox.NoteToBoxNumber(note)}"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue