Module: Sunniesnow::Charter::Metronomic
- Included in:
- Event, TimeDependent::DataPoint, TimeDependent::PiecewiseData
- Defined in:
- lib/sscharter/charter/beat.rb
Instance Attribute Summary collapse
- #beat ⇒ Integer, Rational
- #bpm_changes ⇒ BpmChangeList readonly
- #duration_beats ⇒ Integer, ...
- #offset ⇒ Float
Instance Method Summary collapse
- #<=>(other) ⇒ -1, ...
-
#beat_state ⇒ Object
BeatState.
- #end_time ⇒ Float
- #time ⇒ Float
- #time_at_relative_beat(delta_beat) ⇒ Float
Instance Attribute Details
#beat ⇒ Integer, Rational
128 129 130 |
# File 'lib/sscharter/charter/beat.rb', line 128 def beat @beat end |
#bpm_changes ⇒ BpmChangeList (readonly)
134 135 136 |
# File 'lib/sscharter/charter/beat.rb', line 134 def bpm_changes @bpm_changes end |
#duration_beats ⇒ Integer, ...
131 132 133 |
# File 'lib/sscharter/charter/beat.rb', line 131 def duration_beats @duration_beats end |
#offset ⇒ Float
125 126 127 |
# File 'lib/sscharter/charter/beat.rb', line 125 def offset @offset end |
Instance Method Details
#<=>(other) ⇒ -1, ...
160 161 162 |
# File 'lib/sscharter/charter/beat.rb', line 160 def <=> other @beat <=> other.beat end |
#beat_state ⇒ Object
Note:
Internal API.
Returns BeatState.
154 155 156 |
# File 'lib/sscharter/charter/beat.rb', line 154 def beat_state BeatState.new @beat, @bpm_changes end |
#end_time ⇒ Float
148 149 150 |
# File 'lib/sscharter/charter/beat.rb', line 148 def end_time time_at_relative_beat @duration_beats || 0 end |
#time ⇒ Float
143 144 145 |
# File 'lib/sscharter/charter/beat.rb', line 143 def time time_at_relative_beat 0 end |
#time_at_relative_beat(delta_beat) ⇒ Float
138 139 140 |
# File 'lib/sscharter/charter/beat.rb', line 138 def time_at_relative_beat delta_beat @offset + @bpm_changes.time_at(@beat + delta_beat) end |