domain swaps for MIDI CC and other controls
This commit is contained in:
parent
e53a70722a
commit
06e9bf6ca4
|
@ -34,7 +34,6 @@
|
|||
|
||||
#include "evoral/ControlSet.h"
|
||||
|
||||
#include "temporal/domain_swap.h"
|
||||
#include "temporal/domain_provider.h"
|
||||
|
||||
#include "ardour/libardour_visibility.h"
|
||||
|
@ -51,7 +50,7 @@ class AutomationControl;
|
|||
/* The inherited ControlSet is virtual because AutomatableSequence inherits
|
||||
* from this AND EvoralSequence, which is also a ControlSet
|
||||
*/
|
||||
class LIBARDOUR_API Automatable : virtual public Evoral::ControlSet, public Slavable, public Temporal::TimeDomainProvider, public Temporal::TimeDomainSwapper
|
||||
class LIBARDOUR_API Automatable : virtual public Evoral::ControlSet, public Slavable, public Temporal::TimeDomainProvider
|
||||
{
|
||||
public:
|
||||
Automatable(Session&, Temporal::TimeDomainProvider const &);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <glibmm/miscutils.h>
|
||||
|
||||
#include "pbd/error.h"
|
||||
#include "pbd/memento_command.h"
|
||||
|
||||
#include "temporal/timeline.h"
|
||||
|
||||
|
@ -749,19 +750,24 @@ Automatable::start_domain_bounce (Temporal::DomainBounceInfo& cmd)
|
|||
{
|
||||
for (auto & c : _controls) {
|
||||
std::shared_ptr<Evoral::ControlList> cl = c.second->list();
|
||||
if (cl) {
|
||||
cl->start_domain_bounce (cmd);
|
||||
if (cl && cl->time_domain() != cmd.to) {
|
||||
std::shared_ptr<AutomationList> al (std::dynamic_pointer_cast<AutomationList> (cl));
|
||||
_a_session.add_command (new MementoCommand<AutomationList> (*(al.get()), &al->get_state(), nullptr));
|
||||
}
|
||||
}
|
||||
ControlSet::start_domain_bounce (cmd);
|
||||
}
|
||||
|
||||
void
|
||||
Automatable::finish_domain_bounce (Temporal::DomainBounceInfo& cmd)
|
||||
{
|
||||
ControlSet::finish_domain_bounce (cmd);
|
||||
|
||||
for (auto & c : _controls) {
|
||||
std::shared_ptr<Evoral::ControlList> cl = c.second->list();
|
||||
if (cl) {
|
||||
cl->finish_domain_bounce (cmd);
|
||||
if (cl && cl->time_domain() != cmd.to) {
|
||||
std::shared_ptr<AutomationList> al (std::dynamic_pointer_cast<AutomationList> (cl));
|
||||
_a_session.add_command (new MementoCommand<AutomationList> (*(al.get()), nullptr, &al->get_state()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -619,9 +619,12 @@ MidiRegion::start_domain_bounce (Temporal::DomainBounceInfo& cmd)
|
|||
/* Deal with the region position & length */
|
||||
|
||||
Region::start_domain_bounce (cmd);
|
||||
if (cmd.from == Temporal::BeatTime) {
|
||||
model()->create_mapping_stash (source_position().beats());
|
||||
if (cmd.from != Temporal::BeatTime) {
|
||||
return;
|
||||
}
|
||||
|
||||
model()->start_domain_bounce (cmd);
|
||||
model()->create_mapping_stash (source_position().beats());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -629,7 +632,12 @@ MidiRegion::finish_domain_bounce (Temporal::DomainBounceInfo& cmd)
|
|||
{
|
||||
Region::finish_domain_bounce (cmd);
|
||||
|
||||
if (cmd.from != Temporal::BeatTime) {
|
||||
return;
|
||||
}
|
||||
|
||||
model()->rebuild_from_mapping_stash (source_position().beats());
|
||||
model()->finish_domain_bounce (cmd);
|
||||
|
||||
_model_changed_connection.disconnect ();
|
||||
model()->ContentsChanged ();
|
||||
|
|
|
@ -2247,14 +2247,14 @@ ControlList::start_domain_bounce (Temporal::DomainBounceInfo& dbi)
|
|||
for (auto const & e : _events) {
|
||||
timepos_t t (e->when);
|
||||
t.set_time_domain (dbi.to);
|
||||
dbi.positions.insert (std::make_pair (&e->when, e->when));
|
||||
dbi.positions.insert (std::make_pair (&e->when, t));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ControlList::finish_domain_bounce (Temporal::DomainBounceInfo& dbi)
|
||||
{
|
||||
if (time_domain() == dbi.from) {
|
||||
if (time_domain() == dbi.to) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,6 +104,29 @@ ControlSet::clear_controls ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ControlSet::start_domain_bounce (Temporal::DomainBounceInfo& cmd)
|
||||
{
|
||||
for (auto & c : _controls) {
|
||||
std::shared_ptr<Evoral::ControlList> cl = c.second->list();
|
||||
if (cl && cl->time_domain() != cmd.to) {
|
||||
cl->start_domain_bounce (cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ControlSet::finish_domain_bounce (Temporal::DomainBounceInfo& cmd)
|
||||
{
|
||||
for (auto & c : _controls) {
|
||||
std::shared_ptr<Evoral::ControlList> cl = c.second->list();
|
||||
if (cl && cl->time_domain() != cmd.to) {
|
||||
cl->finish_domain_bounce (cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace Evoral
|
||||
|
||||
/* No good place for this so just put it here */
|
||||
|
@ -113,3 +136,4 @@ std::operator<< (std::ostream & str, Evoral::Parameter const & p)
|
|||
{
|
||||
return str << p.type() << '-' << p.id() << '-' << (int) p.channel();
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <glibmm/threads.h>
|
||||
#include "pbd/signals.h"
|
||||
|
||||
#include "temporal/domain_swap.h"
|
||||
#include "temporal/types.h"
|
||||
|
||||
#include "evoral/visibility.h"
|
||||
|
@ -41,7 +42,8 @@ namespace Evoral {
|
|||
class Control;
|
||||
class ControlEvent;
|
||||
|
||||
class LIBEVORAL_API ControlSet : public boost::noncopyable {
|
||||
class LIBEVORAL_API ControlSet : public boost::noncopyable, public Temporal::TimeDomainSwapper
|
||||
{
|
||||
public:
|
||||
ControlSet ();
|
||||
ControlSet (const ControlSet&);
|
||||
|
@ -71,6 +73,9 @@ public:
|
|||
|
||||
Glib::Threads::Mutex& control_lock() const { return _control_lock; }
|
||||
|
||||
void start_domain_bounce (Temporal::DomainBounceInfo&);
|
||||
void finish_domain_bounce (Temporal::DomainBounceInfo&);
|
||||
|
||||
protected:
|
||||
virtual void control_list_marked_dirty () {}
|
||||
virtual void control_list_interpolation_changed (Parameter const&, ControlList::InterpolationStyle) {}
|
||||
|
|
Loading…
Reference in New Issue