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)
|
public bool IsValidNote(Note note)
|
||||||
{
|
{
|
||||||
return ValidNotes.Contains(
|
return ValidNotes.Contains(
|
||||||
(note.NoteName.ToString() + note.Octave).Replace("Sharp", "")
|
$"{note.NoteName}{note.Octave}".Replace("Sharp", "#")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int NoteToBoxNumber(Note note)
|
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()
|
public override string ToString()
|
||||||
|
|
|
@ -109,11 +109,9 @@ namespace MusicBoxConverter
|
||||||
{
|
{
|
||||||
if(Debug) {
|
if(Debug) {
|
||||||
Console.WriteLine(
|
Console.WriteLine(
|
||||||
"[Note] {0}: {1}{2}/{3}",
|
$"[Note] {note.Time}: " +
|
||||||
note.Time,
|
$"{note.NoteName}{note.Octave}/{note.NoteNumber} " +
|
||||||
note.NoteName,
|
$"-> {SelectedMusicBox.NoteToBoxNumber(note)}"
|
||||||
note.Octave,
|
|
||||||
note.NoteNumber
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue