(1) remove most uses of MementoCommand for Playlist and Region (2) move frozen state from Region into Stateful, renamed "suspend property changes" (3) successive changes to a Property (scalar) after clear_history() do not keep resetting the old value (fixes region trim)
git-svn-id: svn://localhost/ardour2/branches/3.0@6720 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -49,7 +49,7 @@ class AudioTrack : public Track
|
||||
|
||||
int export_stuff (BufferSet& bufs, sframes_t start_frame, nframes_t nframes, bool enable_processing = true);
|
||||
|
||||
void freeze (InterThreadInfo&);
|
||||
void freeze_me (InterThreadInfo&);
|
||||
void unfreeze ();
|
||||
|
||||
boost::shared_ptr<Region> bounce (InterThreadInfo&);
|
||||
|
||||
@@ -50,7 +50,6 @@ class AutomationList : public PBD::StatefulDestructible, public Evoral::ControlL
|
||||
AutomationList& operator= (const AutomationList&);
|
||||
bool operator== (const AutomationList&);
|
||||
|
||||
void freeze();
|
||||
void thaw ();
|
||||
void mark_dirty () const;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
|
||||
int export_stuff (BufferSet& bufs, nframes_t nframes, sframes_t end_frame);
|
||||
|
||||
void freeze (InterThreadInfo&);
|
||||
void freeze_me (InterThreadInfo&);
|
||||
void unfreeze ();
|
||||
|
||||
boost::shared_ptr<Region> bounce (InterThreadInfo&);
|
||||
|
||||
@@ -93,9 +93,6 @@ class Region
|
||||
|
||||
PBD::PropertyList* property_factory (const XMLNode&) const;
|
||||
|
||||
void unlock_property_changes () { _no_property_changes = false; }
|
||||
void block_property_changes () { _no_property_changes = true; }
|
||||
|
||||
virtual ~Region();
|
||||
|
||||
/** Note: changing the name of a Region does not constitute an edit */
|
||||
@@ -156,8 +153,7 @@ class Region
|
||||
void set_position_lock_style (PositionLockStyle ps);
|
||||
void recompute_position_from_lock_style ();
|
||||
|
||||
void freeze ();
|
||||
void thaw ();
|
||||
void suspend_property_changes ();
|
||||
|
||||
bool covers (framepos_t frame) const {
|
||||
return first_frame() <= frame && frame <= last_frame();
|
||||
@@ -288,6 +284,7 @@ class Region
|
||||
|
||||
protected:
|
||||
void send_change (const PBD::PropertyChange&);
|
||||
void mid_thaw (const PBD::PropertyChange&);
|
||||
|
||||
void trim_to_internal (framepos_t position, framecnt_t length, void *src);
|
||||
virtual void set_position_internal (framepos_t pos, bool allow_bbt_recompute);
|
||||
@@ -304,7 +301,6 @@ class Region
|
||||
virtual void recompute_at_end () = 0;
|
||||
|
||||
DataType _type;
|
||||
bool _no_property_changes;
|
||||
|
||||
PBD::Property<bool> _muted;
|
||||
PBD::Property<bool> _opaque;
|
||||
@@ -332,14 +328,11 @@ class Region
|
||||
framepos_t _last_position;
|
||||
PositionLockStyle _positional_lock_style;
|
||||
mutable RegionEditState _first_edit;
|
||||
int _frozen;
|
||||
BBT_Time _bbt_time;
|
||||
AnalysisFeatureList _transients;
|
||||
bool _valid_transients;
|
||||
mutable uint64_t _read_data_count; ///< modified in read()
|
||||
PBD::PropertyChange _pending_changed;
|
||||
uint64_t _last_layer_op; ///< timestamp
|
||||
Glib::Mutex _lock;
|
||||
SourceList _sources;
|
||||
/** Used when timefx are applied, so we can always use the original source */
|
||||
SourceList _master_sources;
|
||||
|
||||
@@ -603,7 +603,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
||||
boost::shared_ptr<Region> write_one_track (AudioTrack&, nframes_t start, nframes_t end,
|
||||
bool overwrite, std::vector<boost::shared_ptr<Source> >&, InterThreadInfo& wot,
|
||||
bool enable_processing = true);
|
||||
int freeze (InterThreadInfo&);
|
||||
int freeze_all (InterThreadInfo&);
|
||||
|
||||
/* session-wide solo/mute/rec-enable */
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ class Track : public Route
|
||||
|
||||
FreezeState freeze_state() const;
|
||||
|
||||
virtual void freeze (InterThreadInfo&) = 0;
|
||||
virtual void freeze_me (InterThreadInfo&) = 0;
|
||||
virtual void unfreeze () = 0;
|
||||
|
||||
virtual boost::shared_ptr<Region> bounce (InterThreadInfo&) = 0;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "pbd/xml++.h"
|
||||
#include "pbd/memento_command.h"
|
||||
#include "pbd/enumwriter.h"
|
||||
#include "pbd/stacktrace.h"
|
||||
#include "pbd/stateful_diff_command.h"
|
||||
|
||||
#include "ardour/analyser.h"
|
||||
#include "ardour/ardour.h"
|
||||
@@ -1497,7 +1497,7 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca
|
||||
|
||||
// cerr << _name << ": there are " << capture_info.size() << " capture_info records\n";
|
||||
|
||||
XMLNode &before = _playlist->get_state();
|
||||
_playlist->clear_history ();
|
||||
_playlist->freeze ();
|
||||
|
||||
for (buffer_position = c->front()->write_source->last_capture_start_frame(), ci = capture_info.begin(); ci != capture_info.end(); ++ci) {
|
||||
@@ -1537,8 +1537,7 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca
|
||||
}
|
||||
|
||||
_playlist->thaw ();
|
||||
XMLNode &after = _playlist->get_state();
|
||||
_session.add_command (new MementoCommand<Playlist>(*_playlist, &before, &after));
|
||||
_session.add_command (new StatefulDiffCommand (_playlist));
|
||||
}
|
||||
|
||||
mark_write_completed = true;
|
||||
|
||||
@@ -692,7 +692,7 @@ AudioTrack::bounce_range (nframes_t start, nframes_t end, InterThreadInfo& itt,
|
||||
}
|
||||
|
||||
void
|
||||
AudioTrack::freeze (InterThreadInfo& itt)
|
||||
AudioTrack::freeze_me (InterThreadInfo& itt)
|
||||
{
|
||||
vector<boost::shared_ptr<Source> > srcs;
|
||||
string new_playlist_name;
|
||||
|
||||
@@ -589,7 +589,7 @@ AudioRegion::_set_state (const XMLNode& node, int version, PropertyChange& what_
|
||||
LocaleGuard lg (X_("POSIX"));
|
||||
boost::shared_ptr<Playlist> the_playlist (_playlist.lock());
|
||||
|
||||
freeze ();
|
||||
suspend_property_changes ();
|
||||
|
||||
if (the_playlist) {
|
||||
the_playlist->freeze ();
|
||||
@@ -612,7 +612,7 @@ AudioRegion::_set_state (const XMLNode& node, int version, PropertyChange& what_
|
||||
|
||||
/* Now find envelope description and other related child items */
|
||||
|
||||
_envelope->freeze ();
|
||||
_envelope->freeze ();
|
||||
|
||||
for (XMLNodeConstIterator niter = nlist.begin(); niter != nlist.end(); ++niter) {
|
||||
XMLNode *child;
|
||||
@@ -677,9 +677,9 @@ AudioRegion::_set_state (const XMLNode& node, int version, PropertyChange& what_
|
||||
}
|
||||
}
|
||||
|
||||
_envelope->thaw ();
|
||||
thaw ();
|
||||
|
||||
_envelope->thaw ();
|
||||
resume_property_changes ();
|
||||
|
||||
if (send) {
|
||||
send_change (what_changed);
|
||||
}
|
||||
@@ -761,9 +761,9 @@ AudioRegion::set_fade_out_shape (FadeShape shape)
|
||||
void
|
||||
AudioRegion::set_fade_in (boost::shared_ptr<AutomationList> f)
|
||||
{
|
||||
_fade_in->freeze ();
|
||||
_fade_in->freeze ();
|
||||
*_fade_in = *f;
|
||||
_fade_in->thaw ();
|
||||
_fade_in->thaw ();
|
||||
|
||||
send_change (PropertyChange (Properties::fade_in));
|
||||
}
|
||||
@@ -771,7 +771,7 @@ AudioRegion::set_fade_in (boost::shared_ptr<AutomationList> f)
|
||||
void
|
||||
AudioRegion::set_fade_in (FadeShape shape, framecnt_t len)
|
||||
{
|
||||
_fade_in->freeze ();
|
||||
_fade_in->freeze ();
|
||||
_fade_in->clear ();
|
||||
|
||||
switch (shape) {
|
||||
@@ -822,15 +822,15 @@ AudioRegion::set_fade_in (FadeShape shape, framecnt_t len)
|
||||
break;
|
||||
}
|
||||
|
||||
_fade_in->thaw ();
|
||||
_fade_in->thaw ();
|
||||
}
|
||||
|
||||
void
|
||||
AudioRegion::set_fade_out (boost::shared_ptr<AutomationList> f)
|
||||
{
|
||||
_fade_out->freeze ();
|
||||
_fade_out->freeze ();
|
||||
*_fade_out = *f;
|
||||
_fade_out->thaw ();
|
||||
_fade_out->thaw ();
|
||||
|
||||
send_change (PropertyChange (Properties::fade_in));
|
||||
}
|
||||
@@ -838,7 +838,7 @@ AudioRegion::set_fade_out (boost::shared_ptr<AutomationList> f)
|
||||
void
|
||||
AudioRegion::set_fade_out (FadeShape shape, framecnt_t len)
|
||||
{
|
||||
_fade_out->freeze ();
|
||||
_fade_out->freeze ();
|
||||
_fade_out->clear ();
|
||||
|
||||
switch (shape) {
|
||||
@@ -887,7 +887,7 @@ AudioRegion::set_fade_out (FadeShape shape, framecnt_t len)
|
||||
break;
|
||||
}
|
||||
|
||||
_fade_out->thaw ();
|
||||
_fade_out->thaw ();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -977,11 +977,11 @@ AudioRegion::set_default_fades ()
|
||||
void
|
||||
AudioRegion::set_default_envelope ()
|
||||
{
|
||||
_envelope->freeze ();
|
||||
_envelope->freeze ();
|
||||
_envelope->clear ();
|
||||
_envelope->fast_simple_add (0, 1.0f);
|
||||
_envelope->fast_simple_add (_length, 1.0f);
|
||||
_envelope->thaw ();
|
||||
_envelope->thaw ();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -991,10 +991,10 @@ AudioRegion::recompute_at_end ()
|
||||
based on the the existing curve.
|
||||
*/
|
||||
|
||||
_envelope->freeze ();
|
||||
_envelope->freeze ();
|
||||
_envelope->truncate_end (_length);
|
||||
_envelope->set_max_xval (_length);
|
||||
_envelope->thaw ();
|
||||
_envelope->thaw ();
|
||||
|
||||
if (_fade_in->back()->when > _length) {
|
||||
_fade_in->extend_to (_length);
|
||||
|
||||
@@ -170,7 +170,7 @@ AutomationList::maybe_signal_changed ()
|
||||
{
|
||||
ControlList::maybe_signal_changed ();
|
||||
|
||||
if (!_frozen) {
|
||||
if (!ControlList::frozen()) {
|
||||
StateChanged (); /* EMIT SIGNAL */
|
||||
}
|
||||
}
|
||||
@@ -207,12 +207,6 @@ AutomationList::stop_touch ()
|
||||
_new_value = false;
|
||||
}
|
||||
|
||||
void
|
||||
AutomationList::freeze ()
|
||||
{
|
||||
_frozen++;
|
||||
}
|
||||
|
||||
void
|
||||
AutomationList::thaw ()
|
||||
{
|
||||
@@ -313,7 +307,7 @@ AutomationList::deserialize_events (const XMLNode& node)
|
||||
return -1;
|
||||
}
|
||||
|
||||
freeze ();
|
||||
ControlList::freeze ();
|
||||
clear ();
|
||||
|
||||
stringstream str (content_node->content());
|
||||
@@ -344,8 +338,8 @@ AutomationList::deserialize_events (const XMLNode& node)
|
||||
maybe_signal_changed ();
|
||||
}
|
||||
|
||||
thaw ();
|
||||
|
||||
ControlList::thaw ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -377,7 +371,7 @@ AutomationList::set_state (const XMLNode& node, int version)
|
||||
nframes_t x;
|
||||
double y;
|
||||
|
||||
freeze ();
|
||||
ControlList::freeze ();
|
||||
clear ();
|
||||
|
||||
for (i = elist.begin(); i != elist.end(); ++i) {
|
||||
@@ -397,7 +391,7 @@ AutomationList::set_state (const XMLNode& node, int version)
|
||||
fast_simple_add (x, y);
|
||||
}
|
||||
|
||||
thaw ();
|
||||
ControlList::thaw ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "pbd/xml++.h"
|
||||
#include "pbd/memento_command.h"
|
||||
#include "pbd/enumwriter.h"
|
||||
#include "pbd/stateful_diff_command.h"
|
||||
|
||||
#include "ardour/ardour.h"
|
||||
#include "ardour/audioengine.h"
|
||||
@@ -1011,7 +1012,7 @@ MidiDiskstream::transport_stopped (struct tm& /*when*/, time_t /*twhen*/, bool a
|
||||
|
||||
// cerr << _name << ": there are " << capture_info.size() << " capture_info records\n";
|
||||
|
||||
XMLNode &before = _playlist->get_state();
|
||||
_playlist->clear_history ();
|
||||
_playlist->freeze ();
|
||||
|
||||
uint32_t buffer_position = 0;
|
||||
@@ -1053,8 +1054,7 @@ MidiDiskstream::transport_stopped (struct tm& /*when*/, time_t /*twhen*/, bool a
|
||||
}
|
||||
|
||||
_playlist->thaw ();
|
||||
XMLNode &after = _playlist->get_state();
|
||||
_session.add_command (new MementoCommand<Playlist>(*_playlist, &before, &after));
|
||||
_session.add_command (new StatefulDiffCommand(_playlist));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -556,7 +556,7 @@ MidiTrack::bounce_range (nframes_t /*start*/, nframes_t /*end*/, InterThreadInfo
|
||||
}
|
||||
|
||||
void
|
||||
MidiTrack::freeze (InterThreadInfo& /*itt*/)
|
||||
MidiTrack::freeze_me (InterThreadInfo& /*itt*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -855,7 +855,7 @@ Playlist::partition (framepos_t start, framepos_t end, bool cut)
|
||||
partition_internal (start, end, cut, thawlist);
|
||||
|
||||
for (RegionList::iterator i = thawlist.begin(); i != thawlist.end(); ++i) {
|
||||
(*i)->thaw ();
|
||||
(*i)->resume_property_changes ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -972,7 +972,7 @@ Playlist::partition_internal (framepos_t start, framepos_t end, bool cutting, Re
|
||||
|
||||
/* "front" ***** */
|
||||
|
||||
current->freeze ();
|
||||
current->suspend_property_changes ();
|
||||
thawlist.push_back (current);
|
||||
current->trim_end (pos2, this);
|
||||
|
||||
@@ -1011,7 +1011,7 @@ Playlist::partition_internal (framepos_t start, framepos_t end, bool cutting, Re
|
||||
|
||||
/* front ****** */
|
||||
|
||||
current->freeze ();
|
||||
current->suspend_property_changes ();
|
||||
thawlist.push_back (current);
|
||||
current->trim_end (pos2, this);
|
||||
|
||||
@@ -1054,7 +1054,7 @@ Playlist::partition_internal (framepos_t start, framepos_t end, bool cutting, Re
|
||||
|
||||
/* end */
|
||||
|
||||
current->freeze ();
|
||||
current->suspend_property_changes ();
|
||||
thawlist.push_back (current);
|
||||
current->trim_front (pos3, this);
|
||||
} else if (overlap == OverlapExternal) {
|
||||
@@ -1157,7 +1157,7 @@ Playlist::cut (framepos_t start, framecnt_t cnt, bool result_is_hidden)
|
||||
partition_internal (start, start+cnt-1, true, thawlist);
|
||||
|
||||
for (RegionList::iterator i = thawlist.begin(); i != thawlist.end(); ++i) {
|
||||
(*i)->thaw ();
|
||||
(*i)->resume_property_changes();
|
||||
}
|
||||
|
||||
return the_copy;
|
||||
@@ -2123,15 +2123,15 @@ Playlist::set_state (const XMLNode& node, int version)
|
||||
|
||||
if ((region = region_by_id (id))) {
|
||||
|
||||
region->freeze ();
|
||||
region->suspend_property_changes ();
|
||||
|
||||
if (region->set_state (*child, version)) {
|
||||
region->thaw ();
|
||||
region->resume_property_changes ();
|
||||
continue;
|
||||
}
|
||||
|
||||
} else if ((region = RegionFactory::create (_session, *child, true)) != 0) {
|
||||
region->freeze ();
|
||||
region->suspend_property_changes ();
|
||||
} else {
|
||||
error << _("Playlist: cannot create region from XML") << endmsg;
|
||||
continue;
|
||||
@@ -2141,7 +2141,7 @@ Playlist::set_state (const XMLNode& node, int version)
|
||||
|
||||
// So that layer_op ordering doesn't get screwed up
|
||||
region->set_last_layer_op( region->layer());
|
||||
region->thaw ();
|
||||
region->resume_property_changes ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -199,13 +199,11 @@ Region::register_properties ()
|
||||
Region::Region (Session& s, framepos_t start, framecnt_t length, const string& name, DataType type)
|
||||
: SessionObject(s, name)
|
||||
, _type(type)
|
||||
, _no_property_changes (true)
|
||||
, REGION_DEFAULT_STATE(start,length)
|
||||
, _last_length (length)
|
||||
, _last_position (0)
|
||||
, _positional_lock_style(AudioTime)
|
||||
, _first_edit (EditChangesNothing)
|
||||
, _frozen(0)
|
||||
, _read_data_count(0)
|
||||
, _last_layer_op(0)
|
||||
, _pending_explicit_relayer (false)
|
||||
@@ -219,13 +217,11 @@ Region::Region (Session& s, framepos_t start, framecnt_t length, const string& n
|
||||
Region::Region (const SourceList& srcs)
|
||||
: SessionObject(srcs.front()->session(), "toBeRenamed")
|
||||
, _type (srcs.front()->type())
|
||||
, _no_property_changes (true)
|
||||
, REGION_DEFAULT_STATE(0,0)
|
||||
, _last_length (0)
|
||||
, _last_position (0)
|
||||
, _positional_lock_style (_type == DataType::AUDIO ? AudioTime : MusicTime)
|
||||
, _first_edit (EditChangesNothing)
|
||||
, _frozen (0)
|
||||
, _valid_transients(false)
|
||||
, _read_data_count(0)
|
||||
, _last_layer_op (0)
|
||||
@@ -251,13 +247,11 @@ Region::Region (const SourceList& srcs)
|
||||
Region::Region (boost::shared_ptr<const Region> other, frameoffset_t offset, bool offset_relative)
|
||||
: SessionObject(other->session(), other->name())
|
||||
, _type (other->data_type())
|
||||
, _no_property_changes (true)
|
||||
, REGION_COPY_STATE (other)
|
||||
, _last_length (other->_last_length)
|
||||
, _last_position(other->_last_position) \
|
||||
, _positional_lock_style(other->_positional_lock_style) \
|
||||
, _first_edit (EditChangesNothing)
|
||||
, _frozen (0)
|
||||
, _valid_transients(false)
|
||||
, _read_data_count(0)
|
||||
, _last_layer_op (0)
|
||||
@@ -360,13 +354,11 @@ Region::Region (boost::shared_ptr<const Region> other, frameoffset_t offset, boo
|
||||
Region::Region (boost::shared_ptr<const Region> other, const SourceList& srcs)
|
||||
: SessionObject (other->session(), other->name())
|
||||
, _type (srcs.front()->type())
|
||||
, _no_property_changes (true)
|
||||
, REGION_COPY_STATE (other)
|
||||
, _last_length (other->_last_length)
|
||||
, _last_position (other->_last_position)
|
||||
, _positional_lock_style (other->_positional_lock_style)
|
||||
, _first_edit (EditChangesID)
|
||||
, _frozen (0)
|
||||
, _valid_transients (false)
|
||||
, _read_data_count (0)
|
||||
, _last_layer_op (other->_last_layer_op)
|
||||
@@ -393,13 +385,11 @@ Region::Region (boost::shared_ptr<const Region> other, const SourceList& srcs)
|
||||
Region::Region (boost::shared_ptr<const Region> other)
|
||||
: SessionObject(other->session(), other->name())
|
||||
, _type(other->data_type())
|
||||
, _no_property_changes (true)
|
||||
, REGION_COPY_STATE (other)
|
||||
, _last_length (other->_last_length)
|
||||
, _last_position (other->_last_position)
|
||||
, _positional_lock_style (other->_positional_lock_style)
|
||||
, _first_edit (EditChangesID)
|
||||
, _frozen(0)
|
||||
, _valid_transients(false)
|
||||
, _read_data_count(0)
|
||||
, _last_layer_op(other->_last_layer_op)
|
||||
@@ -475,7 +465,7 @@ Region::set_length (framecnt_t len, void */*src*/)
|
||||
maybe_uncopy ();
|
||||
invalidate_transients ();
|
||||
|
||||
if (!_frozen) {
|
||||
if (!property_changes_suspended()) {
|
||||
recompute_at_end ();
|
||||
}
|
||||
|
||||
@@ -803,7 +793,7 @@ Region::trim_front (framepos_t new_position, void *src)
|
||||
}
|
||||
|
||||
trim_to_internal (new_position, newlen, src);
|
||||
if (!_frozen) {
|
||||
if (!property_changes_suspended()) {
|
||||
recompute_at_start ();
|
||||
}
|
||||
}
|
||||
@@ -822,7 +812,7 @@ Region::trim_end (framepos_t new_endpoint, void */*src*/)
|
||||
|
||||
if (new_endpoint > _position) {
|
||||
trim_to_internal (_position, new_endpoint - _position + 1, this);
|
||||
if (!_frozen) {
|
||||
if (!property_changes_suspended()) {
|
||||
recompute_at_end ();
|
||||
}
|
||||
}
|
||||
@@ -837,7 +827,7 @@ Region::trim_to (framepos_t position, framecnt_t length, void *src)
|
||||
|
||||
trim_to_internal (position, length, src);
|
||||
|
||||
if (!_frozen) {
|
||||
if (!property_changes_suspended()) {
|
||||
recompute_at_start ();
|
||||
recompute_at_end ();
|
||||
}
|
||||
@@ -890,14 +880,14 @@ Region::trim_to_internal (framepos_t position, framecnt_t length, void */*src*/)
|
||||
what_changed.add (Properties::start);
|
||||
}
|
||||
if (_length != length) {
|
||||
if (!_frozen) {
|
||||
if (!property_changes_suspended()) {
|
||||
_last_length = _length;
|
||||
}
|
||||
_length = length;
|
||||
what_changed.add (Properties::length);
|
||||
}
|
||||
if (_position != position) {
|
||||
if (!_frozen) {
|
||||
if (!property_changes_suspended()) {
|
||||
_last_position = _position;
|
||||
}
|
||||
_position = position;
|
||||
@@ -987,7 +977,7 @@ Region::set_sync_position (framepos_t absolute_pos)
|
||||
if (file_pos != _sync_position) {
|
||||
_sync_marked = true;
|
||||
_sync_position = file_pos;
|
||||
if (!_frozen) {
|
||||
if (!property_changes_suspended()) {
|
||||
maybe_uncopy ();
|
||||
}
|
||||
send_change (Properties::sync_position);
|
||||
@@ -999,7 +989,7 @@ Region::clear_sync_position ()
|
||||
{
|
||||
if (sync_marked()) {
|
||||
_sync_marked = false;
|
||||
if (!_frozen) {
|
||||
if (!property_changes_suspended()) {
|
||||
maybe_uncopy ();
|
||||
}
|
||||
send_change (Properties::sync_position);
|
||||
@@ -1229,43 +1219,22 @@ Region::_set_state (const XMLNode& node, int version, PropertyChange& what_chang
|
||||
}
|
||||
|
||||
void
|
||||
Region::freeze ()
|
||||
Region::suspend_property_changes ()
|
||||
{
|
||||
_frozen++;
|
||||
Stateful::suspend_property_changes ();
|
||||
_last_length = _length;
|
||||
_last_position = _position;
|
||||
}
|
||||
|
||||
void
|
||||
Region::thaw ()
|
||||
Region::mid_thaw (const PropertyChange& what_changed)
|
||||
{
|
||||
PropertyChange what_changed;
|
||||
|
||||
{
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
|
||||
if (_frozen && --_frozen > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_pending_changed.empty()) {
|
||||
what_changed = _pending_changed;
|
||||
_pending_changed.clear ();
|
||||
}
|
||||
}
|
||||
|
||||
if (what_changed.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (what_changed.contains (Properties::length)) {
|
||||
if (what_changed.contains (Properties::position)) {
|
||||
recompute_at_start ();
|
||||
}
|
||||
recompute_at_end ();
|
||||
}
|
||||
|
||||
send_change (what_changed);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1275,15 +1244,7 @@ Region::send_change (const PropertyChange& what_changed)
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
if (_frozen) {
|
||||
_pending_changed.add (what_changed);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PropertyChanged (what_changed);
|
||||
Stateful::send_change (what_changed);
|
||||
|
||||
if (!_no_property_changes) {
|
||||
|
||||
@@ -1294,12 +1255,10 @@ Region::send_change (const PropertyChange& what_changed)
|
||||
try {
|
||||
boost::shared_ptr<Region> rptr = shared_from_this();
|
||||
RegionPropertyChanged (rptr, what_changed);
|
||||
|
||||
} catch (...) {
|
||||
/* no shared_ptr available, relax; */
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1584,16 +1543,26 @@ Region::set_property (const PropertyBase& prop)
|
||||
} else if (prop == Properties::position_locked.property_id) {
|
||||
_position_locked = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
|
||||
} else if (prop == Properties::start.property_id) {
|
||||
_start = dynamic_cast<const PropertyTemplate<framepos_t>*>(&prop)->val();
|
||||
framepos_t val = dynamic_cast<const PropertyTemplate<framepos_t>*>(&prop)->val();
|
||||
if (val != _start) {
|
||||
DEBUG_TRACE (DEBUG::Properties, string_compose ("region %1 start changed from %2 to %3",
|
||||
_name.val(), _start, val));
|
||||
_start = val;
|
||||
return true;
|
||||
}
|
||||
} else if (prop == Properties::length.property_id) {
|
||||
framecnt_t val = dynamic_cast<const PropertyTemplate<framecnt_t>* > (&prop)->val();
|
||||
if (val != _length) {
|
||||
DEBUG_TRACE (DEBUG::Properties, string_compose ("region %1 length changed from %2 to %3",
|
||||
_name.val(), _length, val));
|
||||
_length = val;
|
||||
return true;
|
||||
}
|
||||
} else if (prop == Properties::position.property_id) {
|
||||
framepos_t val = dynamic_cast<const PropertyTemplate<framepos_t>*>(&prop)->val();
|
||||
if (val != _position) {
|
||||
DEBUG_TRACE (DEBUG::Properties, string_compose ("region %1 position changed from %2 to %3",
|
||||
_name.val(), _position, val));
|
||||
_position = val;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,6 @@ RegionFactory::create (boost::shared_ptr<const Region> region)
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
ret->unlock_property_changes ();
|
||||
map_add (ret);
|
||||
|
||||
/* pure copy constructor - no property list */
|
||||
@@ -106,10 +105,7 @@ RegionFactory::create (boost::shared_ptr<Region> region, frameoffset_t offset, c
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
|
||||
ret->set_properties (plist);
|
||||
ret->unlock_property_changes ();
|
||||
|
||||
map_add (ret);
|
||||
|
||||
if (announce) {
|
||||
@@ -149,10 +145,7 @@ RegionFactory::create (boost::shared_ptr<Region> region, const PropertyList& pli
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
|
||||
ret->set_properties (plist);
|
||||
ret->unlock_property_changes ();
|
||||
|
||||
map_add (ret);
|
||||
|
||||
if (announce) {
|
||||
@@ -195,8 +188,6 @@ RegionFactory::create (boost::shared_ptr<Region> region, const SourceList& srcs,
|
||||
if (ret) {
|
||||
|
||||
ret->set_properties (plist);
|
||||
ret->unlock_property_changes ();
|
||||
|
||||
map_add (ret);
|
||||
|
||||
if (announce) {
|
||||
@@ -242,8 +233,6 @@ RegionFactory::create (const SourceList& srcs, const PropertyList& plist, bool a
|
||||
if (ret) {
|
||||
|
||||
ret->set_properties (plist);
|
||||
ret->unlock_property_changes ();
|
||||
|
||||
map_add (ret);
|
||||
|
||||
if (announce) {
|
||||
@@ -290,7 +279,6 @@ RegionFactory::create (SourceList& srcs, const XMLNode& node)
|
||||
if (ret->set_state (node, Stateful::loading_state_version)) {
|
||||
ret.reset ();
|
||||
} else {
|
||||
ret->unlock_property_changes ();
|
||||
map_add (ret);
|
||||
CheckNewRegion (ret);
|
||||
}
|
||||
|
||||
@@ -3847,7 +3847,7 @@ Session::allocate_pan_automation_buffers (nframes_t nframes, uint32_t howmany, b
|
||||
}
|
||||
|
||||
int
|
||||
Session::freeze (InterThreadInfo& itt)
|
||||
Session::freeze_all (InterThreadInfo& itt)
|
||||
{
|
||||
shared_ptr<RouteList> r = routes.reader ();
|
||||
|
||||
@@ -3859,7 +3859,7 @@ Session::freeze (InterThreadInfo& itt)
|
||||
/* XXX this is wrong because itt.progress will keep returning to zero at the start
|
||||
of every track.
|
||||
*/
|
||||
t->freeze (itt);
|
||||
t->freeze_me (itt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,8 +94,9 @@ public:
|
||||
ControlList& operator= (const ControlList&);
|
||||
bool operator== (const ControlList&);
|
||||
|
||||
void freeze();
|
||||
void thaw ();
|
||||
virtual void freeze();
|
||||
virtual void thaw ();
|
||||
bool frozen() const { return _frozen; }
|
||||
|
||||
const Parameter& parameter() const { return _parameter; }
|
||||
void set_parameter(const Parameter& p) { _parameter = p; }
|
||||
|
||||
@@ -122,8 +122,10 @@ protected:
|
||||
{}
|
||||
|
||||
void set (T const& v) {
|
||||
_old = _current;
|
||||
_have_old = true;
|
||||
if (!_have_old) {
|
||||
_old = _current;
|
||||
_have_old = true;
|
||||
}
|
||||
_current = v;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,12 @@ class Stateful {
|
||||
static int current_state_version;
|
||||
static int loading_state_version;
|
||||
|
||||
virtual void suspend_property_changes ();
|
||||
virtual void resume_property_changes ();
|
||||
|
||||
void unlock_property_changes () { _no_property_changes = false; }
|
||||
void block_property_changes () { _no_property_changes = true; }
|
||||
|
||||
protected:
|
||||
|
||||
void add_instant_xml (XMLNode&, const sys::path& directory_path);
|
||||
@@ -100,10 +106,21 @@ class Stateful {
|
||||
|
||||
XMLNode *_extra_xml;
|
||||
XMLNode *_instant_xml;
|
||||
PBD::ID _id;
|
||||
PBD::ID _id;
|
||||
int32_t _frozen;
|
||||
bool _no_property_changes;
|
||||
PBD::PropertyChange _pending_changed;
|
||||
Glib::Mutex _lock;
|
||||
|
||||
std::string _xml_node_name; ///< name of node to use for this object in XML
|
||||
OwnedPropertyList* _properties;
|
||||
|
||||
virtual void send_change (const PropertyChange&);
|
||||
/** derived classes can implement this in order to process a property change
|
||||
within thaw() just before send_change() is called.
|
||||
*/
|
||||
virtual void mid_thaw (const PropertyChange&) { }
|
||||
bool property_changes_suspended() const { return g_atomic_int_get (&_frozen) > 0; }
|
||||
};
|
||||
|
||||
} // namespace PBD
|
||||
|
||||
@@ -39,7 +39,9 @@ int Stateful::current_state_version = 0;
|
||||
int Stateful::loading_state_version = 0;
|
||||
|
||||
Stateful::Stateful ()
|
||||
: _properties (new OwnedPropertyList)
|
||||
: _frozen (0)
|
||||
, _no_property_changes (false)
|
||||
, _properties (new OwnedPropertyList)
|
||||
{
|
||||
_extra_xml = 0;
|
||||
_instant_xml = 0;
|
||||
@@ -238,4 +240,52 @@ Stateful::add_property (PropertyBase& s)
|
||||
_properties->add (s);
|
||||
}
|
||||
|
||||
void
|
||||
Stateful::send_change (const PropertyChange& what_changed)
|
||||
{
|
||||
if (what_changed.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
if (_frozen) {
|
||||
_pending_changed.add (what_changed);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PropertyChanged (what_changed);
|
||||
}
|
||||
|
||||
void
|
||||
Stateful::suspend_property_changes ()
|
||||
{
|
||||
_frozen++;
|
||||
}
|
||||
|
||||
void
|
||||
Stateful::resume_property_changes ()
|
||||
{
|
||||
PropertyChange what_changed;
|
||||
|
||||
{
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
|
||||
if (_frozen && --_frozen > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_pending_changed.empty()) {
|
||||
what_changed = _pending_changed;
|
||||
_pending_changed.clear ();
|
||||
}
|
||||
}
|
||||
|
||||
mid_thaw (what_changed);
|
||||
|
||||
send_change (what_changed);
|
||||
}
|
||||
|
||||
|
||||
} // namespace PBD
|
||||
|
||||
@@ -36,7 +36,7 @@ OSCControllable::OSCControllable (lo_address a, const std::string& p, boost::sha
|
||||
, addr (a)
|
||||
, path (p)
|
||||
{
|
||||
c->Changed.connect (changed_connection, boost::bind (&OSCControllable::send_change, this), OSC::instance());
|
||||
c->Changed.connect (changed_connection, boost::bind (&OSCControllable::send_change_message, this), OSC::instance());
|
||||
}
|
||||
|
||||
OSCControllable::~OSCControllable ()
|
||||
@@ -58,7 +58,7 @@ OSCControllable::set_state (const XMLNode& /*node*/, int /*version*/)
|
||||
}
|
||||
|
||||
void
|
||||
OSCControllable::send_change ()
|
||||
OSCControllable::send_change_message ()
|
||||
{
|
||||
lo_message msg = lo_message_new ();
|
||||
|
||||
@@ -84,7 +84,7 @@ OSCRouteControllable::~OSCRouteControllable ()
|
||||
}
|
||||
|
||||
void
|
||||
OSCRouteControllable::send_change ()
|
||||
OSCRouteControllable::send_change_message ()
|
||||
{
|
||||
lo_message msg = lo_message_new ();
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class OSCControllable : public PBD::Stateful
|
||||
lo_address addr;
|
||||
std::string path;
|
||||
|
||||
virtual void send_change ();
|
||||
virtual void send_change_message ();
|
||||
};
|
||||
|
||||
class OSCRouteControllable : public OSCControllable
|
||||
@@ -67,7 +67,7 @@ class OSCRouteControllable : public OSCControllable
|
||||
private:
|
||||
boost::shared_ptr<ARDOUR::Route> _route;
|
||||
|
||||
void send_change ();
|
||||
void send_change_message ();
|
||||
};
|
||||
|
||||
#endif /* __osc_osccontrollable_h__ */
|
||||
|
||||
Reference in New Issue
Block a user