Method: Chords::Fingering#add_duplicate
- Defined in:
- lib/chords/fingering.rb
#add_duplicate(opts = {}) ⇒ Object
returns variations of this fingering with one duplicate note added
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/chords/fingering.rb', line 55 def add_duplicate(opts={}) return [] if unused_strings < 1 max_fret_dist = opts[:max_fret_distance] || DEFAULT_MAX_FRET_DISTANCE fingerings = [] @positions.each_with_index do |pos, i| next unless pos.nil? each_note do |note| new_note_positions(note, i, max_fret_dist).each do |pos| new_positions = @positions.dup new_positions[i] = pos fingerings << Fingering.new(@fretboard, new_positions) end end end fingerings end |