NO-OP: clang-format
This commit is contained in:
parent
2338e25d31
commit
30efb2f178
|
@ -46,19 +46,20 @@
|
||||||
#include "evoral/TypeMap.h"
|
#include "evoral/TypeMap.h"
|
||||||
#include "evoral/types.h"
|
#include "evoral/types.h"
|
||||||
|
|
||||||
#include "pbd/control_math.h"
|
|
||||||
#include "pbd/compose.h"
|
#include "pbd/compose.h"
|
||||||
|
#include "pbd/control_math.h"
|
||||||
|
#include "pbd/debug.h"
|
||||||
#include "pbd/error.h"
|
#include "pbd/error.h"
|
||||||
#include "pbd/i18n.h"
|
#include "pbd/i18n.h"
|
||||||
#include "pbd/debug.h"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace PBD;
|
using namespace PBD;
|
||||||
using namespace Temporal;
|
using namespace Temporal;
|
||||||
|
|
||||||
namespace Evoral {
|
namespace Evoral
|
||||||
|
{
|
||||||
inline bool event_time_less_than (ControlEvent* a, ControlEvent* b)
|
inline bool
|
||||||
|
event_time_less_than (ControlEvent* a, ControlEvent* b)
|
||||||
{
|
{
|
||||||
return a->when < b->when;
|
return a->when < b->when;
|
||||||
}
|
}
|
||||||
|
@ -314,11 +315,11 @@ ControlList::list_merge (ControlList const& other, boost::function<double(double
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
Glib::Threads::RWLock::WriterLock lm (_lock);
|
Glib::Threads::RWLock::WriterLock lm (_lock);
|
||||||
EventList nel;
|
|
||||||
/* First scale existing events, copy into a new list.
|
/* First scale existing events, copy into a new list.
|
||||||
* The original list is needed later to interpolate
|
* The original list is needed later to interpolate
|
||||||
* for new events only present in the master list.
|
* for new events only present in the master list.
|
||||||
*/
|
*/
|
||||||
|
EventList nel;
|
||||||
for (iterator i = _events.begin (); i != _events.end (); ++i) {
|
for (iterator i = _events.begin (); i != _events.end (); ++i) {
|
||||||
float val = callback ((*i)->value, other.eval ((*i)->when));
|
float val = callback ((*i)->value, other.eval ((*i)->when));
|
||||||
nel.push_back (new ControlEvent ((*i)->when, val));
|
nel.push_back (new ControlEvent ((*i)->when, val));
|
||||||
|
@ -367,7 +368,8 @@ ControlList::_x_scale (ratio_t const & factor)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ControlEventTimeComparator {
|
struct ControlEventTimeComparator {
|
||||||
bool operator() (ControlEvent* a, ControlEvent* b) {
|
bool operator() (ControlEvent* a, ControlEvent* b)
|
||||||
|
{
|
||||||
return a->when < b->when;
|
return a->when < b->when;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -395,14 +397,11 @@ ControlList::thin (double thinning_factor)
|
||||||
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 thin from %2 events\n", this, _events.size ()));
|
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 thin from %2 events\n", this, _events.size ()));
|
||||||
|
|
||||||
for (iterator i = _events.begin (); i != _events.end (); ++i) {
|
for (iterator i = _events.begin (); i != _events.end (); ++i) {
|
||||||
|
|
||||||
cur = *i;
|
cur = *i;
|
||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
if (counter > 2) {
|
if (counter > 2) {
|
||||||
|
/* compute the area of the triangle formed by 3 points */
|
||||||
/* compute the area of the triangle formed by 3 points
|
|
||||||
*/
|
|
||||||
|
|
||||||
const double ppw = prevprev->when.samples ();
|
const double ppw = prevprev->when.samples ();
|
||||||
const double pw = prev->when.samples ();
|
const double pw = prev->when.samples ();
|
||||||
|
@ -416,8 +415,8 @@ ControlList::thin (double thinning_factor)
|
||||||
iterator tmp = pprev;
|
iterator tmp = pprev;
|
||||||
|
|
||||||
/* pprev will change to current
|
/* pprev will change to current
|
||||||
i is incremented to the next event
|
* i is incremented to the next event
|
||||||
as we loop.
|
* as we loop.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pprev = i;
|
pprev = i;
|
||||||
|
@ -494,6 +493,7 @@ void
|
||||||
ControlList::start_write_pass (timepos_t const& time)
|
ControlList::start_write_pass (timepos_t const& time)
|
||||||
{
|
{
|
||||||
Glib::Threads::RWLock::WriterLock lm (_lock);
|
Glib::Threads::RWLock::WriterLock lm (_lock);
|
||||||
|
|
||||||
timepos_t when = ensure_time_domain (time);
|
timepos_t when = ensure_time_domain (time);
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::ControlList, string_compose ("%1: setup write pass @ %2\n", this, when));
|
DEBUG_TRACE (DEBUG::ControlList, string_compose ("%1: setup write pass @ %2\n", this, when));
|
||||||
|
@ -606,13 +606,11 @@ ControlList::add_guard_point (timepos_t const & time, timecnt_t const & offset)
|
||||||
double eval_value = unlocked_eval (when);
|
double eval_value = unlocked_eval (when);
|
||||||
|
|
||||||
if (most_recent_insert_iterator == _events.end ()) {
|
if (most_recent_insert_iterator == _events.end ()) {
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 insert iterator at end, adding eval-value there %2\n", this, eval_value));
|
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 insert iterator at end, adding eval-value there %2\n", this, eval_value));
|
||||||
_events.push_back (new ControlEvent (when, eval_value));
|
_events.push_back (new ControlEvent (when, eval_value));
|
||||||
/* leave insert iterator at the end */
|
/* leave insert iterator at the end */
|
||||||
|
|
||||||
} else if ((*most_recent_insert_iterator)->when == when) {
|
} else if ((*most_recent_insert_iterator)->when == when) {
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 insert iterator at existing point, setting eval-value there %2\n", this, eval_value));
|
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 insert iterator at existing point, setting eval-value there %2\n", this, eval_value));
|
||||||
|
|
||||||
/* most_recent_insert_iterator points to a control event
|
/* most_recent_insert_iterator points to a control event
|
||||||
|
@ -628,7 +626,6 @@ ControlList::add_guard_point (timepos_t const & time, timecnt_t const & offset)
|
||||||
|
|
||||||
++most_recent_insert_iterator;
|
++most_recent_insert_iterator;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* insert a new control event at the right spot */
|
/* insert a new control event at the right spot */
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 insert eval-value %2 just before iterator @ %3\n",
|
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 insert eval-value %2 just before iterator @ %3\n",
|
||||||
|
@ -670,7 +667,6 @@ ControlList::editor_add (timepos_t const & time, double value, bool with_guard)
|
||||||
value = std::min ((double)_desc.upper, std::max ((double)_desc.lower, value));
|
value = std::min ((double)_desc.upper, std::max ((double)_desc.lower, value));
|
||||||
|
|
||||||
if (_events.empty ()) {
|
if (_events.empty ()) {
|
||||||
|
|
||||||
/* as long as the point we're adding is not at zero,
|
/* as long as the point we're adding is not at zero,
|
||||||
* add an "anchor" point there.
|
* add an "anchor" point there.
|
||||||
*/
|
*/
|
||||||
|
@ -793,11 +789,11 @@ ControlList::add (timepos_t const & time, double value, bool with_guards, bool w
|
||||||
(most_recent_insert_iterator == _events.end ())));
|
(most_recent_insert_iterator == _events.end ())));
|
||||||
{
|
{
|
||||||
Glib::Threads::RWLock::WriterLock lm (_lock);
|
Glib::Threads::RWLock::WriterLock lm (_lock);
|
||||||
|
|
||||||
ControlEvent cp (when, 0.0f);
|
ControlEvent cp (when, 0.0f);
|
||||||
iterator insertion_point;
|
iterator insertion_point;
|
||||||
|
|
||||||
if (_events.empty () && with_initial) {
|
if (_events.empty () && with_initial) {
|
||||||
|
|
||||||
/* empty: add an "anchor" point if the point we're adding past time 0 */
|
/* empty: add an "anchor" point if the point we're adding past time 0 */
|
||||||
|
|
||||||
if (when >= 1) {
|
if (when >= 1) {
|
||||||
|
@ -814,7 +810,6 @@ ControlList::add (timepos_t const & time, double value, bool with_guards, bool w
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_in_write_pass && new_write_pass) {
|
if (_in_write_pass && new_write_pass) {
|
||||||
|
|
||||||
/* first write in a write pass: add guard point if requested */
|
/* first write in a write pass: add guard point if requested */
|
||||||
|
|
||||||
if (with_guards) {
|
if (with_guards) {
|
||||||
|
@ -830,7 +825,6 @@ ControlList::add (timepos_t const & time, double value, bool with_guards, bool w
|
||||||
|
|
||||||
} else if (_in_write_pass &&
|
} else if (_in_write_pass &&
|
||||||
(most_recent_insert_iterator == _events.end () || when > (*most_recent_insert_iterator)->when)) {
|
(most_recent_insert_iterator == _events.end () || when > (*most_recent_insert_iterator)->when)) {
|
||||||
|
|
||||||
/* in write pass: erase from most recent insert to now */
|
/* in write pass: erase from most recent insert to now */
|
||||||
|
|
||||||
if (most_recent_insert_iterator != _events.end ()) {
|
if (most_recent_insert_iterator != _events.end ()) {
|
||||||
|
@ -846,7 +840,6 @@ ControlList::add (timepos_t const & time, double value, bool with_guards, bool w
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (!_in_write_pass) {
|
} else if (!_in_write_pass) {
|
||||||
|
|
||||||
/* not in a write pass: figure out the iterator we should insert in front of */
|
/* not in a write pass: figure out the iterator we should insert in front of */
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::ControlList, string_compose ("compute(b) MRI for position %1\n", when));
|
DEBUG_TRACE (DEBUG::ControlList, string_compose ("compute(b) MRI for position %1\n", when));
|
||||||
|
@ -869,7 +862,6 @@ ControlList::add (timepos_t const & time, double value, bool with_guards, bool w
|
||||||
--most_recent_insert_iterator;
|
--most_recent_insert_iterator;
|
||||||
|
|
||||||
} else if ((*most_recent_insert_iterator)->when == when) {
|
} else if ((*most_recent_insert_iterator)->when == when) {
|
||||||
|
|
||||||
if ((*most_recent_insert_iterator)->value != value) {
|
if ((*most_recent_insert_iterator)->value != value) {
|
||||||
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 reset existing point to new value %2\n", this, value));
|
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 reset existing point to new value %2\n", this, value));
|
||||||
|
|
||||||
|
@ -910,6 +902,7 @@ ControlList::add (timepos_t const & time, double value, bool with_guards, bool w
|
||||||
if (have_point1 && have_point2) {
|
if (have_point1 && have_point2) {
|
||||||
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 no change: move existing at %3 to %2\n", this, when, (*most_recent_insert_iterator)->when));
|
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 no change: move existing at %3 to %2\n", this, when, (*most_recent_insert_iterator)->when));
|
||||||
(*most_recent_insert_iterator)->when = when;
|
(*most_recent_insert_iterator)->when = when;
|
||||||
|
|
||||||
done = true;
|
done = true;
|
||||||
} else {
|
} else {
|
||||||
++most_recent_insert_iterator;
|
++most_recent_insert_iterator;
|
||||||
|
@ -968,6 +961,7 @@ ControlList::erase (timepos_t const & time, double value)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
Glib::Threads::RWLock::WriterLock lm (_lock);
|
Glib::Threads::RWLock::WriterLock lm (_lock);
|
||||||
|
|
||||||
timepos_t when = ensure_time_domain (time);
|
timepos_t when = ensure_time_domain (time);
|
||||||
|
|
||||||
iterator i = begin ();
|
iterator i = begin ();
|
||||||
|
@ -1010,10 +1004,6 @@ ControlList::erase_range (timepos_t const & start, timepos_t const & endt)
|
||||||
bool
|
bool
|
||||||
ControlList::erase_range_internal (timepos_t const& start, timepos_t const& endt, EventList& events)
|
ControlList::erase_range_internal (timepos_t const& start, timepos_t const& endt, EventList& events)
|
||||||
{
|
{
|
||||||
bool erased = false;
|
|
||||||
iterator s;
|
|
||||||
iterator e;
|
|
||||||
|
|
||||||
/* This is where we have to pick the time domain to be used when
|
/* This is where we have to pick the time domain to be used when
|
||||||
* defining the control points.
|
* defining the control points.
|
||||||
*
|
*
|
||||||
|
@ -1032,8 +1022,11 @@ ControlList::erase_range_internal (timepos_t const & start, timepos_t const & en
|
||||||
|
|
||||||
ControlEvent cp (start, 0.0f);
|
ControlEvent cp (start, 0.0f);
|
||||||
|
|
||||||
if ((s = lower_bound (events.begin(), events.end(), &cp, time_comparator)) != events.end()) {
|
bool erased = false;
|
||||||
|
|
||||||
|
iterator s;
|
||||||
|
iterator e;
|
||||||
|
if ((s = lower_bound (events.begin (), events.end (), &cp, time_comparator)) != events.end ()) {
|
||||||
cp.when = endt;
|
cp.when = endt;
|
||||||
e = upper_bound (events.begin (), events.end (), &cp, time_comparator);
|
e = upper_bound (events.begin (), events.end (), &cp, time_comparator);
|
||||||
events.erase (s, e);
|
events.erase (s, e);
|
||||||
|
@ -1075,6 +1068,7 @@ ControlList::shift (timepos_t const & time, timecnt_t const & distance)
|
||||||
|
|
||||||
{
|
{
|
||||||
Glib::Threads::RWLock::WriterLock lm (_lock);
|
Glib::Threads::RWLock::WriterLock lm (_lock);
|
||||||
|
|
||||||
double v0, v1;
|
double v0, v1;
|
||||||
|
|
||||||
if (distance.is_negative ()) {
|
if (distance.is_negative ()) {
|
||||||
|
@ -1121,7 +1115,6 @@ ControlList::shift (timepos_t const & time, timecnt_t const & distance)
|
||||||
_events.insert (s, new ControlEvent (pos, s == _events.end () ? v0 : v1));
|
_events.insert (s, new ControlEvent (pos, s == _events.end () ? v0 : v1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mark_dirty ();
|
mark_dirty ();
|
||||||
}
|
}
|
||||||
maybe_signal_changed ();
|
maybe_signal_changed ();
|
||||||
|
@ -1140,6 +1133,7 @@ ControlList::modify (iterator iter, timepos_t const & time, double val)
|
||||||
|
|
||||||
{
|
{
|
||||||
Glib::Threads::RWLock::WriterLock lm (_lock);
|
Glib::Threads::RWLock::WriterLock lm (_lock);
|
||||||
|
|
||||||
timepos_t when = ensure_time_domain (time);
|
timepos_t when = ensure_time_domain (time);
|
||||||
|
|
||||||
(*iter)->when = when;
|
(*iter)->when = when;
|
||||||
|
@ -1165,16 +1159,16 @@ std::pair<ControlList::iterator,ControlList::iterator>
|
||||||
ControlList::control_points_adjacent (timepos_t const& xtime)
|
ControlList::control_points_adjacent (timepos_t const& xtime)
|
||||||
{
|
{
|
||||||
Glib::Threads::RWLock::ReaderLock lm (_lock);
|
Glib::Threads::RWLock::ReaderLock lm (_lock);
|
||||||
iterator i;
|
|
||||||
timepos_t xval = xtime;
|
timepos_t xval = xtime;
|
||||||
ControlEvent cp (xval, 0.0f);
|
ControlEvent cp (xval, 0.0f);
|
||||||
std::pair<iterator,iterator> ret;
|
|
||||||
|
|
||||||
|
std::pair<iterator, iterator> ret;
|
||||||
ret.first = _events.end ();
|
ret.first = _events.end ();
|
||||||
ret.second = _events.end ();
|
ret.second = _events.end ();
|
||||||
|
|
||||||
|
iterator i;
|
||||||
for (i = lower_bound (_events.begin (), _events.end (), &cp, time_comparator); i != _events.end (); ++i) {
|
for (i = lower_bound (_events.begin (), _events.end (), &cp, time_comparator); i != _events.end (); ++i) {
|
||||||
|
|
||||||
if (ret.first == _events.end ()) {
|
if (ret.first == _events.end ()) {
|
||||||
if ((*i)->when >= xval) {
|
if ((*i)->when >= xval) {
|
||||||
if (i != _events.begin ()) {
|
if (i != _events.begin ()) {
|
||||||
|
@ -1242,9 +1236,9 @@ ControlList::truncate_end (timepos_t const & last_time)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
Glib::Threads::RWLock::WriterLock lm (_lock);
|
Glib::Threads::RWLock::WriterLock lm (_lock);
|
||||||
|
|
||||||
timepos_t last_coordinate = last_time;
|
timepos_t last_coordinate = last_time;
|
||||||
ControlEvent cp (last_coordinate, 0);
|
ControlEvent cp (last_coordinate, 0);
|
||||||
ControlList::reverse_iterator i;
|
|
||||||
double last_val;
|
double last_val;
|
||||||
|
|
||||||
if (_events.empty ()) {
|
if (_events.empty ()) {
|
||||||
|
@ -1256,9 +1250,7 @@ ControlList::truncate_end (timepos_t const & last_time)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (last_coordinate > _events.back ()->when) {
|
if (last_coordinate > _events.back ()->when) {
|
||||||
|
/* extending end: */
|
||||||
/* extending end:
|
|
||||||
*/
|
|
||||||
|
|
||||||
iterator foo = _events.begin ();
|
iterator foo = _events.begin ();
|
||||||
bool lessthantwo;
|
bool lessthantwo;
|
||||||
|
@ -1275,7 +1267,6 @@ ControlList::truncate_end (timepos_t const & last_time)
|
||||||
/* less than 2 points: add a new point */
|
/* less than 2 points: add a new point */
|
||||||
_events.push_back (new ControlEvent (last_coordinate, _events.back ()->value));
|
_events.push_back (new ControlEvent (last_coordinate, _events.back ()->value));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* more than 2 points: check to see if the last 2 values
|
/* more than 2 points: check to see if the last 2 values
|
||||||
are equal. if so, just move the position of the
|
are equal. if so, just move the position of the
|
||||||
last point. otherwise, add a new point.
|
last point. otherwise, add a new point.
|
||||||
|
@ -1293,8 +1284,8 @@ ControlList::truncate_end (timepos_t const & last_time)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* shortening end */
|
/* shortening end */
|
||||||
|
ControlList::reverse_iterator i;
|
||||||
|
|
||||||
last_val = unlocked_eval (last_coordinate);
|
last_val = unlocked_eval (last_coordinate);
|
||||||
last_val = max ((double)_desc.lower, last_val);
|
last_val = max ((double)_desc.lower, last_val);
|
||||||
|
@ -1345,6 +1336,7 @@ ControlList::truncate_start (timecnt_t const & overall)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
Glib::Threads::RWLock::WriterLock lm (_lock);
|
Glib::Threads::RWLock::WriterLock lm (_lock);
|
||||||
|
|
||||||
iterator i;
|
iterator i;
|
||||||
double first_legal_value;
|
double first_legal_value;
|
||||||
timepos_t first_legal_coordinate;
|
timepos_t first_legal_coordinate;
|
||||||
|
@ -1359,7 +1351,6 @@ ControlList::truncate_start (timecnt_t const & overall)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overall_length > _events.back ()->when) {
|
if (overall_length > _events.back ()->when) {
|
||||||
|
|
||||||
/* growing at front: duplicate first point. shift all others */
|
/* growing at front: duplicate first point. shift all others */
|
||||||
|
|
||||||
timepos_t shift (_events.back ()->when.distance (overall_length));
|
timepos_t shift (_events.back ()->when.distance (overall_length));
|
||||||
|
@ -1370,12 +1361,10 @@ ControlList::truncate_start (timecnt_t const & overall)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (np < 2) {
|
if (np < 2) {
|
||||||
|
|
||||||
/* less than 2 points: add a new point */
|
/* less than 2 points: add a new point */
|
||||||
_events.push_front (new ControlEvent (timepos_t (_time_domain), _events.front ()->value));
|
_events.push_front (new ControlEvent (timepos_t (_time_domain), _events.front ()->value));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* more than 2 points: check to see if the first 2 values
|
/* more than 2 points: check to see if the first 2 values
|
||||||
are equal. if so, just move the position of the
|
are equal. if so, just move the position of the
|
||||||
first point. otherwise, add a new point.
|
first point. otherwise, add a new point.
|
||||||
|
@ -1394,7 +1383,6 @@ ControlList::truncate_start (timecnt_t const & overall)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* shrinking at front */
|
/* shrinking at front */
|
||||||
|
|
||||||
first_legal_coordinate = _events.back ()->when.earlier (overall_length);
|
first_legal_coordinate = _events.back ()->when.earlier (overall_length);
|
||||||
|
@ -1421,7 +1409,6 @@ ControlList::truncate_start (timecnt_t const & overall)
|
||||||
i = tmp;
|
i = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* shift all remaining points left to keep their same
|
/* shift all remaining points left to keep their same
|
||||||
relative position
|
relative position
|
||||||
*/
|
*/
|
||||||
|
@ -1444,7 +1431,6 @@ ControlList::truncate_start (timecnt_t const & overall)
|
||||||
double
|
double
|
||||||
ControlList::unlocked_eval (timepos_t const& xtime) const
|
ControlList::unlocked_eval (timepos_t const& xtime) const
|
||||||
{
|
{
|
||||||
pair<EventList::iterator,EventList::iterator> range;
|
|
||||||
int32_t npoints;
|
int32_t npoints;
|
||||||
timepos_t lpos, upos;
|
timepos_t lpos, upos;
|
||||||
double lval, uval;
|
double lval, uval;
|
||||||
|
@ -1539,7 +1525,6 @@ ControlList::multipoint_eval (timepos_t const & xtime) const
|
||||||
((_lookup_cache.left > xtime) ||
|
((_lookup_cache.left > xtime) ||
|
||||||
(_lookup_cache.range.first == _events.end ()) ||
|
(_lookup_cache.range.first == _events.end ()) ||
|
||||||
((*_lookup_cache.range.second)->when < xtime))) {
|
((*_lookup_cache.range.second)->when < xtime))) {
|
||||||
|
|
||||||
const ControlEvent cp (xtime, 0);
|
const ControlEvent cp (xtime, 0);
|
||||||
|
|
||||||
_lookup_cache.range = equal_range (_events.begin (), _events.end (), &cp, time_comparator);
|
_lookup_cache.range = equal_range (_events.begin (), _events.end (), &cp, time_comparator);
|
||||||
|
@ -1548,7 +1533,6 @@ ControlList::multipoint_eval (timepos_t const & xtime) const
|
||||||
pair<const_iterator, const_iterator> range = _lookup_cache.range;
|
pair<const_iterator, const_iterator> range = _lookup_cache.range;
|
||||||
|
|
||||||
if (range.first == range.second) {
|
if (range.first == range.second) {
|
||||||
|
|
||||||
/* x does not exist within the list as a control point */
|
/* x does not exist within the list as a control point */
|
||||||
|
|
||||||
_lookup_cache.left = xtime;
|
_lookup_cache.left = xtime;
|
||||||
|
@ -1645,7 +1629,6 @@ ControlList::rt_safe_earliest_event_discrete_unlocked (timepos_t const & start_t
|
||||||
|
|
||||||
/* Earliest points is in range, return it */
|
/* Earliest points is in range, return it */
|
||||||
if (past_start) {
|
if (past_start) {
|
||||||
|
|
||||||
x = first->when;
|
x = first->when;
|
||||||
y = first->value;
|
y = first->value;
|
||||||
|
|
||||||
|
@ -1771,7 +1754,6 @@ ControlList::rt_safe_earliest_event_linear_unlocked (Temporal::timepos_t const &
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fabs (first->value - next->value) <= 1) {
|
if (fabs (first->value - next->value) <= 1) {
|
||||||
|
|
||||||
/* delta between the two spanning points is <= 1,
|
/* delta between the two spanning points is <= 1,
|
||||||
consider the next point as the answer, but only if the next
|
consider the next point as the answer, but only if the next
|
||||||
point is actually beyond @p start.
|
point is actually beyond @p start.
|
||||||
|
@ -1832,7 +1814,6 @@ ControlList::rt_safe_earliest_event_linear_unlocked (Temporal::timepos_t const &
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** @param start Start position in model coordinates.
|
/** @param start Start position in model coordinates.
|
||||||
* @param end End position in model coordinates.
|
* @param end End position in model coordinates.
|
||||||
* @param op 0 = cut, 1 = copy, 2 = clear.
|
* @param op 0 = cut, 1 = copy, 2 = clear.
|
||||||
|
@ -1841,6 +1822,7 @@ boost::shared_ptr<ControlList>
|
||||||
ControlList::cut_copy_clear (timepos_t const& start_time, timepos_t const& end_time, int op)
|
ControlList::cut_copy_clear (timepos_t const& start_time, timepos_t const& end_time, int op)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<ControlList> nal = create (_parameter, _desc, _time_domain);
|
boost::shared_ptr<ControlList> nal = create (_parameter, _desc, _time_domain);
|
||||||
|
|
||||||
iterator s, e;
|
iterator s, e;
|
||||||
timepos_t start = start_time;
|
timepos_t start = start_time;
|
||||||
timepos_t end = end_time;
|
timepos_t end = end_time;
|
||||||
|
@ -1850,7 +1832,7 @@ ControlList::cut_copy_clear (timepos_t const & start_time, timepos_t const & end
|
||||||
Glib::Threads::RWLock::WriterLock lm (_lock);
|
Glib::Threads::RWLock::WriterLock lm (_lock);
|
||||||
|
|
||||||
/* first, determine s & e, two iterators that define the range of points
|
/* first, determine s & e, two iterators that define the range of points
|
||||||
affected by this operation
|
* affected by this operation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((s = lower_bound (_events.begin (), _events.end (), &cp, time_comparator)) == _events.end ()) {
|
if ((s = lower_bound (_events.begin (), _events.end (), &cp, time_comparator)) == _events.end ()) {
|
||||||
|
@ -1861,25 +1843,19 @@ ControlList::cut_copy_clear (timepos_t const & start_time, timepos_t const & end
|
||||||
cp.when = end;
|
cp.when = end;
|
||||||
e = upper_bound (_events.begin (), _events.end (), &cp, time_comparator);
|
e = upper_bound (_events.begin (), _events.end (), &cp, time_comparator);
|
||||||
|
|
||||||
|
|
||||||
/* if "start" isn't the location of an existing point,
|
/* if "start" isn't the location of an existing point,
|
||||||
evaluate the curve to get a value for the start. Add a point to
|
* evaluate the curve to get a value for the start. Add a point to
|
||||||
both the existing event list, and if its not a "clear" operation,
|
* both the existing event list, and if its not a "clear" operation,
|
||||||
to the copy ("nal") as well.
|
* to the copy ("nal") as well.
|
||||||
|
*
|
||||||
Note that the time positions of the points in each list are different
|
* Note that the time positions of the points in each list are different
|
||||||
because we want the copy ("nal") to have a zero time reference.
|
* because we want the copy ("nal") to have a zero time reference.
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* before we begin any cut/clear operations, get the value of the curve
|
|
||||||
at "end".
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* before we begin any cut/clear operations, get the value of the curve at "end". */
|
||||||
double end_value = unlocked_eval (end);
|
double end_value = unlocked_eval (end);
|
||||||
|
|
||||||
if ((*s)->when != start) {
|
if ((*s)->when != start) {
|
||||||
|
|
||||||
double val = unlocked_eval (start);
|
double val = unlocked_eval (start);
|
||||||
|
|
||||||
if (op != 1) { // cut/clear
|
if (op != 1) { // cut/clear
|
||||||
|
@ -1894,10 +1870,7 @@ ControlList::cut_copy_clear (timepos_t const & start_time, timepos_t const & end
|
||||||
}
|
}
|
||||||
|
|
||||||
for (iterator x = s; x != e;) {
|
for (iterator x = s; x != e;) {
|
||||||
|
/* adjust new points to be relative to start, which has been set to zero. */
|
||||||
/* adjust new points to be relative to start, which
|
|
||||||
has been set to zero.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (op != 2) {
|
if (op != 2) {
|
||||||
nal->_events.push_back (new ControlEvent (timepos_t (start.distance ((*x)->when)), (*x)->value));
|
nal->_events.push_back (new ControlEvent (timepos_t (start.distance ((*x)->when)), (*x)->value));
|
||||||
|
@ -1911,7 +1884,6 @@ ControlList::cut_copy_clear (timepos_t const & start_time, timepos_t const & end
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e == _events.end () || (*e)->when != end) {
|
if (e == _events.end () || (*e)->when != end) {
|
||||||
|
|
||||||
if (op != 1) { // cut/clear
|
if (op != 1) { // cut/clear
|
||||||
_events.insert (e, new ControlEvent (end, end_value));
|
_events.insert (e, new ControlEvent (end, end_value));
|
||||||
}
|
}
|
||||||
|
@ -1932,7 +1904,6 @@ ControlList::cut_copy_clear (timepos_t const & start_time, timepos_t const & end
|
||||||
return nal;
|
return nal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boost::shared_ptr<ControlList>
|
boost::shared_ptr<ControlList>
|
||||||
ControlList::cut (timepos_t const& start, timepos_t const& end)
|
ControlList::cut (timepos_t const& start, timepos_t const& end)
|
||||||
{
|
{
|
||||||
|
@ -1966,6 +1937,7 @@ ControlList::paste (const ControlList& alist, timepos_t const & time)
|
||||||
|
|
||||||
{
|
{
|
||||||
Glib::Threads::RWLock::WriterLock lm (_lock);
|
Glib::Threads::RWLock::WriterLock lm (_lock);
|
||||||
|
|
||||||
iterator where;
|
iterator where;
|
||||||
iterator prev;
|
iterator prev;
|
||||||
timepos_t end;
|
timepos_t end;
|
||||||
|
@ -1979,9 +1951,10 @@ ControlList::paste (const ControlList& alist, timepos_t const & time)
|
||||||
if (alist.parameter () != parameter ()) {
|
if (alist.parameter () != parameter ()) {
|
||||||
const ParameterDescriptor& src_desc = alist.descriptor ();
|
const ParameterDescriptor& src_desc = alist.descriptor ();
|
||||||
|
|
||||||
// This does not work for logscale and will probably also not do
|
/* This does not work for logscale and will probably also not do
|
||||||
// the right thing for integer_step and sr_dependent parameters.
|
* the right thing for integer_step and sr_dependent parameters.
|
||||||
//
|
*/
|
||||||
|
|
||||||
// TODO various flags from from ARDOUR::ParameterDescriptor
|
// TODO various flags from from ARDOUR::ParameterDescriptor
|
||||||
// to Evoral::ParameterDescriptor
|
// to Evoral::ParameterDescriptor
|
||||||
|
|
||||||
|
@ -2012,9 +1985,8 @@ ControlList::paste (const ControlList& alist, timepos_t const & time)
|
||||||
end = (*i)->when + pos;
|
end = (*i)->when + pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* move all points after the insertion along the timeline by
|
/* move all points after the insertion along the timeline by
|
||||||
the correct amount.
|
* the correct amount.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while (where != _events.end ()) {
|
while (where != _events.end ()) {
|
||||||
|
@ -2054,7 +2026,6 @@ ControlList::move_ranges (const list< RangeMove> & movements)
|
||||||
/* clear the source and destination ranges in the new list */
|
/* clear the source and destination ranges in the new list */
|
||||||
bool things_erased = false;
|
bool things_erased = false;
|
||||||
for (RangeMoveList::const_iterator i = movements.begin (); i != movements.end (); ++i) {
|
for (RangeMoveList::const_iterator i = movements.begin (); i != movements.end (); ++i) {
|
||||||
|
|
||||||
timepos_t start = i->from;
|
timepos_t start = i->from;
|
||||||
timepos_t end = i->from + i->length;
|
timepos_t end = i->from + i->length;
|
||||||
|
|
||||||
|
@ -2083,7 +2054,6 @@ ControlList::move_ranges (const list< RangeMove> & movements)
|
||||||
const timecnt_t dx = i->from.distance (i->to);
|
const timecnt_t dx = i->from.distance (i->to);
|
||||||
|
|
||||||
while (j != old_events.end ()) {
|
while (j != old_events.end ()) {
|
||||||
|
|
||||||
timepos_t jtime;
|
timepos_t jtime;
|
||||||
|
|
||||||
switch (_time_domain) {
|
switch (_time_domain) {
|
||||||
|
@ -2188,8 +2158,7 @@ ControlList::operator!= (ControlList const & other) const
|
||||||
_interpolation != other._interpolation ||
|
_interpolation != other._interpolation ||
|
||||||
_desc.lower != other._desc.lower ||
|
_desc.lower != other._desc.lower ||
|
||||||
_desc.upper != other._desc.upper ||
|
_desc.upper != other._desc.upper ||
|
||||||
_desc.normal != other._desc.normal
|
_desc.normal != other._desc.normal);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
Loading…
Reference in New Issue
Block a user