Class: HeadMusic::Style::Guidelines::SetAgainstAnotherVoice

Inherits:
HeadMusic::Style::Guideline show all
Defined in:
lib/head_music/style/guidelines/set_against_another_voice.rb

Overview

Flags a voice with no companion to be set against: without this the harmonic guidelines reach for a cantus firmus that is not there and raise mid-grading.

Named for what it checks. Guideline’s cantus_firmus is the voice marked as one or else the first other voice, so HasCantusFirmus would claim more.

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from HeadMusic::Style::Guideline

Instance Method Details

#companion_sounds?Boolean (private)

Returns:

  • (Boolean)


19
20
21
# File 'lib/head_music/style/guidelines/set_against_another_voice.rb', line 19

def companion_sounds?
  !!cantus_firmus&.notes&.any?
end

#marksObject



10
11
12
13
14
15
# File 'lib/head_music/style/guidelines/set_against_another_voice.rb', line 10

def marks
  return if companion_sounds?
  return no_placements_mark if placements.empty?

  HeadMusic::Style::Mark.for_all(placements, fitness: 0)
end