ChordNoteSet constructor

ChordNoteSet(
  1. Instrument instrument,
  2. Chord chord
)

Implementation

factory ChordNoteSet(Instrument instrument, Chord chord) {
  if (instrument == Instrument.banjo && chord == Chord.g) {
    return ChordNoteSet._(chord: chord, instrument: instrument);
  } else {
    final notes = switch (instrument) {
      Instrument.banjo => _banjoChordNotes[chord],
      Instrument.guitar => _guitarChordNotes[chord],
    };
    if (notes == null) {
      return ChordNoteSet._unavailable(chord: chord, instrument: instrument);
    } else {
      return ChordNoteSet._(
        chord: chord,
        fretOffset: null,
        instrument: instrument,
        notes: notes,
      );
    }
  }
}