class Music::Transcription::Tempo
Constants
- CONVERSION_METHOD
- PARSER
Attributes
value[R]
Public Class Methods
new(value)
click to toggle source
# File lib/music-transcription/model/tempo.rb, line 6 def initialize value raise NonPositiveError, "Given tempo value #{value} is not positive" if value <= 0 @value = value end
Public Instance Methods
==(other)
click to toggle source
# File lib/music-transcription/model/tempo.rb, line 11 def ==(other) self.class == other.class && self.value == other.value end
clone()
click to toggle source
# File lib/music-transcription/model/tempo.rb, line 15 def clone self.class.new(@value) end
convert(tgt_class, bdur = nil)
click to toggle source
# File lib/music-transcription/conversion/tempo_conversion.rb, line 5 def convert tgt_class, bdur = nil args = (is_a?(BPM) || tgt_class == BPM) ? [bdur] : [] return case tgt_class.new(1) when self.class then self.clone when Tempo::QNPM then to_qnpm(*args) when Tempo::NPM then to_npm(*args) when Tempo::NPS then to_nps(*args) when Tempo::BPM then to_bpm(*args) else raise TypeError, "Unexpected target tempo class #{tgt_class}" end end