Module: HeadMusic::Notation::PlacementValidation

Included in:
ABC::Writer, MusicXML::Writer
Defined in:
lib/head_music/notation/placement_validation.rb

Overview

Placement checks shared by the notation writers. Both the ABC and MusicXML writers reject percussion (unpitched) sounds identically; each includer supplies its own format-specific RenderError subclass through #render_error_class.

Instance Method Summary collapse

Instance Method Details

#ensure_pitched_sounds(placement) ⇒ Object (private)

Raises:

  • (render_error_class)


10
11
12
13
14
15
16
# File 'lib/head_music/notation/placement_validation.rb', line 10

def ensure_pitched_sounds(placement)
  unpitched = placement.sounds.find { |sound| !sound.pitched? }
  return unless unpitched

  raise render_error_class, "cannot render unpitched sound \"#{unpitched}\" at #{placement.position}: " \
    "percussion rendering is not yet supported"
end