Sha256: d65ae8d8cddbf6c90786e84bb61e3861278605e937aade6bb73c069b23a9be95

Contents?: true

Size: 651 Bytes

Versions: 9

Compression:

Stored size: 651 Bytes

Contents

# Module for style guidelines.
module HeadMusic::Style::Guidelines; end

# A counterpoint guideline
class HeadMusic::Style::Guidelines::OneToOne < HeadMusic::Style::Annotation
  MESSAGE = "Place a note for each note in the other voice."

  def marks
    return unless cantus_firmus&.notes
    return if cantus_firmus.notes.empty?

    HeadMusic::Style::Mark.for_each(
      notes_without_match(voice, cantus_firmus) + notes_without_match(cantus_firmus, voice)
    )
  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

9 entries across 9 versions & 1 rubygems

Version Path
head_music-7.0.5 lib/head_music/style/guidelines/one_to_one.rb
head_music-7.0.4 lib/head_music/style/guidelines/one_to_one.rb
head_music-7.0.3 lib/head_music/style/guidelines/one_to_one.rb
head_music-7.0.2 lib/head_music/style/guidelines/one_to_one.rb
head_music-7.0.1 lib/head_music/style/guidelines/one_to_one.rb
head_music-7.0.0 lib/head_music/style/guidelines/one_to_one.rb
head_music-6.0.1 lib/head_music/style/guidelines/one_to_one.rb
head_music-6.0.0 lib/head_music/style/guidelines/one_to_one.rb
head_music-5.0.0 lib/head_music/style/guidelines/one_to_one.rb