Class: Ramekin::LegatoLastNote

Inherits:
NoteWrapper show all
Defined in:
lib/ramekin/legato.rb

Constant Summary

Constants inherited from NoteEvent

NoteEvent::NOTES

Instance Attribute Summary

Attributes inherited from NoteEvent

#extensions, #note, #octave

Attributes inherited from Element

#channel, #components, #macro_stack, #start_tick

Instance Method Summary collapse

Methods inherited from NoteWrapper

#fin, #initialize, #meta, #note_name, #octave_amk, #rest?, #start, #tie?

Methods inherited from NoteEvent

#default_error_location, #default_length, #fin, #initialize, #length_amk, #meta, #note_hex, #note_name, #octave_amk, #octave_num, #octave_switching_amk, #repr, #rest?, #start, #tie?

Methods inherited from Element

#fin, make, #start

Constructor Details

This class inherits a constructor from Ramekin::NoteWrapper

Instance Method Details

#inspectObject



63
64
65
# File 'lib/ramekin/legato.rb', line 63

def inspect
  "legato-end(#{@note.inspect})"
end

#ticksObject



47
48
49
# File 'lib/ramekin/legato.rb', line 47

def ticks
  @note.ticks
end

#to_amk(current_octave = nil, divisor = 1) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/ramekin/legato.rb', line 51

def to_amk(current_octave=nil, divisor=1)
  post_ticks = @note.ticks - divisor
  if post_ticks <= 0 || post_ticks % divisor != 0
    return error! "too fast for legato: must have at least #{divisor*2} ticks at this bpm.", el: self
  end

  post_ticks /= divisor

  post_len = Util.nice_length_amk(post_ticks)
  "#{octave_amk(current_octave)}#{note_name}=1$f4$01^#{post_len}"
end