Class: Musa::MusicXML::Builder::Internal::Dynamics Private

Inherits:
DirectionType
  • Object
show all
Defined in:
lib/musa-dsl/musicxml/builder/direction.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Dynamic marking direction type.

Represents dynamic levels (pp, p, mp, mf, f, ff, fff, etc.). Can specify multiple dynamics for compound markings.

Examples:

Single dynamic

measure.direction { dynamics 'f' }

Dynamics.new('f').to_xml.string
# => "<direction-type>\n\t<dynamics>\n\t\t<f />\n\t</dynamics>\n</direction-type>\n"

Multiple dynamics (sforzando-forte)

measure.direction { dynamics ['sf', 'f'] }

Instance Method Summary collapse

Constructor Details

#initialize(value, &block) ⇒ Dynamics

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

pp / ppp / ... or array of



325
326
327
328
329
# File 'lib/musa-dsl/musicxml/builder/direction.rb', line 325

def initialize(value, # pp / ppp / ... or array of
               &block)
  @dynamics = value.arrayfy
  super
end

Instance Method Details

#_direction_type_to_xml(io, indent:, tabs:) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



333
334
335
336
337
338
339
340
341
# File 'lib/musa-dsl/musicxml/builder/direction.rb', line 333

def _direction_type_to_xml(io, indent:, tabs:)
  io.puts "#{tabs}<dynamics>"

  @dynamics.each do |dynamics|
    io.puts "#{tabs}\t<#{dynamics} />"
  end

  io.puts "#{tabs}</dynamics>"
end