Fix playhead smoothing when auditioning.
[ardour.git] / gtk2_ardour / region_editor.cc
index bb0199678ee5be339300217553dbb86f4a983a64..36c648b7128d71815777a4aa52693d614359a5bb 100644 (file)
@@ -64,7 +64,9 @@ RegionEditor::RegionEditor (Session* s, boost::shared_ptr<Region> r)
 {
        set_session (s);
 
-       _clock_group->set_clock_mode (ARDOUR_UI::instance()->secondary_clock->mode());
+       _clock_group->set_clock_mode (ARDOUR_UI::instance()->primary_clock->mode());
+       ARDOUR_UI::instance()->primary_clock->mode_changed.connect (sigc::mem_fun (*this, &RegionEditor::set_clock_mode_from_primary));
+
        _clock_group->add (position_clock);
        _clock_group->add (end_clock);
        _clock_group->add (length_clock);
@@ -202,6 +204,12 @@ RegionEditor::~RegionEditor ()
        delete _clock_group;
 }
 
+void
+RegionEditor::set_clock_mode_from_primary ()
+{
+       _clock_group->set_clock_mode (ARDOUR_UI::instance()->primary_clock->mode());
+}
+
 void
 RegionEditor::region_changed (const PBD::PropertyChange& what_changed)
 {
@@ -315,7 +323,7 @@ RegionEditor::end_clock_changed ()
 void
 RegionEditor::length_clock_changed ()
 {
-       framecnt_t frames = length_clock.current_time();
+       samplecnt_t samples = length_clock.current_time();
        bool in_command = false;
        boost::shared_ptr<Playlist> pl = _region->playlist();
 
@@ -324,7 +332,7 @@ RegionEditor::length_clock_changed ()
                in_command = true;
 
                _region->clear_changes ();
-               _region->trim_end (_region->position() + frames - 1);
+               _region->trim_end (_region->position() + samples - 1);
                _session->add_command(new StatefulDiffCommand (_region));
        }
 
@@ -370,7 +378,7 @@ RegionEditor::bounds_changed (const PropertyChange& what_changed)
 
        if (what_changed.contains (ARDOUR::Properties::sync_position) || what_changed.contains (ARDOUR::Properties::position)) {
                int dir;
-               frameoffset_t off = _region->sync_offset (dir);
+               sampleoffset_t off = _region->sync_offset (dir);
                if (dir == -1) {
                        off = -off;
                }