diff options
author | Nick Mainsbridge <beatroute@iprimus.com.au> | 2006-09-04 16:04:09 +0000 |
---|---|---|
committer | Nick Mainsbridge <beatroute@iprimus.com.au> | 2006-09-04 16:04:09 +0000 |
commit | e513d106d7ecf7e629f55c6eb554a2638f9c6443 (patch) | |
tree | 7e83ab0e27756e4912ef75ba4ae1f5609ccc5467 /libs/ardour/tempo.cc | |
parent | cb17e3cc81c364ed0ea7f4620d745aefe691386a (diff) |
lower zoom step slightly, speed up autoscrolling when snapping to sub-beats (esp 32), make grid lines disappear when on coarse zoom, put grid lines in the idle thread (called from the idle thread.. interesting..), make current_bbt_points coarser so the bbt_ruler and grid lines can use it instead of making their own list, clean up bbt ruler.
git-svn-id: svn://localhost/ardour2/trunk@905 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/tempo.cc')
-rw-r--r-- | libs/ardour/tempo.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 02884f062b..c2ff4f9a3a 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -919,6 +919,33 @@ jack_nframes_t TempoMap::round_to_beat_subdivision (jack_nframes_t fr, int sub_num) { + + BBT_Time the_beat; + uint32_t ticks_one_half_subdivisions_worth; + uint32_t ticks_one_subdivisions_worth; + + bbt_time(fr, the_beat); + + ticks_one_subdivisions_worth = (uint32_t)Meter::ticks_per_beat / sub_num; + ticks_one_half_subdivisions_worth = ticks_one_subdivisions_worth / 2; + + if (the_beat.ticks % ticks_one_subdivisions_worth > ticks_one_half_subdivisions_worth) { + uint32_t difference = ticks_one_subdivisions_worth - (the_beat.ticks % ticks_one_subdivisions_worth); + if (the_beat.ticks + difference >= (uint32_t)Meter::ticks_per_beat) { + the_beat.beats++; + the_beat.ticks += difference; + the_beat.ticks -= (uint32_t)Meter::ticks_per_beat; + } else { + the_beat.ticks += difference; + } + } else { + the_beat.ticks -= the_beat.ticks % ticks_one_subdivisions_worth; + } + + return frame_time (the_beat); + + /* XXX just keeping this for reference + TempoMap::BBTPointList::iterator i; TempoMap::BBTPointList *more_zoomed_bbt_points; jack_nframes_t frame_one_beats_worth; @@ -970,6 +997,9 @@ TempoMap::round_to_beat_subdivision (jack_nframes_t fr, int sub_num) delete more_zoomed_bbt_points; return fr ; + + */ + } jack_nframes_t |