mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 00:34:59 +01:00
add option to skip guard points when adding new control points to a ControlList; add more debugging statements
This commit is contained in:
parent
08eecbf3fe
commit
f049d0294c
3 changed files with 30 additions and 17 deletions
|
|
@ -117,7 +117,7 @@ public:
|
||||||
|
|
||||||
virtual bool clamp_value (double& /*when*/, double& /*value*/) const { return true; }
|
virtual bool clamp_value (double& /*when*/, double& /*value*/) const { return true; }
|
||||||
|
|
||||||
virtual void add (double when, double value);
|
virtual void add (double when, double value, bool with_guards=true);
|
||||||
void fast_simple_add (double when, double value);
|
void fast_simple_add (double when, double value);
|
||||||
|
|
||||||
void erase_range (double start, double end);
|
void erase_range (double start, double end);
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "pbd/stacktrace.h"
|
||||||
|
|
||||||
#include "evoral/Control.hpp"
|
#include "evoral/Control.hpp"
|
||||||
#include "evoral/ControlList.hpp"
|
#include "evoral/ControlList.hpp"
|
||||||
|
|
||||||
|
|
@ -49,9 +52,13 @@ void
|
||||||
Control::set_double (double value, double frame, bool to_list)
|
Control::set_double (double value, double frame, bool to_list)
|
||||||
{
|
{
|
||||||
_user_value = value;
|
_user_value = value;
|
||||||
|
|
||||||
|
/* if we're in a write pass, the automation watcher will determine the
|
||||||
|
values and add them to the list, so we we don't need to bother.
|
||||||
|
*/
|
||||||
|
|
||||||
if (to_list) {
|
if (to_list && !_list->in_write_pass()) {
|
||||||
_list->add (frame, value);
|
_list->add (frame, value, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -342,21 +342,25 @@ ControlList::start_write_pass (double when)
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock lm (_lock);
|
Glib::Threads::Mutex::Lock lm (_lock);
|
||||||
|
|
||||||
|
DEBUG_TRACE (DEBUG::ControlList, string_compose ("%1: setup write pass @ %2\n", this, when));
|
||||||
|
|
||||||
new_write_pass = true;
|
new_write_pass = true;
|
||||||
did_write_during_pass = false;
|
did_write_during_pass = false;
|
||||||
insert_position = when;
|
insert_position = when;
|
||||||
|
|
||||||
/* leave the insert iterator invalid, so that we will do the lookup
|
/* leave the insert iterator invalid, so that we will do the lookup
|
||||||
of where it should be in a "lazy" way - deferring it until
|
of where it should be in a "lazy" way - deferring it until
|
||||||
we actually add the first point (which may never happen).
|
we actually add the first point (which may never happen).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
unlocked_invalidate_insert_iterator ();
|
unlocked_invalidate_insert_iterator ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ControlList::write_pass_finished (double /*when*/)
|
ControlList::write_pass_finished (double /*when*/)
|
||||||
{
|
{
|
||||||
|
DEBUG_TRACE (DEBUG::ControlList, "write pass finished\n");
|
||||||
|
|
||||||
if (did_write_during_pass) {
|
if (did_write_during_pass) {
|
||||||
thin ();
|
thin ();
|
||||||
did_write_during_pass = false;
|
did_write_during_pass = false;
|
||||||
|
|
@ -367,7 +371,9 @@ ControlList::write_pass_finished (double /*when*/)
|
||||||
|
|
||||||
void
|
void
|
||||||
ControlList::set_in_write_pass (bool yn, bool add_point, double when)
|
ControlList::set_in_write_pass (bool yn, bool add_point, double when)
|
||||||
{
|
{
|
||||||
|
DEBUG_TRACE (DEBUG::ControlList, string_compose ("now in write pass @ %1, add point ? %2\n", when, add_point));
|
||||||
|
|
||||||
_in_write_pass = yn;
|
_in_write_pass = yn;
|
||||||
|
|
||||||
if (yn && add_point) {
|
if (yn && add_point) {
|
||||||
|
|
@ -381,8 +387,6 @@ ControlList::add_guard_point (double when)
|
||||||
ControlEvent cp (when, 0.0);
|
ControlEvent cp (when, 0.0);
|
||||||
most_recent_insert_iterator = lower_bound (_events.begin(), _events.end(), &cp, time_comparator);
|
most_recent_insert_iterator = lower_bound (_events.begin(), _events.end(), &cp, time_comparator);
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 ADD GUARD POINT @ %2looked up insert iterator for new write pass\n", this, when));
|
|
||||||
|
|
||||||
double eval_value = unlocked_eval (insert_position);
|
double eval_value = unlocked_eval (insert_position);
|
||||||
|
|
||||||
if (most_recent_insert_iterator == _events.end()) {
|
if (most_recent_insert_iterator == _events.end()) {
|
||||||
|
|
@ -437,7 +441,7 @@ ControlList::in_write_pass () const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ControlList::add (double when, double value)
|
ControlList::add (double when, double value, bool with_guards)
|
||||||
{
|
{
|
||||||
/* this is for making changes from some kind of user interface or
|
/* this is for making changes from some kind of user interface or
|
||||||
control surface (GUI, MIDI, OSC etc)
|
control surface (GUI, MIDI, OSC etc)
|
||||||
|
|
@ -447,8 +451,8 @@ ControlList::add (double when, double value)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 add %2 at %3 w/erase = %4 at end ? %5\n",
|
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 add %2 at %3 w/erase = %4 (new ? %6) at end ? %5\n",
|
||||||
this, value, when, _in_write_pass, (most_recent_insert_iterator == _events.end())));
|
this, value, when, _in_write_pass, (most_recent_insert_iterator == _events.end()), new_write_pass));
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock lm (_lock);
|
Glib::Threads::Mutex::Lock lm (_lock);
|
||||||
ControlEvent cp (when, 0.0f);
|
ControlEvent cp (when, 0.0f);
|
||||||
|
|
@ -460,7 +464,7 @@ ControlList::add (double when, double value)
|
||||||
* add an "anchor" point there.
|
* add an "anchor" point there.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (when > 1) {
|
if (when >= 1) {
|
||||||
_events.insert (_events.end(), new ControlEvent (0, _default_value));
|
_events.insert (_events.end(), new ControlEvent (0, _default_value));
|
||||||
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 added default value %2 at zero\n", this, _default_value));
|
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 added default value %2 at zero\n", this, _default_value));
|
||||||
}
|
}
|
||||||
|
|
@ -468,8 +472,10 @@ ControlList::add (double when, double value)
|
||||||
|
|
||||||
if (_in_write_pass && new_write_pass) {
|
if (_in_write_pass && new_write_pass) {
|
||||||
|
|
||||||
add_guard_point (insert_position);
|
if (with_guards) {
|
||||||
did_write_during_pass = true;
|
add_guard_point (insert_position);
|
||||||
|
did_write_during_pass = true;
|
||||||
|
}
|
||||||
|
|
||||||
} else if (most_recent_insert_iterator == _events.end() || when > (*most_recent_insert_iterator)->when) {
|
} else if (most_recent_insert_iterator == _events.end() || when > (*most_recent_insert_iterator)->when) {
|
||||||
|
|
||||||
|
|
@ -492,7 +498,7 @@ ControlList::add (double when, double value)
|
||||||
++most_recent_insert_iterator;
|
++most_recent_insert_iterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (most_recent_insert_iterator != _events.end()) {
|
if (with_guards && most_recent_insert_iterator != _events.end()) {
|
||||||
if ((*most_recent_insert_iterator)->when - when > 64) {
|
if ((*most_recent_insert_iterator)->when - when > 64) {
|
||||||
/* next control point is some
|
/* next control point is some
|
||||||
* distance from where our new
|
* distance from where our new
|
||||||
|
|
@ -631,7 +637,7 @@ ControlList::add (double when, double value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (most_recent_insert_iterator != _events.end()) {
|
if (with_guards && most_recent_insert_iterator != _events.end()) {
|
||||||
if ((*most_recent_insert_iterator)->when - when > 64) {
|
if ((*most_recent_insert_iterator)->when - when > 64) {
|
||||||
/* next control point is some
|
/* next control point is some
|
||||||
* distance from where our new
|
* distance from where our new
|
||||||
|
|
@ -1729,7 +1735,7 @@ ControlList::dump (ostream& o)
|
||||||
/* NOT LOCKED ... for debugging only */
|
/* NOT LOCKED ... for debugging only */
|
||||||
|
|
||||||
for (EventList::iterator x = _events.begin(); x != _events.end(); ++x) {
|
for (EventList::iterator x = _events.begin(); x != _events.end(); ++x) {
|
||||||
o << (*x)->value << " @ " << (*x)->when << endl;
|
o << (*x)->value << " @ " << (uint64_t) (*x)->when << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue