diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-04-17 15:22:07 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-04-17 15:22:07 +0000 |
commit | 25be940d3f041e76348f0208d9ad7f30f92e1af3 (patch) | |
tree | 72870434bc27f50a89349260c509d70a38ae37c5 /libs | |
parent | 05550ae584db4e309e08628970a38d623329233d (diff) |
initial pass at "ramping back" to existing automation values at the end of a touch pass
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6921 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/automation_event.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/io.h | 2 | ||||
-rw-r--r-- | libs/ardour/automation_event.cc | 37 | ||||
-rw-r--r-- | libs/ardour/io.cc | 21 |
4 files changed, 56 insertions, 6 deletions
diff --git a/libs/ardour/ardour/automation_event.h b/libs/ardour/ardour/automation_event.h index 02b306c355..9d405ec72f 100644 --- a/libs/ardour/ardour/automation_event.h +++ b/libs/ardour/ardour/automation_event.h @@ -136,7 +136,7 @@ class AutomationList : public PBD::StatefulDestructible } void start_touch (); - void stop_touch (); + void stop_touch (bool mark, double when); bool touching() const { return _touching; } void set_yrange (double min, double max) { diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index 556e30bfac..3ef3a5a6d4 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -268,6 +268,8 @@ class IO : public PBD::StatefulDestructible } virtual void automation_snapshot (nframes_t now, bool force); + Session& session() const { return _session; } + ARDOUR::Curve& gain_automation_curve () { return _gain_automation_curve; } void start_gain_touch (); diff --git a/libs/ardour/automation_event.cc b/libs/ardour/automation_event.cc index 4b666b178b..81347d5d40 100644 --- a/libs/ardour/automation_event.cc +++ b/libs/ardour/automation_event.cc @@ -60,6 +60,7 @@ AutomationList::AutomationList (double defval) _state = Off; _style = Absolute; _touching = false; + _new_touch = false; min_yval = FLT_MIN; max_yval = FLT_MAX; max_xval = 0; // means "no limit" @@ -84,6 +85,7 @@ AutomationList::AutomationList (const AutomationList& other) default_value = other.default_value; _state = other._state; _touching = other._touching; + _new_touch = false; _dirty = false; rt_insertion_point = events.end(); lookup_cache.left = -1; @@ -235,10 +237,41 @@ AutomationList::start_touch () } void -AutomationList::stop_touch () +AutomationList::stop_touch (bool mark, double when) { _touching = false; _new_touch = false; + + if (mark) { + /* get the value of the next point after "when", and replicate + it directly after when, unless of course its already there. + */ + + double val; + AutomationList::const_iterator i; + + for (i = const_begin(); i != const_end(); ++i) { + if ((*i)->when >= when) { + break; + } + } + + if (i == const_end()) { + val = default_value; + } else { + val = (*i)->value; + } + + /* if the existing point is at "when", add a new one right after it, + otherwise add it directly where the touch ended. + */ + + if ((*i)->when == when) { + when++; + } + + add (when, val); + } } void @@ -390,7 +423,7 @@ AutomationList::fast_simple_add (double when, double value) void AutomationList::add (double when, double value) { - /* this is for graphical editing */ + /* this is for making changes from some kind of user interface or control surface (GUI, MIDI, OSC etc) */ { Glib::Mutex::Lock lm (lock); diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index 4fef59fe01..2c4a31f70b 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -2668,7 +2668,15 @@ IO::start_gain_touch () void IO::end_gain_touch () { - _gain_automation_curve.stop_touch (); + bool mark = false; + double when = 0; + + if (_session.transport_rolling()) { + mark = true; + when = _session.transport_frame(); + } + + _gain_automation_curve.stop_touch (mark, when); } void @@ -2683,9 +2691,16 @@ void IO::end_pan_touch (uint32_t which) { if (which < _panner->size()) { - (*_panner)[which]->automation().stop_touch(); + bool mark = false; + double when = 0; + + if (_session.transport_rolling()) { + mark = true; + when = _session.transport_frame(); + } + + (*_panner)[which]->automation().stop_touch(mark, when); } - } void |