summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-10-07 18:33:20 +0000
committerCarl Hetherington <carl@carlh.net>2010-10-07 18:33:20 +0000
commitdd7258b29fe46722b1d62560c34c57d62154cb36 (patch)
treea493c8c99789911a87933ada52c94a5194ec6f5c /libs
parent3b0c5e35411fdb1a22eae54c8c574668b62f9c56 (diff)
Update auto loop range to match session range until it is changed by the user. Fixes #3472.
git-svn-id: svn://localhost/ardour2/branches/3.0@7883 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/session.h7
-rw-r--r--libs/ardour/location.cc14
-rw-r--r--libs/ardour/session.cc37
3 files changed, 52 insertions, 6 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index d10e01d18f..82b5d1360d 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -463,8 +463,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
nframes_t convert_to_frames_at (nframes_t position, AnyTime const &);
- static PBD::Signal0<void> StartTimeChanged;
- static PBD::Signal0<void> EndTimeChanged;
+ static PBD::Signal1<void, framepos_t> StartTimeChanged;
+ static PBD::Signal1<void, framepos_t> EndTimeChanged;
static PBD::Signal0<void> TimecodeOffsetChanged;
std::vector<SyncSource> get_available_sync_options() const;
@@ -1442,6 +1442,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
mutable gint _suspend_timecode_transmission;
void update_locations_after_tempo_map_change (Locations::LocationList &);
+
+ void start_time_changed (framepos_t);
+ void end_time_changed (framepos_t);
};
} // namespace ARDOUR
diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc
index 5f6f14ce14..7dce787b60 100644
--- a/libs/ardour/location.cc
+++ b/libs/ardour/location.cc
@@ -150,13 +150,16 @@ Location::set_start (framepos_t s, bool force, bool allow_bbt_recompute)
}
if (s != _start) {
+
+ framepos_t const old = _start;
+
_start = s;
if (allow_bbt_recompute) {
recompute_bbt_from_frames ();
}
start_changed (this); /* EMIT SIGNAL */
if (is_session_range ()) {
- Session::StartTimeChanged (); /* EMIT SIGNAL */
+ Session::StartTimeChanged (old); /* EMIT SIGNAL */
AudioFileSource::set_header_position_offset (s);
}
}
@@ -196,6 +199,8 @@ Location::set_end (framepos_t e, bool force, bool allow_bbt_recompute)
}
if (e != _end) {
+ framepos_t const old = _end;
+
_end = e;
if (allow_bbt_recompute) {
recompute_bbt_from_frames ();
@@ -203,7 +208,7 @@ Location::set_end (framepos_t e, bool force, bool allow_bbt_recompute)
end_changed(this); /* EMIT SIGNAL */
if (is_session_range()) {
- Session::EndTimeChanged (); /* EMIT SIGNAL */
+ Session::EndTimeChanged (old); /* EMIT SIGNAL */
}
}
@@ -688,6 +693,11 @@ Locations::add (Location *loc, bool make_current)
if (make_current) {
current_changed (current_location); /* EMIT SIGNAL */
}
+
+ if (loc->is_session_range()) {
+ Session::StartTimeChanged (0);
+ Session::EndTimeChanged (1);
+ }
}
void
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 8a3eb6a6c6..54fb4c20bd 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -119,8 +119,8 @@ PBD::Signal2<int,nframes_t,nframes_t> Session::AskAboutSampleRateMismatch;
PBD::Signal0<void> Session::SendFeedback;
PBD::Signal0<void> Session::TimecodeOffsetChanged;
-PBD::Signal0<void> Session::StartTimeChanged;
-PBD::Signal0<void> Session::EndTimeChanged;
+PBD::Signal1<void, framepos_t> Session::StartTimeChanged;
+PBD::Signal1<void, framepos_t> Session::EndTimeChanged;
PBD::Signal0<void> Session::AutoBindingOn;
PBD::Signal0<void> Session::AutoBindingOff;
PBD::Signal2<void,std::string, std::string> Session::Exported;
@@ -203,6 +203,9 @@ Session::Session (AudioEngine &eng,
DirtyChanged (); /* EMIT SIGNAL */
}
+ StartTimeChanged.connect_same_thread (*this, boost::bind (&Session::start_time_changed, this, _1));
+ EndTimeChanged.connect_same_thread (*this, boost::bind (&Session::end_time_changed, this, _1));
+
_is_new = false;
}
@@ -4028,3 +4031,33 @@ Session::step_edit_status_change (bool yn)
}
+void
+Session::start_time_changed (framepos_t old)
+{
+ /* Update the auto loop range to match the session range
+ (unless the auto loop range has been changed by the user)
+ */
+
+ Location* s = _locations->session_range_location ();
+ Location* l = _locations->auto_loop_location ();
+
+ if (l->start() == old) {
+ l->set_start (s->start(), true);
+ }
+}
+
+void
+Session::end_time_changed (framepos_t old)
+{
+ /* Update the auto loop range to match the session range
+ (unless the auto loop range has been changed by the user)
+ */
+
+ Location* s = _locations->session_range_location ();
+ Location* l = _locations->auto_loop_location ();
+
+ if (l->end() == old) {
+ cout << "set end to " << s->end() << "\n";
+ l->set_end (s->end(), true);
+ }
+}