diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-04-11 14:06:50 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-04-11 14:06:50 +0000 |
commit | cb413146428ce5db5e281d70f2b3b7df27c1aaab (patch) | |
tree | 4961e9dcb107f2ca1f0a4298faf5135ba8611d92 /gtk2_ardour/audio_clock.cc | |
parent | 9aa8af5a28abbb86c9ae86c6991838eb6828d0a9 (diff) |
merge 3.0 from 2.0-ongoing@3243
git-svn-id: svn://localhost/ardour2/branches/3.0@3248 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/audio_clock.cc')
-rw-r--r-- | gtk2_ardour/audio_clock.cc | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index e1b80cc073..3ca5ca38e4 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -83,7 +83,8 @@ AudioClock::AudioClock (std::string clock_name, bool transient, std::string widg key_entry_state = 0; ops_menu = 0; dragging = false; - + bbt_reference_time = -1; + if (with_info) { frames_upper_info_label = manage (new Label); frames_lower_info_label = manage (new Label); @@ -632,6 +633,15 @@ AudioClock::set_bbt (nframes_t when, bool force) BBT_Time bbt; session->tempo_map().bbt_time (when, bbt); + + /* handle a common case */ + + if (is_duration && when == 0) { + bbt.bars = 0; + bbt.beats = 0; + + } + sprintf (buf, "%03" PRIu32, bbt.bars); bars_label.set_text (buf); sprintf (buf, "%02" PRIu32, bbt.beats); @@ -640,7 +650,16 @@ AudioClock::set_bbt (nframes_t when, bool force) ticks_label.set_text (buf); if (bbt_upper_info_label) { - TempoMap::Metric m (session->tempo_map().metric_at (when)); + nframes64_t pos; + + if (bbt_reference_time < 0) { + pos = when; + } else { + pos = bbt_reference_time; + } + + TempoMap::Metric m (session->tempo_map().metric_at (pos)); + sprintf (buf, "%-5.2f", m.tempo().beats_per_minute()); if (bbt_lower_info_label->get_text() != buf) { bbt_lower_info_label->set_text (buf); @@ -1994,3 +2013,9 @@ AudioClock::set_size_requests () } } + +void +AudioClock::set_bbt_reference (nframes64_t pos) +{ + bbt_reference_time = pos; +} |