#include <sstream>
#include <algorithm>
#include "ardour/automation_list.h"
+#include "ardour/beats_frames_converter.h"
#include "ardour/event_type_map.h"
#include "ardour/parameter_descriptor.h"
+#include "ardour/parameter_types.h"
#include "ardour/evoral_types_convert.h"
#include "ardour/types_convert.h"
#include "evoral/Curve.hpp"
, _before (0)
{
_state = Off;
- _style = Absolute;
g_atomic_int_set (&_touching, 0);
create_curve_if_necessary();
, _before (0)
{
_state = Off;
- _style = Absolute;
g_atomic_int_set (&_touching, 0);
create_curve_if_necessary();
}
AutomationList::AutomationList (const AutomationList& other)
- : StatefulDestructible()
- , ControlList(other)
+ : ControlList(other)
+ , StatefulDestructible()
, _before (0)
{
- _style = other._style;
_state = other._state;
g_atomic_int_set (&_touching, other.touching());
: ControlList(other, start, end)
, _before (0)
{
- _style = other._style;
_state = other._state;
g_atomic_int_set (&_touching, other.touching());
{
g_atomic_int_set (&_touching, 0);
_state = Off;
- _style = Absolute;
set_state (node, Stateful::loading_state_version);
ControlList::operator= (other);
_state = other._state;
- _style = other._style;
_touching = other._touching;
mark_dirty ();
}
}
-void
-AutomationList::set_automation_style (AutoStyle s)
-{
- if (s != _style) {
- _style = s;
- automation_style_changed (); /* EMIT SIGNAL */
- }
-}
-
void
AutomationList::start_write_pass (double when)
{
}
}
+bool
+AutomationList::paste (const ControlList& alist, double pos, DoubleBeatsFramesConverter const& bfc)
+{
+ AutomationType src_type = (AutomationType)alist.parameter().type();
+ AutomationType dst_type = (AutomationType)_parameter.type();
+
+ if (parameter_is_midi (src_type) == parameter_is_midi (dst_type)) {
+ return ControlList::paste (alist, pos);
+ }
+ bool to_frame = parameter_is_midi (src_type);
+
+ ControlList cl (alist);
+ cl.clear ();
+ for (const_iterator i = alist.begin ();i != alist.end (); ++i) {
+ double when = (*i)->when;
+ if (to_frame) {
+ when = bfc.to ((*i)->when);
+ } else {
+ when = bfc.from ((*i)->when);
+ }
+ cl.fast_simple_add (when, (*i)->value);
+ }
+ return ControlList::paste (cl, pos);
+}
+
Command*
AutomationList::memento_command (XMLNode* before, XMLNode* after)
{
root->set_property ("state", Off);
}
- root->set_property ("style", _style);
-
if (!_events.empty()) {
root->add_child_nocopy (serialize_events());
}
_default_value = 0.0;
}
- if (!node.get_property (X_("style"), _style)) {
- _style = Absolute;
- }
-
if (node.get_property (X_("state"), _state)) {
if (_state == Write) {
_state = Off;
return (
static_cast<ControlList const &> (*this) != static_cast<ControlList const &> (other) ||
_state != other._state ||
- _style != other._style ||
_touching != other._touching
);
}