Skip to content

Commit

Permalink
refactor: compare with Accidental.natural
Browse files Browse the repository at this point in the history
  • Loading branch information
albertms10 committed Apr 8, 2023
1 parent 6060e73 commit 2c0882f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/src/classes/enharmonic_note.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class EnharmonicNote extends Enharmonic<Note> {
(note) => note.accidental == preferredAccidental,
) ??
enharmonicNotes.firstWhereOrNull(
(note) => note.accidental.semitones == 0,
(note) => note.accidental == Accidental.natural,
) ??
enharmonicNotes.first;
}
Expand Down
3 changes: 2 additions & 1 deletion lib/src/note/note.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ class Note implements MusicItem, Comparable<Note> {

@override
String toString() =>
note.name + (accidental.semitones != 0 ? ' ${accidental.symbol}' : '');
note.name +
(accidental != Accidental.natural ? ' ${accidental.symbol}' : '');

@override
bool operator ==(Object other) =>
Expand Down

0 comments on commit 2c0882f

Please sign in to comment.