Sha256: 51589f03b6b5d059ffc5e980796b22ce94d5b60764929481c0d400397c81e2b9

Contents?: true

Size: 582 Bytes

Versions: 10

Compression:

Stored size: 582 Bytes

Contents

module HeadMusic::Style::Annotations
end

class HeadMusic::Style::Annotations::OneToOne < HeadMusic::Style::Annotation
  MESSAGE = 'Place a note for each note in the other voice.'

  def marks
    if cantus_firmus && cantus_firmus.notes.length > 0
      HeadMusic::Style::Mark.for_each(
        notes_without_match(voice, cantus_firmus) + notes_without_match(cantus_firmus, voice)
      )
    end
  end

  private

  def notes_without_match(voice1, voice2)
    voice1.notes.reject do |voice1_note|
      voice2.notes.map(&:position).include?(voice1_note.position)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
head_music-0.17.0 lib/head_music/style/annotations/one_to_one.rb
head_music-0.16.2 lib/head_music/style/annotations/one_to_one.rb
head_music-0.16.0 lib/head_music/style/annotations/one_to_one.rb
head_music-0.14.8 lib/head_music/style/annotations/one_to_one.rb
head_music-0.14.7 lib/head_music/style/annotations/one_to_one.rb
head_music-0.14.5 lib/head_music/style/annotations/one_to_one.rb
head_music-0.14.4 lib/head_music/style/annotations/one_to_one.rb
head_music-0.14.2 lib/head_music/style/annotations/one_to_one.rb
head_music-0.14.1 lib/head_music/style/annotations/one_to_one.rb
head_music-0.13.2 lib/head_music/style/annotations/one_to_one.rb