NO-OP: clang-format

This commit is contained in:
Robin Gareus 2022-12-03 14:45:09 +01:00
parent 2338e25d31
commit 30efb2f178
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04

View file

@ -46,19 +46,20 @@
#include "evoral/TypeMap.h"
#include "evoral/types.h"
#include "pbd/control_math.h"
#include "pbd/compose.h"
#include "pbd/control_math.h"
#include "pbd/debug.h"
#include "pbd/error.h"
#include "pbd/i18n.h"
#include "pbd/debug.h"
using namespace std;
using namespace PBD;
using namespace Temporal;
namespace Evoral {
inline bool event_time_less_than (ControlEvent* a, ControlEvent* b)
namespace Evoral
{
inline bool
event_time_less_than (ControlEvent* a, ControlEvent* b)
{
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);
EventList nel;
/* First scale existing events, copy into a new list.
* The original list is needed later to interpolate
* for new events only present in the master list.
*/
EventList nel;
for (iterator i = _events.begin (); i != _events.end (); ++i) {
float val = callback ((*i)->value, other.eval ((*i)->when));
nel.push_back (new ControlEvent ((*i)->when, val));
@ -367,7 +368,8 @@ ControlList::_x_scale (ratio_t const & factor)
}
struct ControlEventTimeComparator {
bool operator() (ControlEvent* a, ControlEvent* b) {
bool operator() (ControlEvent* a, ControlEvent* b)
{
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 ()));
for (iterator i = _events.begin (); i != _events.end (); ++i) {
cur = *i;
counter++;
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 pw = prev->when.samples ();
@ -416,8 +415,8 @@ ControlList::thin (double thinning_factor)
iterator tmp = pprev;
/* pprev will change to current
i is incremented to the next event
as we loop.
* i is incremented to the next event
* as we loop.
*/
pprev = i;
@ -494,6 +493,7 @@ void
ControlList::start_write_pass (timepos_t const& time)
{
Glib::Threads::RWLock::WriterLock lm (_lock);
timepos_t when = ensure_time_domain (time);
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);
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));
_events.push_back (new ControlEvent (when, eval_value));
/* leave insert iterator at the end */
} 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));
/* 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;
} else {
/* 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",
@ -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));
if (_events.empty ()) {
/* as long as the point we're adding is not at zero,
* 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 ())));
{
Glib::Threads::RWLock::WriterLock lm (_lock);
ControlEvent cp (when, 0.0f);
iterator insertion_point;
if (_events.empty () && with_initial) {
/* empty: add an "anchor" point if the point we're adding past time 0 */
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) {
/* first write in a write pass: add guard point if requested */
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 &&
(most_recent_insert_iterator == _events.end () || when > (*most_recent_insert_iterator)->when)) {
/* in write pass: erase from most recent insert to now */
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) {
/* 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));
@ -869,7 +862,6 @@ ControlList::add (timepos_t const & time, double value, bool with_guards, bool w
--most_recent_insert_iterator;
} else if ((*most_recent_insert_iterator)->when == when) {
if ((*most_recent_insert_iterator)->value != 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) {
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;
done = true;
} else {
++most_recent_insert_iterator;
@ -968,6 +961,7 @@ ControlList::erase (timepos_t const & time, double value)
{
{
Glib::Threads::RWLock::WriterLock lm (_lock);
timepos_t when = ensure_time_domain (time);
iterator i = begin ();
@ -1010,10 +1004,6 @@ ControlList::erase_range (timepos_t const & start, timepos_t const & endt)
bool
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
* 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);
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;
e = upper_bound (events.begin (), events.end (), &cp, time_comparator);
events.erase (s, e);
@ -1075,6 +1068,7 @@ ControlList::shift (timepos_t const & time, timecnt_t const & distance)
{
Glib::Threads::RWLock::WriterLock lm (_lock);
double v0, v1;
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));
}
mark_dirty ();
}
maybe_signal_changed ();
@ -1140,6 +1133,7 @@ ControlList::modify (iterator iter, timepos_t const & time, double val)
{
Glib::Threads::RWLock::WriterLock lm (_lock);
timepos_t when = ensure_time_domain (time);
(*iter)->when = when;
@ -1165,16 +1159,16 @@ std::pair<ControlList::iterator,ControlList::iterator>
ControlList::control_points_adjacent (timepos_t const& xtime)
{
Glib::Threads::RWLock::ReaderLock lm (_lock);
iterator i;
timepos_t xval = xtime;
ControlEvent cp (xval, 0.0f);
std::pair<iterator,iterator> ret;
std::pair<iterator, iterator> ret;
ret.first = _events.end ();
ret.second = _events.end ();
iterator i;
for (i = lower_bound (_events.begin (), _events.end (), &cp, time_comparator); i != _events.end (); ++i) {
if (ret.first == _events.end ()) {
if ((*i)->when >= xval) {
if (i != _events.begin ()) {
@ -1242,9 +1236,9 @@ ControlList::truncate_end (timepos_t const & last_time)
{
{
Glib::Threads::RWLock::WriterLock lm (_lock);
timepos_t last_coordinate = last_time;
ControlEvent cp (last_coordinate, 0);
ControlList::reverse_iterator i;
double last_val;
if (_events.empty ()) {
@ -1256,9 +1250,7 @@ ControlList::truncate_end (timepos_t const & last_time)
}
if (last_coordinate > _events.back ()->when) {
/* extending end:
*/
/* extending end: */
iterator foo = _events.begin ();
bool lessthantwo;
@ -1275,7 +1267,6 @@ ControlList::truncate_end (timepos_t const & last_time)
/* less than 2 points: add a new point */
_events.push_back (new ControlEvent (last_coordinate, _events.back ()->value));
} else {
/* more than 2 points: check to see if the last 2 values
are equal. if so, just move the position of the
last point. otherwise, add a new point.
@ -1293,8 +1284,8 @@ ControlList::truncate_end (timepos_t const & last_time)
}
} else {
/* shortening end */
ControlList::reverse_iterator i;
last_val = unlocked_eval (last_coordinate);
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);
iterator i;
double first_legal_value;
timepos_t first_legal_coordinate;
@ -1359,7 +1351,6 @@ ControlList::truncate_start (timecnt_t const & overall)
}
if (overall_length > _events.back ()->when) {
/* growing at front: duplicate first point. shift all others */
timepos_t shift (_events.back ()->when.distance (overall_length));
@ -1370,12 +1361,10 @@ ControlList::truncate_start (timecnt_t const & overall)
}
if (np < 2) {
/* less than 2 points: add a new point */
_events.push_front (new ControlEvent (timepos_t (_time_domain), _events.front ()->value));
} else {
/* more than 2 points: check to see if the first 2 values
are equal. if so, just move the position of the
first point. otherwise, add a new point.
@ -1394,7 +1383,6 @@ ControlList::truncate_start (timecnt_t const & overall)
}
} else {
/* shrinking at front */
first_legal_coordinate = _events.back ()->when.earlier (overall_length);
@ -1421,7 +1409,6 @@ ControlList::truncate_start (timecnt_t const & overall)
i = tmp;
}
/* shift all remaining points left to keep their same
relative position
*/
@ -1444,7 +1431,6 @@ ControlList::truncate_start (timecnt_t const & overall)
double
ControlList::unlocked_eval (timepos_t const& xtime) const
{
pair<EventList::iterator,EventList::iterator> range;
int32_t npoints;
timepos_t lpos, upos;
double lval, uval;
@ -1539,7 +1525,6 @@ ControlList::multipoint_eval (timepos_t const & xtime) const
((_lookup_cache.left > xtime) ||
(_lookup_cache.range.first == _events.end ()) ||
((*_lookup_cache.range.second)->when < xtime))) {
const ControlEvent cp (xtime, 0);
_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;
if (range.first == range.second) {
/* x does not exist within the list as a control point */
_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 */
if (past_start) {
x = first->when;
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) {
/* delta between the two spanning points is <= 1,
consider the next point as the answer, but only if the next
point is actually beyond @p start.
@ -1832,7 +1814,6 @@ ControlList::rt_safe_earliest_event_linear_unlocked (Temporal::timepos_t const &
return true;
}
/** @param start Start position in model coordinates.
* @param end End position in model coordinates.
* @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)
{
boost::shared_ptr<ControlList> nal = create (_parameter, _desc, _time_domain);
iterator s, e;
timepos_t start = start_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);
/* 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 ()) {
@ -1861,25 +1843,19 @@ ControlList::cut_copy_clear (timepos_t const & start_time, timepos_t const & end
cp.when = end;
e = upper_bound (_events.begin (), _events.end (), &cp, time_comparator);
/* if "start" isn't the location of an existing point,
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,
to the copy ("nal") as well.
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.
*/
/* before we begin any cut/clear operations, get the value of the curve
at "end".
* 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,
* to the copy ("nal") as well.
*
* 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.
*/
/* before we begin any cut/clear operations, get the value of the curve at "end". */
double end_value = unlocked_eval (end);
if ((*s)->when != start) {
double val = unlocked_eval (start);
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;) {
/* 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) {
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 (op != 1) { // cut/clear
_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;
}
boost::shared_ptr<ControlList>
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);
iterator where;
iterator prev;
timepos_t end;
@ -1979,9 +1951,10 @@ ControlList::paste (const ControlList& alist, timepos_t const & time)
if (alist.parameter () != parameter ()) {
const ParameterDescriptor& src_desc = alist.descriptor ();
// This does not work for logscale and will probably also not do
// the right thing for integer_step and sr_dependent parameters.
//
/* This does not work for logscale and will probably also not do
* the right thing for integer_step and sr_dependent parameters.
*/
// TODO various flags from from ARDOUR::ParameterDescriptor
// to Evoral::ParameterDescriptor
@ -2012,9 +1985,8 @@ ControlList::paste (const ControlList& alist, timepos_t const & time)
end = (*i)->when + pos;
}
/* move all points after the insertion along the timeline by
the correct amount.
* the correct amount.
*/
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 */
bool things_erased = false;
for (RangeMoveList::const_iterator i = movements.begin (); i != movements.end (); ++i) {
timepos_t start = i->from;
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);
while (j != old_events.end ()) {
timepos_t jtime;
switch (_time_domain) {
@ -2188,8 +2158,7 @@ ControlList::operator!= (ControlList const & other) const
_interpolation != other._interpolation ||
_desc.lower != other._desc.lower ||
_desc.upper != other._desc.upper ||
_desc.normal != other._desc.normal
);
_desc.normal != other._desc.normal);
}
bool