Class: HeadMusic::Style::Guidelines::OneToOne
- Inherits:
-
Annotation
- Object
- Annotation
- HeadMusic::Style::Guidelines::OneToOne
- Defined in:
- lib/head_music/style/guidelines/one_to_one.rb
Overview
A counterpoint guideline
Constant Summary collapse
- MESSAGE =
"Place a note for each note in the other voice."
Instance Method Summary collapse
Constructor Details
This class inherits a constructor from HeadMusic::Style::Annotation
Instance Method Details
#marks ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/head_music/style/guidelines/one_to_one.rb', line 8 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 |
#notes_without_match(voice1, voice2) ⇒ Object (private)
19 20 21 22 23 |
# File 'lib/head_music/style/guidelines/one_to_one.rb', line 19 def notes_without_match(voice1, voice2) voice1.notes.reject do |voice1_note| voice2.notes.map(&:position).include?(voice1_note.position) end end |