Module: HeadMusic::Time::EventMapSupport
Overview
Shared support for MeterMap and TempoMap event management
Instance Method Summary collapse
- #compare_positions(first_position, second_position) ⇒ Object private
- #position_tuple(position) ⇒ Object private
- #positions_equal?(first_position, second_position) ⇒ Boolean private
- #sort_events! ⇒ Object private
Instance Method Details
#compare_positions(first_position, second_position) ⇒ Object (private)
20 21 22 |
# File 'lib/head_music/time/event_map_support.rb', line 20 def compare_positions(first_position, second_position) position_tuple(first_position) <=> position_tuple(second_position) end |
#position_tuple(position) ⇒ Object (private)
24 25 26 |
# File 'lib/head_music/time/event_map_support.rb', line 24 def position_tuple(position) [position., position.beat, position.tick, position.subtick] end |
#positions_equal?(first_position, second_position) ⇒ Boolean (private)
16 17 18 |
# File 'lib/head_music/time/event_map_support.rb', line 16 def positions_equal?(first_position, second_position) position_tuple(first_position) == position_tuple(second_position) end |
#sort_events! ⇒ Object (private)
9 10 11 12 13 14 |
# File 'lib/head_music/time/event_map_support.rb', line 9 def sort_events! @events.sort_by! do |event| position = event.position [position., position.beat, position.tick, position.subtick] end end |