Class: Musa::MusicXML::Builder::Internal::Metronome Private

Inherits:
DirectionType
  • Object
show all
Includes:
Helper
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.

Metronome tempo marking direction type.

Represents tempo markings with beat unit and metronome value (e.g., ♩ = 120). Supports dotted beat units.

Examples:

Quarter note = 120 BPM

metronome beat_unit: 'quarter', per_minute: '120'

Dotted eighth = 90

metronome beat_unit: 'eighth', beat_unit_dots: 1, per_minute: '90'

Instance Method Summary collapse

Constructor Details

#initialize(beat_unit:, beat_unit_dots: nil, per_minute:, &block) ⇒ Metronome

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.

TODO complete Metronome complexity!



232
233
234
235
236
237
238
239
240
241
242
# File 'lib/musa-dsl/musicxml/builder/direction.rb', line 232

def initialize(beat_unit:, # quarter / eighth / ...
               beat_unit_dots: nil, # number
               per_minute:, #string
               &block)

  @beat_unit = beat_unit
  @beat_unit_dots = beat_unit_dots
  @per_minute = per_minute

  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.



248
249
250
251
252
253
254
255
256
257
258
# File 'lib/musa-dsl/musicxml/builder/direction.rb', line 248

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

  io.puts "#{tabs}\t<beat-unit>#{@beat_unit}</beat-unit>"
  @beat_unit_dots&.times do
    io.puts "#{tabs}\t<beat-unit-dot />"
  end
  io.puts "#{tabs}\t<per-minute>#{@per_minute}</per-minute>"

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