Mark Sequence as edited when one of its parent ControlSet's ControlLists is changed.
git-svn-id: svn://localhost/ardour2/branches/3.0@7404 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
6f5ee7c429
commit
d1b4599725
|
@ -58,6 +58,7 @@ public:
|
|||
automation_control (const Evoral::Parameter& id) const;
|
||||
|
||||
virtual void add_control(boost::shared_ptr<Evoral::Control>);
|
||||
void clear_controls ();
|
||||
|
||||
virtual void automation_snapshot(nframes_t now, bool force);
|
||||
virtual void transport_stopped (sframes_t now);
|
||||
|
|
|
@ -51,7 +51,6 @@ class AutomationList : public PBD::StatefulDestructible, public Evoral::ControlL
|
|||
bool operator== (const AutomationList&);
|
||||
|
||||
void thaw ();
|
||||
void mark_dirty () const;
|
||||
|
||||
void set_automation_state (AutoState);
|
||||
AutoState automation_state() const { return _state; }
|
||||
|
@ -71,7 +70,6 @@ class AutomationList : public PBD::StatefulDestructible, public Evoral::ControlL
|
|||
PBD::Signal0<void> StateChanged;
|
||||
|
||||
static PBD::Signal1<void,AutomationList*> AutomationListCreated;
|
||||
mutable PBD::Signal0<void> Dirty;
|
||||
|
||||
void start_touch ();
|
||||
void stop_touch ();
|
||||
|
|
|
@ -484,3 +484,11 @@ Automatable::automation_state_changed (Evoral::Parameter const & p)
|
|||
{
|
||||
AutomationStateChanged (p); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
void
|
||||
Automatable::clear_controls ()
|
||||
{
|
||||
_control_connections.drop_connections ();
|
||||
ControlSet::clear_controls ();
|
||||
}
|
||||
|
||||
|
|
|
@ -218,13 +218,6 @@ AutomationList::thaw ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
AutomationList::mark_dirty () const
|
||||
{
|
||||
ControlList::mark_dirty ();
|
||||
Dirty (); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
XMLNode&
|
||||
AutomationList::get_state ()
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <set>
|
||||
#include <map>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include "pbd/signals.h"
|
||||
#include "evoral/types.hpp"
|
||||
#include "evoral/Parameter.hpp"
|
||||
|
||||
|
@ -55,10 +56,17 @@ public:
|
|||
|
||||
inline const Parameter& parameter() const { return _parameter; }
|
||||
|
||||
/** Emitted when the our ControlList is marked dirty */
|
||||
PBD::Signal0<void> ListMarkedDirty;
|
||||
|
||||
protected:
|
||||
Parameter _parameter;
|
||||
boost::shared_ptr<ControlList> _list;
|
||||
float _user_value;
|
||||
PBD::ScopedConnection _list_marked_dirty_connection;
|
||||
|
||||
private:
|
||||
void list_marked_dirty ();
|
||||
};
|
||||
|
||||
} // namespace Evoral
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <boost/pool/pool.hpp>
|
||||
#include <boost/pool/pool_alloc.hpp>
|
||||
#include <glibmm/thread.h>
|
||||
#include "pbd/signals.h"
|
||||
#include "evoral/types.hpp"
|
||||
#include "evoral/Parameter.hpp"
|
||||
|
||||
|
@ -224,7 +225,7 @@ public:
|
|||
Curve& curve() { assert(_curve); return *_curve; }
|
||||
const Curve& curve() const { assert(_curve); return *_curve; }
|
||||
|
||||
virtual void mark_dirty () const;
|
||||
void mark_dirty () const;
|
||||
|
||||
enum InterpolationStyle {
|
||||
Discrete,
|
||||
|
@ -235,6 +236,9 @@ public:
|
|||
InterpolationStyle interpolation() const { return _interpolation; }
|
||||
void set_interpolation(InterpolationStyle style) { _interpolation = style; }
|
||||
|
||||
/** Emitted when mark_dirty() is called on this object */
|
||||
mutable PBD::Signal0<void> Dirty;
|
||||
|
||||
protected:
|
||||
|
||||
/** Called by unlocked_eval() to handle cases of 3 or more control points. */
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
#include <glibmm/thread.h>
|
||||
#include "pbd/signals.h"
|
||||
#include "evoral/types.hpp"
|
||||
#include "evoral/Parameter.hpp"
|
||||
|
||||
|
@ -67,8 +68,13 @@ public:
|
|||
Glib::Mutex& control_lock() const { return _control_lock; }
|
||||
|
||||
protected:
|
||||
virtual void control_list_marked_dirty () {}
|
||||
|
||||
mutable Glib::Mutex _control_lock;
|
||||
Controls _controls;
|
||||
|
||||
private:
|
||||
PBD::ScopedConnectionList _control_connections;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ protected:
|
|||
};
|
||||
|
||||
public:
|
||||
|
||||
typedef typename boost::shared_ptr<Evoral::Note<Time> > NotePtr;
|
||||
typedef typename boost::shared_ptr<const Evoral::Note<Time> > constNotePtr;
|
||||
|
||||
|
@ -274,6 +275,8 @@ private:
|
|||
void get_notes_by_pitch (Notes&, NoteOperator, uint8_t val, int chan_mask = 0) const;
|
||||
void get_notes_by_velocity (Notes&, NoteOperator, uint8_t val, int chan_mask = 0) const;
|
||||
|
||||
void control_list_marked_dirty ();
|
||||
|
||||
const TypeMap& _type_map;
|
||||
|
||||
Notes _notes; // notes indexed by time
|
||||
|
@ -283,9 +286,6 @@ private:
|
|||
typedef std::multiset<NotePtr, EarlierNoteComparator> WriteNotes;
|
||||
WriteNotes _write_notes[16];
|
||||
|
||||
typedef std::vector< boost::shared_ptr<const ControlList> > ControlLists;
|
||||
ControlLists _dirty_controls;
|
||||
|
||||
const const_iterator _end_iter;
|
||||
bool _percussive;
|
||||
|
||||
|
|
|
@ -26,9 +26,9 @@ Parameter::TypeMetadata Parameter::_type_metadata;
|
|||
|
||||
Control::Control(const Parameter& parameter, boost::shared_ptr<ControlList> list)
|
||||
: _parameter(parameter)
|
||||
, _list(list)
|
||||
, _user_value(list ? list->default_value() : parameter.normal())
|
||||
{
|
||||
set_list (list);
|
||||
}
|
||||
|
||||
|
||||
|
@ -59,7 +59,19 @@ Control::set_float(float value, bool to_list, FrameTime frame)
|
|||
void
|
||||
Control::set_list(boost::shared_ptr<ControlList> list)
|
||||
{
|
||||
_list_marked_dirty_connection.disconnect ();
|
||||
|
||||
_list = list;
|
||||
|
||||
if (_list) {
|
||||
_list->Dirty.connect_same_thread (_list_marked_dirty_connection, boost::bind (&Control::list_marked_dirty, this));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Control::list_marked_dirty ()
|
||||
{
|
||||
ListMarkedDirty (); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
} // namespace Evoral
|
||||
|
|
|
@ -558,8 +558,12 @@ ControlList::mark_dirty () const
|
|||
{
|
||||
_lookup_cache.left = -1;
|
||||
_search_cache.left = -1;
|
||||
if (_curve)
|
||||
|
||||
if (_curve) {
|
||||
_curve->mark_dirty();
|
||||
}
|
||||
|
||||
Dirty (); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -41,6 +41,8 @@ void
|
|||
ControlSet::add_control(boost::shared_ptr<Control> ac)
|
||||
{
|
||||
_controls[ac->parameter()] = ac;
|
||||
|
||||
ac->ListMarkedDirty.connect_same_thread (_control_connections, boost::bind (&ControlSet::control_list_marked_dirty, this));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -108,6 +110,8 @@ ControlSet::clear_controls ()
|
|||
{
|
||||
Glib::Mutex::Lock lm (_control_lock);
|
||||
|
||||
_control_connections.drop_connections ();
|
||||
|
||||
for (Controls::iterator li = _controls.begin(); li != _controls.end(); ++li)
|
||||
li->second->list()->clear();
|
||||
}
|
||||
|
|
|
@ -534,7 +534,6 @@ Sequence<Time>::start_write()
|
|||
for (int i = 0; i < 16; ++i) {
|
||||
_write_notes[i].clear();
|
||||
}
|
||||
_dirty_controls.clear();
|
||||
}
|
||||
|
||||
/** Finish a write of events to the model.
|
||||
|
@ -576,10 +575,6 @@ Sequence<Time>::end_write (bool delete_stuck)
|
|||
_write_notes[i].clear();
|
||||
}
|
||||
|
||||
for (ControlLists::const_iterator i = _dirty_controls.begin(); i != _dirty_controls.end(); ++i) {
|
||||
(*i)->mark_dirty();
|
||||
}
|
||||
|
||||
_writing = false;
|
||||
}
|
||||
|
||||
|
@ -1036,6 +1031,13 @@ Sequence<Time>::set_overlap_pitch_resolution (OverlapPitchResolution opr)
|
|||
/* XXX todo: clean up existing overlaps in source data? */
|
||||
}
|
||||
|
||||
template<typename Time>
|
||||
void
|
||||
Sequence<Time>::control_list_marked_dirty ()
|
||||
{
|
||||
set_edited (true);
|
||||
}
|
||||
|
||||
template class Sequence<Evoral::MusicalTime>;
|
||||
|
||||
} // namespace Evoral
|
||||
|
|
Loading…
Reference in New Issue
Block a user