Class: Lydown::Translation::Ripple::Note
- Defined in:
- lib/lydown/translation/ripple/nodes.rb
Defined Under Namespace
Classes: Articulation, Duration, Expression, Grace, Head
Instance Method Summary collapse
Methods inherited from Root
#_translate, #check_line_break, #source_line
Instance Method Details
#translate(stream, opts) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/lydown/translation/ripple/nodes.rb', line 48 def translate(stream, opts) check_line_break(stream, opts) note = {expressions: []} _translate(self, note, opts) expressions = note[:expressions].join expressions << ' ' unless expressions.empty? unless opts[:first_note] || note[:head] =~ /^[rs]/ octave = Lydown::Rendering::Octaves.absolute_octave( note[:head], opts[:relative_start_octave] || 'c' ) if note[:head] =~ /[',]+$/ note[:head].gsub!(/[',]+/, octave) else note[:head] << octave end opts[:first_note] = note[:head] end if opts[:post_macro_value] note[:duration] ||= opts[:post_macro_value] opts[:post_macro_value] = nil end if note[:duration] && note[:grace] note[:duration] += note[:grace] end stream << "%s%s%s" % [ note[:duration], note[:head], expressions ] end |