summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-02-19 18:09:08 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-02-19 18:09:08 +0000
commitfa701b8c065251d242342b86a54d91826d2290a0 (patch)
tree106865e709c61a1d3af045a26a757b22ba423c3e /libs/ardour
parent728bedf9b917287ea76b98860dec04e72472230c (diff)
change PropertyChange from a bitfield into a real object, with all the many widespread changes that causes
git-svn-id: svn://localhost/ardour2/branches/3.0@6701 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/ardour.h9
-rw-r--r--libs/ardour/ardour/audioplaylist.h4
-rw-r--r--libs/ardour/ardour/audioregion.h24
-rw-r--r--libs/ardour/ardour/crossfade.h15
-rw-r--r--libs/ardour/ardour/diskstream.h2
-rw-r--r--libs/ardour/ardour/internal_send.h2
-rw-r--r--libs/ardour/ardour/location.h2
-rw-r--r--libs/ardour/ardour/midi_model.h10
-rw-r--r--libs/ardour/ardour/midi_playlist.h2
-rw-r--r--libs/ardour/ardour/midi_region.h3
-rw-r--r--libs/ardour/ardour/playlist.h8
-rw-r--r--libs/ardour/ardour/region.h24
-rw-r--r--libs/ardour/ardour/route_group.h3
-rw-r--r--libs/ardour/ardour/session.h4
-rw-r--r--libs/ardour/ardour/session_object.h8
-rw-r--r--libs/ardour/ardour/tempo.h2
-rw-r--r--libs/ardour/audio_playlist.cc27
-rw-r--r--libs/ardour/audioregion.cc124
-rw-r--r--libs/ardour/crossfade.cc69
-rw-r--r--libs/ardour/diskstream.cc2
-rw-r--r--libs/ardour/globals.cc51
-rw-r--r--libs/ardour/internal_send.cc8
-rw-r--r--libs/ardour/midi_model.cc10
-rw-r--r--libs/ardour/midi_playlist.cc13
-rw-r--r--libs/ardour/midi_region.cc36
-rw-r--r--libs/ardour/playlist.cc42
-rw-r--r--libs/ardour/region.cc277
-rw-r--r--libs/ardour/region_factory.cc61
-rw-r--r--libs/ardour/route_group.cc21
-rw-r--r--libs/ardour/session.cc10
-rw-r--r--libs/ardour/session_object.cc18
-rw-r--r--libs/ardour/session_state.cc2
-rw-r--r--libs/ardour/tempo.cc28
33 files changed, 358 insertions, 563 deletions
diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h
index f608db5b7e..2b1f7bbb04 100644
--- a/libs/ardour/ardour/ardour.h
+++ b/libs/ardour/ardour/ardour.h
@@ -53,6 +53,9 @@ namespace ARDOUR {
void init_post_engine ();
int cleanup ();
bool no_auto_connect ();
+ void make_property_quarks ();
+
+ extern PBD::PropertyChange bounds_change;
std::string get_ardour_revision ();
extern const char* const ardour_config_info;
@@ -65,12 +68,6 @@ namespace ARDOUR {
return (microseconds_t) jack_get_time();
}
- extern PBD::PropertyChange StartChanged;
- extern PBD::PropertyChange LengthChanged;
- extern PBD::PropertyChange PositionChanged;
- extern PBD::PropertyChange NameChanged;
- extern PBD::PropertyChange BoundsChanged;
-
static const double SHUTTLE_FRACT_SPEED1=0.48412291827; /* derived from A1,A2 */
void setup_fpu ();
diff --git a/libs/ardour/ardour/audioplaylist.h b/libs/ardour/ardour/audioplaylist.h
index b5df4cfabb..b53f3c1f73 100644
--- a/libs/ardour/ardour/audioplaylist.h
+++ b/libs/ardour/ardour/audioplaylist.h
@@ -79,8 +79,8 @@ class AudioPlaylist : public ARDOUR::Playlist
XMLNode& state (bool full_state);
void dump () const;
- bool region_changed (PBD::PropertyChange, boost::shared_ptr<Region>);
- void crossfade_changed (PBD::PropertyChange);
+ bool region_changed (const PBD::PropertyChange&, boost::shared_ptr<Region>);
+ void crossfade_changed (const PBD::PropertyChange&);
void add_crossfade (boost::shared_ptr<Crossfade>);
void source_offset_changed (boost::shared_ptr<AudioRegion> region);
diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h
index 711c8030bd..ec9a64002f 100644
--- a/libs/ardour/ardour/audioregion.h
+++ b/libs/ardour/ardour/audioregion.h
@@ -44,6 +44,17 @@ namespace Properties {
extern PBD::PropertyDescriptor<bool> fade_in_active;
extern PBD::PropertyDescriptor<bool> fade_out_active;
extern PBD::PropertyDescriptor<float> scale_amplitude;
+ extern PBD::PropertyDescriptor<float> scale_amplitude;
+
+ /* the envelope and fades are not scalar items and so
+ currently (2010/02) are not stored using Property.
+ However, these descriptors enable us to notify
+ about changes to them via PropertyChange.
+ */
+
+ extern PBD::PropertyDescriptor<bool> envelope;
+ extern PBD::PropertyDescriptor<bool> fade_in;
+ extern PBD::PropertyDescriptor<bool> fade_out;
}
class Route;
@@ -58,14 +69,6 @@ class AudioRegion : public Region
public:
static void make_property_quarks ();
- static PBD::PropertyChange FadeInChanged;
- static PBD::PropertyChange FadeOutChanged;
- static PBD::PropertyChange FadeInActiveChanged;
- static PBD::PropertyChange FadeOutActiveChanged;
- static PBD::PropertyChange EnvelopeActiveChanged;
- static PBD::PropertyChange ScaleAmplitudeChanged;
- static PBD::PropertyChange EnvelopeChanged;
-
~AudioRegion();
void copy_settings (boost::shared_ptr<const AudioRegion>);
@@ -185,8 +188,7 @@ class AudioRegion : public Region
AudioRegion (const SourceList &);
AudioRegion (boost::shared_ptr<const AudioRegion>, frameoffset_t offset = 0, bool offset_relative = true);
AudioRegion (boost::shared_ptr<const AudioRegion>, const SourceList&);
- AudioRegion (boost::shared_ptr<AudioSource>, const XMLNode&);
- AudioRegion (SourceList &, const XMLNode&);
+ AudioRegion (SourceList &);
private:
PBD::Property<bool> _envelope_active;
@@ -197,7 +199,7 @@ class AudioRegion : public Region
PBD::Property<gain_t> _scale_amplitude;
void register_properties ();
- PBD::PropertyChange set_property (const PBD::PropertyBase& prop);
+ bool set_property (const PBD::PropertyBase& prop);
void post_set ();
void init ();
diff --git a/libs/ardour/ardour/crossfade.h b/libs/ardour/ardour/crossfade.h
index 15b9b3d2a7..7b5ac28379 100644
--- a/libs/ardour/ardour/crossfade.h
+++ b/libs/ardour/ardour/crossfade.h
@@ -34,6 +34,11 @@
#include "evoral/Curve.hpp"
namespace ARDOUR {
+ namespace Properties {
+ /* "active" is defined elsewhere but we use it with crossfade also */
+ extern PBD::PropertyDescriptor<bool> active;
+ extern PBD::PropertyDescriptor<bool> follow_overlap;
+ }
class AudioRegion;
class Playlist;
@@ -71,6 +76,8 @@ class Crossfade : public ARDOUR::AudioRegion
Crossfade (const Playlist&, XMLNode&);
virtual ~Crossfade();
+ static void make_property_quarks ();
+
bool operator== (const ARDOUR::Crossfade&);
XMLNode& get_state (void);
@@ -106,7 +113,6 @@ class Crossfade : public ARDOUR::AudioRegion
framecnt_t overlap_length() const;
PBD::Signal1<void,boost::shared_ptr<Region> > Invalidated;
- PBD::Signal1<void,PBD::PropertyChange> StateChanged;
bool covers (framecnt_t frame) const {
return _position <= frame && frame < _position + _length;
@@ -136,9 +142,6 @@ class Crossfade : public ARDOUR::AudioRegion
static framecnt_t short_xfade_length() { return _short_xfade_length; }
static void set_short_xfade_length (framecnt_t n);
- static PBD::PropertyChange ActiveChanged;
- static PBD::PropertyChange FollowOverlapChanged;
-
private:
friend struct CrossfadeComparePtr;
friend class AudioPlaylist;
@@ -147,11 +150,11 @@ class Crossfade : public ARDOUR::AudioRegion
boost::shared_ptr<ARDOUR::AudioRegion> _in;
boost::shared_ptr<ARDOUR::AudioRegion> _out;
- bool _active;
+ PBD::Property<bool> _active;
+ PBD::Property<bool> _follow_overlap;
bool _in_update;
OverlapType overlap_type;
AnchorPoint _anchor_point;
- bool _follow_overlap;
bool _fixed;
int32_t layer_relation;
diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h
index 90bcf4067a..48a9c2776b 100644
--- a/libs/ardour/ardour/diskstream.h
+++ b/libs/ardour/ardour/diskstream.h
@@ -206,7 +206,7 @@ class Diskstream : public SessionObject
/* XXX fix this redundancy ... */
- virtual void playlist_changed (PBD::PropertyChange);
+ virtual void playlist_changed (const PBD::PropertyChange&);
virtual void playlist_deleted (boost::weak_ptr<Playlist>);
virtual void playlist_ranges_moved (std::list< Evoral::RangeMove<framepos_t> > const &);
diff --git a/libs/ardour/ardour/internal_send.h b/libs/ardour/ardour/internal_send.h
index 2171462ab7..243106fb54 100644
--- a/libs/ardour/ardour/internal_send.h
+++ b/libs/ardour/ardour/internal_send.h
@@ -56,7 +56,7 @@ class InternalSend : public Send
PBD::ScopedConnection connect_c;
void send_to_going_away ();
- void send_to_name_changed ();
+ void send_to_property_changed (const PBD::PropertyChange&);
int connect_when_legal ();
int set_our_state (XMLNode const &, int);
};
diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h
index d93ffeec4a..938177b102 100644
--- a/libs/ardour/ardour/location.h
+++ b/libs/ardour/ardour/location.h
@@ -179,7 +179,7 @@ class Locations : public PBD::StatefulDestructible
PBD::Signal0<void> changed;
PBD::Signal1<void,Location*> added;
PBD::Signal1<void,Location*> removed;
- PBD::Signal1<void,PBD::PropertyChange> StateChanged;
+ PBD::Signal1<void,const PBD::PropertyChange&> StateChanged;
template<class T> void apply (T& obj, void (T::*method)(LocationList&)) {
Glib::Mutex::Lock lm (lock);
diff --git a/libs/ardour/ardour/midi_model.h b/libs/ardour/ardour/midi_model.h
index 77f5798898..fcd285f98c 100644
--- a/libs/ardour/ardour/midi_model.h
+++ b/libs/ardour/ardour/midi_model.h
@@ -90,7 +90,7 @@ public:
};
- /** PropertyChange note properties.
+ /** Change note properties.
* More efficient than DeltaCommand and has the important property that
* it leaves the objects in the MidiModel (Notes) the same, thus
* enabling selection and other state to persist across command
@@ -126,7 +126,7 @@ public:
boost::shared_ptr<MidiModel> _model;
const std::string _name;
- struct NotePropertyChange {
+ struct NoteChange {
DiffCommand::Property property;
boost::shared_ptr< Evoral::Note<TimeType> > note;
union {
@@ -139,11 +139,11 @@ public:
};
};
- typedef std::list<NotePropertyChange> ChangeList;
+ typedef std::list<NoteChange> ChangeList;
ChangeList _changes;
- XMLNode &marshal_change(const NotePropertyChange&);
- NotePropertyChange unmarshal_change(XMLNode *xml_note);
+ XMLNode &marshal_change(const NoteChange&);
+ NoteChange unmarshal_change(XMLNode *xml_note);
};
MidiModel::DeltaCommand* new_delta_command(const std::string name="midi edit");
diff --git a/libs/ardour/ardour/midi_playlist.h b/libs/ardour/ardour/midi_playlist.h
index 46aea9f0b4..ccadb39e92 100644
--- a/libs/ardour/ardour/midi_playlist.h
+++ b/libs/ardour/ardour/midi_playlist.h
@@ -74,7 +74,7 @@ protected:
private:
void dump () const;
- bool region_changed (PBD::PropertyChange, boost::shared_ptr<Region>);
+ bool region_changed (const PBD::PropertyChange&, boost::shared_ptr<Region>);
NoteMode _note_mode;
diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h
index d892e5837f..671e4fca43 100644
--- a/libs/ardour/ardour/midi_region.h
+++ b/libs/ardour/ardour/midi_region.h
@@ -96,11 +96,8 @@ class MidiRegion : public Region
private:
friend class RegionFactory;
- MidiRegion (boost::shared_ptr<MidiSource>);
MidiRegion (const SourceList&);
MidiRegion (boost::shared_ptr<const MidiRegion>, frameoffset_t offset = 0, bool offset_relative = true);
- MidiRegion (boost::shared_ptr<MidiSource>, const XMLNode&);
- MidiRegion (const SourceList &, const XMLNode&);
private:
framecnt_t _read_at (const SourceList&, Evoral::EventSink<nframes_t>& dst,
diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h
index 9cd02dec1e..7213c99397 100644
--- a/libs/ardour/ardour/playlist.h
+++ b/libs/ardour/ardour/playlist.h
@@ -249,15 +249,15 @@ class Playlist : public SessionObject
void notify_length_changed ();
void notify_layering_changed ();
void notify_contents_changed ();
- void notify_state_changed (PBD::PropertyChange);
+ void notify_state_changed (const PBD::PropertyChange&);
void notify_region_moved (boost::shared_ptr<Region>);
void mark_session_dirty();
- void region_changed_proxy (PBD::PropertyChange, boost::weak_ptr<Region>);
- virtual bool region_changed (PBD::PropertyChange, boost::shared_ptr<Region>);
+ void region_changed_proxy (const PBD::PropertyChange&, boost::weak_ptr<Region>);
+ virtual bool region_changed (const PBD::PropertyChange&, boost::shared_ptr<Region>);
- void region_bounds_changed (PBD::PropertyChange, boost::shared_ptr<Region>);
+ void region_bounds_changed (const PBD::PropertyChange&, boost::shared_ptr<Region>);
void region_deleted (boost::shared_ptr<Region>);
void sort_regions ();
diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h
index 60ccf66984..fb827e308d 100644
--- a/libs/ardour/ardour/region.h
+++ b/libs/ardour/ardour/region.h
@@ -89,16 +89,7 @@ class Region
MusicTime
};
- static PBD::PropertyChange FadeChanged;
- static PBD::PropertyChange SyncOffsetChanged;
- static PBD::PropertyChange MuteChanged;
- static PBD::PropertyChange OpacityChanged;
- static PBD::PropertyChange LockChanged;
- static PBD::PropertyChange LayerChanged;
- static PBD::PropertyChange HiddenChanged;
-
- PBD::Signal1<void,PBD::PropertyChange> StateChanged;
- static PBD::Signal1<void,boost::shared_ptr<ARDOUR::Region> > RegionPropertyChanged;
+ static PBD::Signal2<void,boost::shared_ptr<ARDOUR::Region>, const PBD::PropertyChange&> RegionPropertyChanged;
void unlock_property_changes () { _no_property_changes = false; }
void block_property_changes () { _no_property_changes = true; }
@@ -281,8 +272,6 @@ class Region
protected:
friend class RegionFactory;
- /** Construct a region from a single source */
- Region (boost::shared_ptr<Source> src);
/** Construct a region from multiple sources*/
Region (const SourceList& srcs);
/** Construct a region from another region, at an offset within that region */
@@ -292,16 +281,11 @@ class Region
/** normal Region copy constructor */
Region (boost::shared_ptr<const Region>);
- /** Construct a region from 1 source and XML state */
- Region (boost::shared_ptr<Source> src, const XMLNode&);
- /** Construct a region from multiple sources and XML state */
- Region (const SourceList& srcs, const XMLNode&);
-
/** Constructor for derived types only */
Region (Session& s, framepos_t start, framecnt_t length, const std::string& name, DataType);
protected:
- void send_change (PBD::PropertyChange);
+ void send_change (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);
@@ -351,7 +335,7 @@ class Region
AnalysisFeatureList _transients;
bool _valid_transients;
mutable uint64_t _read_data_count; ///< modified in read()
- PBD::PropertyChange _pending_changed;
+ PBD::PropertyChange _pending_changed;
uint64_t _last_layer_op; ///< timestamp
Glib::Mutex _lock;
SourceList _sources;
@@ -365,7 +349,7 @@ class Region
virtual int _set_state (const XMLNode&, int version, PBD::PropertyChange& what_changed, bool send_signal);
- PBD::PropertyChange set_property (const PBD::PropertyBase&);
+ bool set_property (const PBD::PropertyBase&);
void register_properties ();
private:
diff --git a/libs/ardour/ardour/route_group.h b/libs/ardour/ardour/route_group.h
index 820295b54a..f3109a707d 100644
--- a/libs/ardour/ardour/route_group.h
+++ b/libs/ardour/ardour/route_group.h
@@ -131,9 +131,6 @@ class RouteGroup : public SessionObject
PBD::Signal0<void> changed;
PBD::Signal1<void,void*> FlagsChanged;
- static PBD::PropertyChange FlagsChange;
- static PBD::PropertyChange PropertiesChange;
-
XMLNode& get_state ();
int set_state (const XMLNode&, int version);
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 154c5d0078..9294d56fcc 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -1210,7 +1210,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
void xrun_recovery ();
TempoMap *_tempo_map;
- void tempo_map_changed (PBD::PropertyChange);
+ void tempo_map_changed (const PBD::PropertyChange&);
/* edit/mix groups */
@@ -1257,7 +1257,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
RegionList regions;
void add_region (boost::shared_ptr<Region>);
- void region_changed (PBD::PropertyChange, boost::weak_ptr<Region>);
+ void region_changed (const PBD::PropertyChange&, boost::weak_ptr<Region>);
void remove_region (boost::weak_ptr<Region>);
int load_regions (const XMLNode& node);
diff --git a/libs/ardour/ardour/session_object.h b/libs/ardour/ardour/session_object.h
index 1f81cf6fd2..d18a1f9d41 100644
--- a/libs/ardour/ardour/session_object.h
+++ b/libs/ardour/ardour/session_object.h
@@ -48,7 +48,7 @@ class SessionObject : public SessionHandleRef, public PBD::StatefulDestructible
SessionObject (Session& session, const std::string& name)
: SessionHandleRef (session)
- , _name (Properties::name, PBD::PropertyChange (0), name)
+ , _name (Properties::name, name)
{
add_property (_name);
}
@@ -56,18 +56,16 @@ class SessionObject : public SessionHandleRef, public PBD::StatefulDestructible
Session& session() const { return _session; }
std::string name() const { return _name; }
- PBD::PropertyChange set_property (const PBD::PropertyBase& prop);
+ bool set_property (const PBD::PropertyBase& prop);
virtual bool set_name (const std::string& str) {
if (_name != str) {
_name = str;
- NameChanged();
+ PropertyChanged (PBD::PropertyChange (Properties::name));
}
return true;
}
- PBD::Signal0<void> NameChanged;
-
protected:
PBD::Property<std::string> _name;
};
diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h
index 5c2d3d6918..596444173f 100644
--- a/libs/ardour/ardour/tempo.h
+++ b/libs/ardour/ardour/tempo.h
@@ -258,8 +258,6 @@ class TempoMap : public PBD::StatefulDestructible
nframes_t frame_rate () const { return _frame_rate; }
- PBD::Signal1<void,PBD::PropertyChange> StateChanged;
-
private:
static Tempo _default_tempo;
static Meter _default_meter;
diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc
index 60c7d4bdc3..6e8b35a072 100644
--- a/libs/ardour/audio_playlist.cc
+++ b/libs/ardour/audio_playlist.cc
@@ -525,7 +525,7 @@ AudioPlaylist::add_crossfade (boost::shared_ptr<Crossfade> xfade)
_crossfades.push_back (xfade);
xfade->Invalidated.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1));
- xfade->StateChanged.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
+ xfade->PropertyChanged.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
notify_crossfade_added (xfade);
}
@@ -581,7 +581,7 @@ AudioPlaylist::set_state (const XMLNode& node, int version)
boost::shared_ptr<Crossfade> xfade = boost::shared_ptr<Crossfade> (new Crossfade (*((const Playlist *)this), *child));
_crossfades.push_back (xfade);
xfade->Invalidated.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1));
- xfade->StateChanged.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
+ xfade->PropertyChanged.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
NewCrossfade(xfade);
}
@@ -726,7 +726,7 @@ AudioPlaylist::destroy_region (boost::shared_ptr<Region> region)
}
void
-AudioPlaylist::crossfade_changed (PropertyChange)
+AudioPlaylist::crossfade_changed (const PropertyChange&)
{
if (in_flush || in_set_state) {
return;
@@ -742,24 +742,27 @@ AudioPlaylist::crossfade_changed (PropertyChange)
}
bool
-AudioPlaylist::region_changed (PropertyChange what_changed, boost::shared_ptr<Region> region)
+AudioPlaylist::region_changed (const PropertyChange& what_changed, boost::shared_ptr<Region> region)
{
if (in_flush || in_set_state) {
return false;
}
- PropertyChange our_interests = PropertyChange (AudioRegion::FadeInChanged|
- AudioRegion::FadeOutChanged|
- AudioRegion::FadeInActiveChanged|
- AudioRegion::FadeOutActiveChanged|
- AudioRegion::EnvelopeActiveChanged|
- AudioRegion::ScaleAmplitudeChanged|
- AudioRegion::EnvelopeChanged);
+ PropertyChange our_interests;
+
+ our_interests.add (Properties::fade_in_active);
+ our_interests.add (Properties::fade_out_active);
+ our_interests.add (Properties::scale_amplitude);
+ our_interests.add (Properties::envelope_active);
+ our_interests.add (Properties::envelope);
+ our_interests.add (Properties::fade_in);
+ our_interests.add (Properties::fade_out);
+
bool parent_wants_notify;
parent_wants_notify = Playlist::region_changed (what_changed, region);
- if ((parent_wants_notify || (what_changed & our_interests))) {
+ if (parent_wants_notify || (what_changed.contains (our_interests))) {
notify_contents_changed ();
}
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index f1af3b6fab..21fda237cb 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -89,12 +89,12 @@ AudioRegion::register_properties ()
}
#define AUDIOREGION_STATE_DEFAULT \
- _envelope_active (Properties::envelope_active, EnvelopeActiveChanged, false) \
- , _default_fade_in (Properties::default_fade_in, FadeInChanged, true) \
- , _default_fade_out (Properties::default_fade_out, FadeOutChanged, true) \
- , _fade_in_active (Properties::fade_in_active, FadeInActiveChanged, true) \
- , _fade_out_active (Properties::fade_out_active, FadeOutActiveChanged, true) \
- , _scale_amplitude (Properties::scale_amplitude, ScaleAmplitudeChanged, 1.0)
+ _envelope_active (Properties::envelope_active, false) \
+ , _default_fade_in (Properties::default_fade_in, true) \
+ , _default_fade_out (Properties::default_fade_out, true) \
+ , _fade_in_active (Properties::fade_in_active, true) \
+ , _fade_out_active (Properties::fade_out_active, true) \
+ , _scale_amplitude (Properties::scale_amplitude, 0.0)
#define AUDIOREGION_COPY_STATE(other) \
_envelope_active (other->_envelope_active) \
@@ -104,14 +104,6 @@ AudioRegion::register_properties ()
, _fade_out_active (other->_fade_out_active) \
, _scale_amplitude (other->_scale_amplitude)
-PropertyChange AudioRegion::FadeInChanged = PBD::new_change();
-PropertyChange AudioRegion::FadeOutChanged = PBD::new_change();
-PropertyChange AudioRegion::FadeInActiveChanged = PBD::new_change();
-PropertyChange AudioRegion::FadeOutActiveChanged = PBD::new_change();
-PropertyChange AudioRegion::EnvelopeActiveChanged = PBD::new_change();
-PropertyChange AudioRegion::ScaleAmplitudeChanged = PBD::new_change();
-PropertyChange AudioRegion::EnvelopeChanged = PBD::new_change();
-
/* a Session will reset these to its chosen defaults by calling AudioRegion::set_default_fade() */
void
@@ -142,26 +134,7 @@ AudioRegion::AudioRegion (Session& s, framepos_t start, framecnt_t len, std::str
assert (_sources.size() == _master_sources.size());
}
-/** Basic AudioRegion constructor (one channel) */
-AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src)
- : Region (boost::static_pointer_cast<Source>(src))
- , AUDIOREGION_STATE_DEFAULT
- , _automatable(src->session())
- , _fade_in (new AutomationList(Evoral::Parameter(FadeInAutomation)))
- , _fade_out (new AutomationList(Evoral::Parameter(FadeOutAutomation)))
- , _envelope (new AutomationList(Evoral::Parameter(EnvelopeAutomation)))
- , _fade_in_suspended (0)
- , _fade_out_suspended (0)
-{
- init ();
-
- /* XXX why is this set here ? - set in a property list given to RegionFactory */
- _external = true;
-
- assert (_sources.size() == _master_sources.size());
-}
-
-/** Basic AudioRegion constructor (many channels) */
+/** Basic AudioRegion constructor */
AudioRegion::AudioRegion (const SourceList& srcs)
: Region (srcs)
, AUDIOREGION_STATE_DEFAULT
@@ -219,26 +192,8 @@ AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other, const Sour
assert (_sources.size() == _master_sources.size());
}
-AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, const XMLNode& node)
- : Region (src, node)
- , AUDIOREGION_STATE_DEFAULT
- , _automatable(src->session())
- , _fade_in (new AutomationList(Evoral::Parameter(FadeInAutomation)))
- , _fade_out (new AutomationList(Evoral::Parameter(FadeOutAutomation)))
- , _envelope (new AutomationList(Evoral::Parameter(EnvelopeAutomation)))
-{
- init ();
-
- if (set_state (node, Stateful::loading_state_version)) {
- throw failed_constructor();
- }
-
- assert(_type == DataType::AUDIO);
- assert (_sources.size() == _master_sources.size());
-}
-
-AudioRegion::AudioRegion (SourceList& srcs, const XMLNode& node)
- : Region (srcs, node)
+AudioRegion::AudioRegion (SourceList& srcs)
+ : Region (srcs)
, AUDIOREGION_STATE_DEFAULT
, _automatable(srcs[0]->session())
, _fade_in (new AutomationList(Evoral::Parameter(FadeInAutomation)))
@@ -249,12 +204,7 @@ AudioRegion::AudioRegion (SourceList& srcs, const XMLNode& node)
{
init ();
- if (set_state (node, Stateful::loading_state_version)) {
- throw failed_constructor();
- }
-
assert(_type == DataType::AUDIO);
- connect_to_analysis_changed ();
assert (_sources.size() == _master_sources.size());
}
@@ -327,7 +277,7 @@ AudioRegion::set_envelope_active (bool yn)
{
if (envelope_active() != yn) {
_envelope_active = yn;
- send_change (EnvelopeActiveChanged);
+ send_change (PropertyChange (Properties::envelope_active));
}
}
@@ -650,8 +600,7 @@ AudioRegion::_set_state (const XMLNode& node, int version, PropertyChange& what_
float a = atof (prop->value().c_str());
if (a != _scale_amplitude) {
_scale_amplitude = a;
- what_changed = PropertyChange (what_changed|ScaleAmplitudeChanged);
- cerr << _name << " amp changed\n";
+ what_changed.add (Properties::scale_amplitude);
}
}
@@ -730,7 +679,6 @@ AudioRegion::_set_state (const XMLNode& node, int version, PropertyChange& what_
thaw ();
if (send) {
- cerr << _name << ": audio final change: " << hex << what_changed << dec << endl;
send_change (what_changed);
}
@@ -741,54 +689,52 @@ AudioRegion::_set_state (const XMLNode& node, int version, PropertyChange& what_
return 0;
}
-PropertyChange
+bool
AudioRegion::set_property (const PropertyBase& prop)
{
- PropertyChange c = PropertyChange (0);
-
DEBUG_TRACE (DEBUG::Properties, string_compose ("audio region %1 set property %2\n", _name.val(), prop.property_name()));
if (prop == Properties::envelope_active.id) {
bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
if (val != _envelope_active) {
_envelope_active = val;
- c = EnvelopeActiveChanged;
+ return true;
}
} else if (prop == Properties::default_fade_in.id) {
bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
if (val != _default_fade_in) {
_default_fade_in = val;
- c = FadeInChanged;
+ return true;
}
} else if (prop == Properties::default_fade_out.id) {
bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
if (val != _default_fade_out) {
_default_fade_out = val;
- c = FadeOutChanged;
+ return true;
}
} else if (prop == Properties::fade_in_active.id) {
bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
if (val != _fade_in_active) {
_fade_in_active = val;
- c = FadeInActiveChanged;
+ return true;
}
} else if (prop == Properties::fade_out_active.id) {
bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
if (val != _fade_out_active) {
_fade_out_active = val;
- c = FadeOutChanged;
+ return true;
}
} else if (prop == Properties::scale_amplitude.id) {
gain_t val = dynamic_cast<const PropertyTemplate<gain_t>*>(&prop)->val();
if (val != _scale_amplitude) {
_scale_amplitude = val;
- c = ScaleAmplitudeChanged;
+ return true;
}
} else {
return Region::set_property (prop);
}
-
- return c;
+
+ return false;
}
int
@@ -817,7 +763,7 @@ AudioRegion::set_fade_in (boost::shared_ptr<AutomationList> f)
*_fade_in = *f;
_fade_in->thaw ();
- send_change (FadeInChanged);
+ send_change (PropertyChange (Properties::fade_in));
}
void
@@ -884,7 +830,7 @@ AudioRegion::set_fade_out (boost::shared_ptr<AutomationList> f)
*_fade_out = *f;
_fade_out->thaw ();
- send_change (FadeInChanged);
+ send_change (PropertyChange (Properties::fade_in));
}
void
@@ -953,7 +899,7 @@ AudioRegion::set_fade_in_length (framecnt_t len)
if (changed) {
_default_fade_in = false;
- send_change (FadeInChanged);
+ send_change (PropertyChange (Properties::fade_in));
}
}
@@ -968,7 +914,7 @@ AudioRegion::set_fade_out_length (framecnt_t len)
if (changed) {
_default_fade_out = false;
- send_change (FadeOutChanged);
+ send_change (PropertyChange (Properties::fade_out));
}
}
@@ -980,7 +926,7 @@ AudioRegion::set_fade_in_active (bool yn)
}
_fade_in_active = yn;
- send_change (FadeInActiveChanged);
+ send_change (PropertyChange (Properties::fade_in_active));
}
void
@@ -990,7 +936,7 @@ AudioRegion::set_fade_out_active (bool yn)
return;
}
_fade_out_active = yn;
- send_change (FadeOutActiveChanged);
+ send_change (PropertyChange (Properties::fade_out_active));
}
bool
@@ -1050,12 +996,12 @@ AudioRegion::recompute_at_end ()
if (_fade_in->back()->when > _length) {
_fade_in->extend_to (_length);
- send_change (FadeInChanged);
+ send_change (PropertyChange (Properties::fade_in));
}
if (_fade_out->back()->when > _length) {
_fade_out->extend_to (_length);
- send_change (FadeOutChanged);
+ send_change (PropertyChange (Properties::fade_out));
}
}
@@ -1068,12 +1014,12 @@ AudioRegion::recompute_at_start ()
if (_fade_in->back()->when > _length) {
_fade_in->extend_to (_length);
- send_change (FadeInChanged);
+ send_change (PropertyChange (Properties::fade_in));
}
if (_fade_out->back()->when > _length) {
_fade_out->extend_to (_length);
- send_change (FadeOutChanged);
+ send_change (PropertyChange (Properties::fade_out));
}
}
@@ -1212,7 +1158,7 @@ AudioRegion::set_scale_amplitude (gain_t g)
/* tell everybody else */
- send_change (ScaleAmplitudeChanged);
+ send_change (PropertyChange (Properties::scale_amplitude));
}
void
@@ -1282,25 +1228,25 @@ AudioRegion::normalize_to (float target_dB)
/* tell everybody else */
- send_change (ScaleAmplitudeChanged);
+ send_change (PropertyChange (Properties::scale_amplitude));
}
void
AudioRegion::fade_in_changed ()
{
- send_change (FadeInChanged);
+ send_change (PropertyChange (Properties::fade_in));
}
void
AudioRegion::fade_out_changed ()
{
- send_change (FadeOutChanged);
+ send_change (PropertyChange (Properties::fade_out));
}
void
AudioRegion::envelope_changed ()
{
- send_change (EnvelopeChanged);
+ send_change (PropertyChange (Properties::envelope));
}
void
diff --git a/libs/ardour/crossfade.cc b/libs/ardour/crossfade.cc
index dc84352f4e..8275876fe8 100644
--- a/libs/ardour/crossfade.cc
+++ b/libs/ardour/crossfade.cc
@@ -37,8 +37,6 @@ using namespace ARDOUR;
using namespace PBD;
framecnt_t Crossfade::_short_xfade_length = 0;
-PropertyChange Crossfade::ActiveChanged = new_change();
-PropertyChange Crossfade::FollowOverlapChanged = new_change();
/* XXX if and when we ever implement parallel processing of the process()
callback, these will need to be handled on a per-thread basis.
@@ -47,6 +45,24 @@ PropertyChange Crossfade::FollowOverlapChanged = new_change();
Sample* Crossfade::crossfade_buffer_out = 0;
Sample* Crossfade::crossfade_buffer_in = 0;
+
+#define CROSSFADE_DEFAULT_PROPERTIES \
+ _active (Properties::active, _session.config.get_xfades_active ()) \
+ , _follow_overlap (Properties::follow_overlap, false)
+
+
+namespace ARDOUR {
+ namespace Properties {
+ PropertyDescriptor<bool> follow_overlap;
+ }
+}
+
+void
+Crossfade::make_property_quarks ()
+{
+ Properties::follow_overlap.id = g_quark_from_static_string (X_("follow-overlap"));
+}
+
void
Crossfade::set_buffer_size (framecnt_t sz)
{
@@ -72,26 +88,25 @@ Crossfade::Crossfade (boost::shared_ptr<AudioRegion> in, boost::shared_ptr<Audio
framecnt_t length,
framepos_t position,
AnchorPoint ap)
- : AudioRegion (in->session(), position, length, in->name() + string ("<>") + out->name()),
- _fade_in (Evoral::Parameter(FadeInAutomation)), // linear (gain coefficient) => -inf..+6dB
- _fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB
+ : AudioRegion (in->session(), position, length, in->name() + string ("<>") + out->name())
+ , CROSSFADE_DEFAULT_PROPERTIES
+ , _fade_in (Evoral::Parameter(FadeInAutomation)) // linear (gain coefficient) => -inf..+6dB
+ , _fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB
{
_in = in;
_out = out;
_anchor_point = ap;
- _follow_overlap = false;
-
- _active = _session.config.get_xfades_active ();
_fixed = true;
initialize ();
}
Crossfade::Crossfade (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioRegion> b, CrossfadeModel model, bool act)
- : AudioRegion (a->session(), 0, 0, a->name() + string ("<>") + b->name()),
- _fade_in (Evoral::Parameter(FadeInAutomation)), // linear (gain coefficient) => -inf..+6dB
- _fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB
+ : AudioRegion (a->session(), 0, 0, a->name() + string ("<>") + b->name())
+ , CROSSFADE_DEFAULT_PROPERTIES
+ , _fade_in (Evoral::Parameter(FadeInAutomation)) // linear (gain coefficient) => -inf..+6dB
+ , _fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB
{
_in_update = false;
_fixed = false;
@@ -107,9 +122,10 @@ Crossfade::Crossfade (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioR
}
Crossfade::Crossfade (const Playlist& playlist, XMLNode& node)
- : AudioRegion (playlist.session(), 0, 0, "unnamed crossfade"),
- _fade_in (Evoral::Parameter(FadeInAutomation)), // linear (gain coefficient) => -inf..+6dB
- _fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB
+ : AudioRegion (playlist.session(), 0, 0, "unnamed crossfade")
+ , CROSSFADE_DEFAULT_PROPERTIES
+ , _fade_in (Evoral::Parameter(FadeInAutomation)) // linear (gain coefficient) => -inf..+6dB
+ , _fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB
{
boost::shared_ptr<Region> r;
@@ -163,6 +179,7 @@ Crossfade::Crossfade (const Playlist& playlist, XMLNode& node)
Crossfade::Crossfade (boost::shared_ptr<Crossfade> orig, boost::shared_ptr<AudioRegion> newin, boost::shared_ptr<AudioRegion> newout)
: AudioRegion (boost::dynamic_pointer_cast<const AudioRegion> (orig), 0, true)
+ , CROSSFADE_DEFAULT_PROPERTIES
, _fade_in (orig->_fade_in)
, _fade_out (orig->_fade_out)
{
@@ -377,7 +394,7 @@ Crossfade::set_active (bool yn)
{
if (_active != yn) {
_active = yn;
- StateChanged (ActiveChanged);
+ PropertyChanged (PropertyChange (Properties::active));
}
}
@@ -442,7 +459,11 @@ Crossfade::refresh ()
}
if (send_signal) {
- StateChanged (BoundsChanged); /* EMIT SIGNAL */
+ PropertyChange bounds;
+ bounds.add (Properties::start);
+ bounds.add (Properties::position);
+ bounds.add (Properties::length);
+ PropertyChanged (bounds); /* EMIT SIGNAL */
}
_in_update = false;
@@ -722,14 +743,14 @@ Crossfade::set_state (const XMLNode& node, int /*version*/)
XMLNode* fo;
const XMLProperty* prop;
LocaleGuard lg (X_("POSIX"));
- PropertyChange what_changed = PropertyChange (0);
+ PropertyChange what_changed;
framepos_t val;
if ((prop = node.property ("position")) != 0) {
sscanf (prop->value().c_str(), "%" PRId64, &val);
if (val != _position) {
_position = val;
- what_changed = PropertyChange (what_changed | PositionChanged);
+ what_changed.add (Properties::position);
}
} else {
warning << _("old-style crossfade information - no position information") << endmsg;
@@ -740,7 +761,7 @@ Crossfade::set_state (const XMLNode& node, int /*version*/)
bool x = string_is_affirmative (prop->value());
if (x != _active) {
_active = x;
- what_changed = PropertyChange (what_changed | ActiveChanged);
+ what_changed.add (Properties::active);
}
} else {
_active = true;
@@ -769,7 +790,7 @@ Crossfade::set_state (const XMLNode& node, int /*version*/)
sscanf (prop->value().c_str(), "%" PRId64, &val);
if (val != _length) {
_length = val;
- what_changed = PropertyChange (what_changed | LengthChanged);
+ what_changed.add (Properties::length);
}
} else {
@@ -840,7 +861,7 @@ Crossfade::set_state (const XMLNode& node, int /*version*/)
_fade_out.thaw ();
- StateChanged (what_changed); /* EMIT SIGNAL */
+ PropertyChanged (what_changed); /* EMIT SIGNAL */
return 0;
}
@@ -866,7 +887,7 @@ Crossfade::set_follow_overlap (bool yn)
set_xfade_length (_out->first_frame() + _out->length() - _in->first_frame());
}
- StateChanged (FollowOverlapChanged);
+ PropertyChanged (PropertyChange (Properties::follow_overlap));
}
framecnt_t
@@ -900,8 +921,8 @@ Crossfade::set_xfade_length (framecnt_t len)
_length = len;
- StateChanged (LengthChanged);
-
+ PropertyChanged (PropertyChange (Properties::length));
+
return len;
}
diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc
index 6aee3a7572..f80eb849ec 100644
--- a/libs/ardour/diskstream.cc
+++ b/libs/ardour/diskstream.cc
@@ -361,7 +361,7 @@ Diskstream::use_playlist (boost::shared_ptr<Playlist> playlist)
}
void
-Diskstream::playlist_changed (PropertyChange)
+Diskstream::playlist_changed (const PropertyChange&)
{
playlist_modified ();
}
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc
index f117e6d063..ee19f1caac 100644
--- a/libs/ardour/globals.cc
+++ b/libs/ardour/globals.cc
@@ -102,12 +102,6 @@ MIDI::Port *ARDOUR::default_mtc_port = 0;
MIDI::Port *ARDOUR::default_midi_port = 0;
MIDI::Port *ARDOUR::default_midi_clock_port = 0;
-PropertyChange ARDOUR::StartChanged = PBD::new_change ();
-PropertyChange ARDOUR::LengthChanged = PBD::new_change ();
-PropertyChange ARDOUR::PositionChanged = PBD::new_change ();
-PropertyChange ARDOUR::NameChanged = PBD::new_change ();
-PropertyChange ARDOUR::BoundsChanged = PropertyChange (0); // see init(), below
-
compute_peak_t ARDOUR::compute_peak = 0;
find_peaks_t ARDOUR::find_peaks = 0;
apply_gain_to_buffer_t ARDOUR::apply_gain_to_buffer = 0;
@@ -118,6 +112,36 @@ PBD::Signal1<void,std::string> ARDOUR::BootMessage;
void ARDOUR::setup_enum_writer ();
+/* this is useful for quite a few things that want to check
+ if any bounds-related property has changed
+*/
+PBD::PropertyChange ARDOUR::bounds_change;
+
+namespace ARDOUR {
+ namespace Properties {
+
+ /* the envelope and fades are not scalar items and so
+ currently (2010/02) are not stored using Property.
+ However, these descriptors enable us to notify
+ about changes to them via PropertyChange.
+
+ Declared in ardour/audioregion.h ...
+ */
+
+ PBD::PropertyDescriptor<bool> fade_in;
+ PBD::PropertyDescriptor<bool> fade_out;
+ PBD::PropertyDescriptor<bool> envelope;
+ }
+}
+
+void
+ARDOUR::make_property_quarks ()
+{
+ Properties::fade_in.id = g_quark_from_static_string (X_("fade_in_FAKE"));
+ Properties::fade_out.id = g_quark_from_static_string (X_("fade_out_FAKE"));
+ Properties::envelope.id = g_quark_from_static_string (X_("envelope_FAKE"));
+}
+
int
ARDOUR::setup_midi ()
{
@@ -302,12 +326,23 @@ ARDOUR::init (bool use_vst, bool try_optimization)
PBD::ID::init ();
SessionEvent::init_event_pool ();
-
+
+ make_property_quarks ();
SessionObject::make_property_quarks ();
Region::make_property_quarks ();
AudioRegion::make_property_quarks ();
RouteGroup::make_property_quarks ();
+ /* this is a useful ready to use PropertyChange that many
+ things need to check. This avoids having to compose
+ it every time we want to check for any of the relevant
+ property changes.
+ */
+
+ bounds_change.add (ARDOUR::Properties::start);
+ bounds_change.add (ARDOUR::Properties::position);
+ bounds_change.add (ARDOUR::Properties::length);
+
/* provide a state version for the few cases that need it and are not
driven by reading state from disk (e.g. undo/redo)
*/
@@ -367,8 +402,6 @@ ARDOUR::init (bool use_vst, bool try_optimization)
/* singleton - first object is "it" */
new PluginManager ();
- BoundsChanged = PropertyChange (StartChanged|PositionChanged|LengthChanged);
-
return 0;
}
diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc
index 4a4823a29f..5944677934 100644
--- a/libs/ardour/internal_send.cc
+++ b/libs/ardour/internal_send.cc
@@ -44,7 +44,7 @@ InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> mm, boost:
set_name (sendto->name());
_send_to->DropReferences.connect_same_thread (*this, boost::bind (&InternalSend::send_to_going_away, this));
- _send_to->NameChanged.connect_same_thread (*this, boost::bind (&InternalSend::send_to_name_changed, this));
+ _send_to->PropertyChanged.connect_same_thread (*this, boost::bind (&InternalSend::send_to_property_changed, this, _1));;
}
InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode& node)
@@ -269,7 +269,9 @@ InternalSend::visible () const
}
void
-InternalSend::send_to_name_changed ()
+InternalSend::send_to_property_changed (const PropertyChange& what_changed)
{
- set_name (_send_to->name ());
+ if (what_changed.contains (Properties::name)) {
+ set_name (_send_to->name ());
+ }
}
diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc
index baa3c2c7c0..ac3360ea2b 100644
--- a/libs/ardour/midi_model.cc
+++ b/libs/ardour/midi_model.cc
@@ -326,7 +326,7 @@ void
MidiModel::DiffCommand::change(const boost::shared_ptr< Evoral::Note<TimeType> > note, Property prop,
uint8_t new_value)
{
- NotePropertyChange change;
+ NoteChange change;
change.note = note;
change.property = prop;
@@ -359,7 +359,7 @@ void
MidiModel::DiffCommand::change(const boost::shared_ptr< Evoral::Note<TimeType> > note, Property prop,
TimeType new_time)
{
- NotePropertyChange change;
+ NoteChange change;
change.note = note;
change.property = prop;
@@ -443,7 +443,7 @@ MidiModel::DiffCommand::undo()
}
XMLNode&
-MidiModel::DiffCommand::marshal_change(const NotePropertyChange& change)
+MidiModel::DiffCommand::marshal_change(const NoteChange& change)
{
XMLNode* xml_change = new XMLNode("change");
@@ -516,11 +516,11 @@ MidiModel::DiffCommand::marshal_change(const NotePropertyChange& change)
return *xml_change;
}
-MidiModel::DiffCommand::NotePropertyChange
+MidiModel::DiffCommand::NoteChange
MidiModel::DiffCommand::unmarshal_change(XMLNode *xml_change)
{
XMLProperty* prop;
- NotePropertyChange change;
+ NoteChange change;
unsigned int note;
unsigned int channel;
unsigned int velocity;
diff --git a/libs/ardour/midi_playlist.cc b/libs/ardour/midi_playlist.cc
index cafbcc9e93..8c94bb1a7f 100644
--- a/libs/ardour/midi_playlist.cc
+++ b/libs/ardour/midi_playlist.cc
@@ -415,7 +415,7 @@ MidiPlaylist::contained_automation()
bool
-MidiPlaylist::region_changed (PBD::PropertyChange what_changed, boost::shared_ptr<Region> region)
+MidiPlaylist::region_changed (const PBD::PropertyChange& what_changed, boost::shared_ptr<Region> region)
{
if (in_flush || in_set_state) {
return false;
@@ -423,18 +423,13 @@ MidiPlaylist::region_changed (PBD::PropertyChange what_changed, boost::shared_pt
// Feeling rather uninterested today, but thanks for the heads up anyway!
- PBD::PropertyChange our_interests = PBD::PropertyChange (/*MidiRegion::FadeInChanged|
- MidiRegion::FadeOutChanged|
- MidiRegion::FadeInActiveChanged|
- MidiRegion::FadeOutActiveChanged|
- MidiRegion::EnvelopeActiveChanged|
- MidiRegion::ScaleAmplitudeChanged|
- MidiRegion::EnvelopeChanged*/);
+ PBD::PropertyChange our_interests;
+
bool parent_wants_notify;
parent_wants_notify = Playlist::region_changed (what_changed, region);
- if ((parent_wants_notify || (what_changed & our_interests))) {
+ if (parent_wants_notify || what_changed.contains (our_interests)) {
notify_contents_changed ();
}
diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc
index f166dafda8..936ce047ee 100644
--- a/libs/ardour/midi_region.cc
+++ b/libs/ardour/midi_region.cc
@@ -47,23 +47,15 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
-/** Basic MidiRegion constructor (one channel) */
-MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src)
- : Region (src)
-{
- assert(_name.val().find("/") == string::npos);
- midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
-}
-
/* Basic MidiRegion constructor (many channels) */
MidiRegion::MidiRegion (const SourceList& srcs)
: Region (srcs)
{
- assert(_name.val().find("/") == string::npos);
midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
+ assert(_name.val().find("/") == string::npos);
+ assert(_type == DataType::MIDI);
}
-
/** Create a new MidiRegion, that is part of an existing one */
MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other, frameoffset_t offset, bool offset_relative)
: Region (other, offset, offset_relative)
@@ -72,30 +64,6 @@ MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other, frameoffset_t
midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
}
-MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, const XMLNode& node)
- : Region (src, node)
-{
- if (set_state (node, Stateful::loading_state_version)) {
- throw failed_constructor();
- }
-
- midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
- assert(_name.val().find("/") == string::npos);
- assert(_type == DataType::MIDI);
-}
-
-MidiRegion::MidiRegion (const SourceList& srcs, const XMLNode& node)
- : Region (srcs, node)
-{
- if (set_state (node, Stateful::loading_state_version)) {
- throw failed_constructor();
- }
-
- midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
- assert(_name.val().find("/") == string::npos);
- assert(_type == DataType::MIDI);
-}
-
MidiRegion::~MidiRegion ()
{
}
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index 9d909d0fa6..f3a9c99497 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -666,7 +666,7 @@ Playlist::add_region_internal (boost::shared_ptr<Region> region, framepos_t posi
}
}
- region->StateChanged.connect_same_thread (region_state_changed_connections, boost::bind (&Playlist::region_changed_proxy, this, _1, boost::weak_ptr<Region> (region)));
+ region->PropertyChanged.connect_same_thread (region_state_changed_connections, boost::bind (&Playlist::region_changed_proxy, this, _1, boost::weak_ptr<Region> (region)));
return true;
}
@@ -1383,13 +1383,13 @@ Playlist::core_splice (framepos_t at, framecnt_t distance, boost::shared_ptr<Reg
}
void
-Playlist::region_bounds_changed (PropertyChange what_changed, boost::shared_ptr<Region> region)
+Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shared_ptr<Region> region)
{
if (in_set_state || _splicing || _nudging || _shuffling) {
return;
}
- if (what_changed & ARDOUR::PositionChanged) {
+ if (what_changed.contains (Properties::position)) {
/* remove it from the list then add it back in
the right place again.
@@ -1410,15 +1410,15 @@ Playlist::region_bounds_changed (PropertyChange what_changed, boost::shared_ptr<
regions.insert (upper_bound (regions.begin(), regions.end(), region, cmp), region);
}
- if (what_changed & PropertyChange (ARDOUR::PositionChanged|ARDOUR::LengthChanged)) {
+ if (what_changed.contains (Properties::position) || what_changed.contains (Properties::length)) {
frameoffset_t delta = 0;
- if (what_changed & ARDOUR::PositionChanged) {
+ if (what_changed.contains (Properties::position)) {
delta = region->position() - region->last_position();
}
- if (what_changed & ARDOUR::LengthChanged) {
+ if (what_changed.contains (Properties::length)) {
delta += region->length() - region->last_length();
}
@@ -1442,7 +1442,7 @@ Playlist::region_bounds_changed (PropertyChange what_changed, boost::shared_ptr<
}
void
-Playlist::region_changed_proxy (PropertyChange what_changed, boost::weak_ptr<Region> weak_region)
+Playlist::region_changed_proxy (const PropertyChange& what_changed, boost::weak_ptr<Region> weak_region)
{
boost::shared_ptr<Region> region (weak_region.lock());
@@ -1456,26 +1456,38 @@ Playlist::region_changed_proxy (PropertyChange what_changed, boost::weak_ptr<Reg
}
bool
-Playlist::region_changed (PropertyChange what_changed, boost::shared_ptr<Region> region)
+Playlist::region_changed (const PropertyChange& what_changed, boost::shared_ptr<Region> region)
{
- PropertyChange our_interests = PropertyChange (Region::MuteChanged|Region::LayerChanged|Region::OpacityChanged);
+ PropertyChange our_interests;
+ PropertyChange bounds;
+ PropertyChange pos_and_length;
bool save = false;
if (in_set_state || in_flush) {
return false;
}
- if (what_changed & BoundsChanged) {
+ our_interests.add (Properties::muted);
+ our_interests.add (Properties::layer);
+ our_interests.add (Properties::opaque);
+
+ bounds.add (Properties::start);
+ bounds.add (Properties::position);
+ bounds.add (Properties::length);
+
+ pos_and_length.add (Properties::position);
+ pos_and_length.add (Properties::length);
+
+ if (what_changed.contains (bounds)) {
region_bounds_changed (what_changed, region);
save = !(_splicing || _nudging);
}
- if ((what_changed & our_interests) &&
- !(what_changed & PropertyChange (ARDOUR::PositionChanged|ARDOUR::LengthChanged))) {
+ if (what_changed.contains (our_interests) && !what_changed.contains (pos_and_length)) {
check_dependents (region, false);
}
- if (what_changed & PropertyChange (ARDOUR::PositionChanged)) {
+ if (what_changed.contains (Properties::position)) {
notify_region_moved (region);
}
@@ -1484,7 +1496,7 @@ Playlist::region_changed (PropertyChange what_changed, boost::shared_ptr<Region>
them, and we notify in ::relayer()
*/
- if (what_changed & our_interests) {
+ if (what_changed.contains (our_interests)) {
save = true;
}
@@ -1973,7 +1985,7 @@ Playlist::set_state (const XMLNode& node, int version)
error << _("region state node has no ID, ignored") << endmsg;
continue;
}
-
+
ID id = prop->value ();
if ((region = region_by_id (id))) {
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index 740a4abd5e..9cd8d49411 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -46,14 +46,6 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
-PropertyChange Region::FadeChanged = PBD::new_change ();
-PropertyChange Region::SyncOffsetChanged = PBD::new_change ();
-PropertyChange Region::MuteChanged = PBD::new_change ();
-PropertyChange Region::OpacityChanged = PBD::new_change ();
-PropertyChange Region::LockChanged = PBD::new_change ();
-PropertyChange Region::LayerChanged = PBD::new_change ();
-PropertyChange Region::HiddenChanged = PBD::new_change ();
-
namespace ARDOUR {
namespace Properties {
PBD::PropertyDescriptor<bool> muted;
@@ -80,7 +72,7 @@ namespace ARDOUR {
}
}
-PBD::Signal1<void,boost::shared_ptr<ARDOUR::Region> > Region::RegionPropertyChanged;
+PBD::Signal2<void,boost::shared_ptr<ARDOUR::Region>,const PropertyChange&> Region::RegionPropertyChanged;
void
Region::make_property_quarks ()
@@ -137,27 +129,27 @@ Region::register_properties ()
}
#define REGION_DEFAULT_STATE(s,l) \
- _muted (Properties::muted, MuteChanged, false) \
- , _opaque (Properties::opaque, OpacityChanged, true) \
- , _locked (Properties::locked, LockChanged, false) \
- , _automatic (Properties::automatic, PropertyChange (0), false) \
- , _whole_file (Properties::whole_file, PropertyChange (0), false) \
- , _import (Properties::import, PropertyChange (0), false) \
- , _external (Properties::external, PropertyChange (0), false) \
- , _sync_marked (Properties::sync_marked, SyncOffsetChanged, false) \
- , _left_of_split (Properties::left_of_split, PropertyChange (0), false) \
- , _right_of_split (Properties::right_of_split, PropertyChange (0), false) \
- , _hidden (Properties::hidden, HiddenChanged, false) \
- , _position_locked (Properties::position_locked, PropertyChange (0), false) \
- , _start (Properties::start, StartChanged, (s)) \
- , _length (Properties::length, LengthChanged, (l)) \
- , _position (Properties::position, PositionChanged, 0) \
- , _sync_position (Properties::sync_position, SyncOffsetChanged, (s)) \
- , _layer (Properties::layer, LayerChanged, 0) \
- , _ancestral_start (Properties::ancestral_start, PropertyChange (0), (s)) \
- , _ancestral_length (Properties::ancestral_length, PropertyChange (0), (l)) \
- , _stretch (Properties::stretch, PropertyChange (0), 1.0) \
- , _shift (Properties::shift, PropertyChange (0), 1.0)
+ _muted (Properties::muted, false) \
+ , _opaque (Properties::opaque, true) \
+ , _locked (Properties::locked, false) \
+ , _automatic (Properties::automatic, false) \
+ , _whole_file (Properties::whole_file, false) \
+ , _import (Properties::import, false) \
+ , _external (Properties::external, false) \
+ , _sync_marked (Properties::sync_marked, false) \
+ , _left_of_split (Properties::left_of_split, false) \
+ , _right_of_split (Properties::right_of_split, false) \
+ , _hidden (Properties::hidden, false) \
+ , _position_locked (Properties::position_locked, false) \
+ , _start (Properties::start, (s)) \
+ , _length (Properties::length, (l)) \
+ , _position (Properties::position, 0) \
+ , _sync_position (Properties::sync_position, (s)) \
+ , _layer (Properties::layer, 0) \
+ , _ancestral_start (Properties::ancestral_start, (s)) \
+ , _ancestral_length (Properties::ancestral_length, (l)) \
+ , _stretch (Properties::stretch, 1.0) \
+ , _shift (Properties::shift, 1.0)
#define REGION_COPY_STATE(other) \
_muted (other->_muted) \
@@ -194,7 +186,6 @@ Region::Region (Session& s, framepos_t start, framecnt_t length, const string& n
, _first_edit (EditChangesNothing)
, _frozen(0)
, _read_data_count(0)
- , _pending_changed(PropertyChange (0))
, _last_layer_op(0)
, _pending_explicit_relayer (false)
{
@@ -203,34 +194,6 @@ Region::Region (Session& s, framepos_t start, framecnt_t length, const string& n
/* no sources at this point */
}
-/** Basic Region constructor (single source) */
-Region::Region (boost::shared_ptr<Source> src)
- : SessionObject(src->session(), "toBeRenamed")
- , _type (src->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)
- , _pending_changed(PropertyChange (0))
- , _last_layer_op(0)
- , _pending_explicit_relayer (false)
-{
- register_properties ();
-
- _sources.push_back (src);
- _master_sources.push_back (src);
-
- src->DropReferences.connect_same_thread (*this, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(src)));
-
- assert (_sources.size() > 0);
- assert (_type == src->type());
-}
-
/** Basic Region constructor (many sources) */
Region::Region (const SourceList& srcs)
: SessionObject(srcs.front()->session(), "toBeRenamed")
@@ -244,7 +207,6 @@ Region::Region (const SourceList& srcs)
, _frozen (0)
, _valid_transients(false)
, _read_data_count(0)
- , _pending_changed(PropertyChange (0))
, _last_layer_op (0)
, _pending_explicit_relayer (false)
{
@@ -277,7 +239,6 @@ Region::Region (boost::shared_ptr<const Region> other, frameoffset_t offset, boo
, _frozen (0)
, _valid_transients(false)
, _read_data_count(0)
- , _pending_changed(PropertyChange (0))
, _last_layer_op (0)
, _pending_explicit_relayer (false)
@@ -387,7 +348,6 @@ Region::Region (boost::shared_ptr<const Region> other, const SourceList& srcs)
, _frozen (0)
, _valid_transients (false)
, _read_data_count (0)
- , _pending_changed (PropertyChange(0))
, _last_layer_op (other->_last_layer_op)
, _pending_explicit_relayer (false)
{
@@ -421,7 +381,6 @@ Region::Region (boost::shared_ptr<const Region> other)
, _frozen(0)
, _valid_transients(false)
, _read_data_count(0)
- , _pending_changed(PropertyChange(0))
, _last_layer_op(other->_last_layer_op)
, _pending_explicit_relayer (false)
{
@@ -442,74 +401,6 @@ Region::Region (boost::shared_ptr<const Region> other)
assert(_sources.size() > 0);
}
-Region::Region (const SourceList& srcs, const XMLNode& node)
- : SessionObject(srcs.front()->session(), X_("error: XML did not reset this"))
- , _type (srcs.front()->type())
- , 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)
- , _pending_changed(PropertyChange(0))
- , _last_layer_op(0)
- , _pending_explicit_relayer (false)
-{
- const XMLProperty* prop;
-
- register_properties ();
-
- if ((prop = node.property (X_("id")))) {
- _id = prop->value();
- }
-
- use_sources (srcs);
-
- if (set_state (node, Stateful::loading_state_version)) {
- throw failed_constructor();
- }
-
- assert(_type != DataType::NIL);
- assert(_sources.size() > 0);
- assert (_type == srcs.front()->type());
-
-}
-
-Region::Region (boost::shared_ptr<Source> src, const XMLNode& node)
- : SessionObject(src->session(), X_("error: XML did not reset this"))
- , _type (src->type())
- , REGION_DEFAULT_STATE(0,0)
- , _last_length (0)
- , _last_position (0)
- , _positional_lock_style (_type == DataType::AUDIO ? AudioTime : MusicTime)
- , _first_edit (EditChangesNothing)
- , _frozen (0)
- , _read_data_count (0)
- , _pending_changed (PropertyChange(0))
- , _last_layer_op (0)
- , _pending_explicit_relayer (false)
-{
- const XMLProperty *prop;
-
- register_properties ();
-
- _sources.push_back (src);
-
- if ((prop = node.property (X_("id")))) {
- _id = prop->value();
- }
-
- if (set_state (node, Stateful::loading_state_version)) {
- throw failed_constructor();
- }
-
- assert (_type != DataType::NIL);
- assert (_sources.size() > 0);
- assert (_type == src->type());
-}
-
Region::~Region ()
{
DEBUG_TRACE (DEBUG::Destruction, string_compose ("Region %1 destructor @ %2\n", _name, this));
@@ -527,7 +418,7 @@ Region::set_name (const std::string& str)
if (_name != str) {
SessionObject::set_name(str); // EMIT SIGNAL NameChanged()
assert(_name == str);
- send_change (ARDOUR::NameChanged);
+ send_change (Properties::name);
}
return true;
@@ -567,7 +458,7 @@ Region::set_length (framecnt_t len, void */*src*/)
recompute_at_end ();
}
- send_change (LengthChanged);
+ send_change (Properties::length);
}
}
@@ -587,7 +478,7 @@ Region::first_edit ()
_name = _session.new_region_name (_name);
_first_edit = EditChangesNothing;
- send_change (ARDOUR::NameChanged);
+ send_change (Properties::name);
RegionFactory::CheckNewRegion (shared_from_this());
}
}
@@ -709,7 +600,7 @@ Region::set_position_internal (framepos_t pos, bool allow_bbt_recompute)
a GUI that has moved its representation already.
*/
- send_change (PositionChanged);
+ send_change (Properties::position);
}
void
@@ -734,7 +625,7 @@ Region::set_position_on_top (framepos_t pos, void* /*src*/)
a GUI that has moved its representation already.
*/
- send_change (PositionChanged);
+ send_change (Properties::position);
}
void
@@ -772,7 +663,7 @@ Region::nudge_position (frameoffset_t n, void* /*src*/)
}
}
- send_change (PositionChanged);
+ send_change (Properties::position);
}
void
@@ -806,7 +697,7 @@ Region::set_start (framepos_t pos, void* /*src*/)
first_edit ();
invalidate_transients ();
- send_change (StartChanged);
+ send_change (Properties::start);
}
}
@@ -856,7 +747,7 @@ Region::trim_start (framepos_t new_position, void */*src*/)
_whole_file = false;
first_edit ();
- send_change (StartChanged);
+ send_change (Properties::start);
}
void
@@ -971,34 +862,39 @@ Region::trim_to_internal (framepos_t position, framecnt_t length, void */*src*/)
return;
}
- PropertyChange what_changed = PropertyChange (0);
+ PropertyChange what_changed;
if (_start != new_start) {
_start = new_start;
- what_changed = PropertyChange (what_changed|StartChanged);
+ what_changed.add (Properties::start);
}
if (_length != length) {
if (!_frozen) {
_last_length = _length;
}
_length = length;
- what_changed = PropertyChange (what_changed|LengthChanged);
+ what_changed.add (Properties::length);
}
if (_position != position) {
if (!_frozen) {
_last_position = _position;
}
_position = position;
- what_changed = PropertyChange (what_changed|PositionChanged);
+ what_changed.add (Properties::position);
}
_whole_file = false;
- if (what_changed & (StartChanged|LengthChanged)) {
+ PropertyChange start_and_length;
+
+ start_and_length.add (Properties::start);
+ start_and_length.add (Properties::length);
+
+ if (what_changed.contains (start_and_length)) {
first_edit ();
}
- if (what_changed) {
+ if (!what_changed.empty()) {
send_change (what_changed);
}
}
@@ -1008,7 +904,7 @@ Region::set_hidden (bool yn)
{
if (hidden() != yn) {
_hidden = yn;
- send_change (HiddenChanged);
+ send_change (Properties::hidden);
}
}
@@ -1031,7 +927,7 @@ Region::set_muted (bool yn)
{
if (muted() != yn) {
_muted = yn;
- send_change (MuteChanged);
+ send_change (Properties::muted);
}
}
@@ -1040,7 +936,7 @@ Region::set_opaque (bool yn)
{
if (opaque() != yn) {
_opaque = yn;
- send_change (OpacityChanged);
+ send_change (Properties::opaque);
}
}
@@ -1049,7 +945,7 @@ Region::set_locked (bool yn)
{
if (locked() != yn) {
_locked = yn;
- send_change (LockChanged);
+ send_change (Properties::locked);
}
}
@@ -1058,7 +954,7 @@ Region::set_position_locked (bool yn)
{
if (position_locked() != yn) {
_position_locked = yn;
- send_change (LockChanged);
+ send_change (Properties::locked);
}
}
@@ -1073,7 +969,7 @@ Region::set_sync_position (framepos_t absolute_pos)
if (!_frozen) {
maybe_uncopy ();
}
- send_change (SyncOffsetChanged);
+ send_change (Properties::sync_position);
}
}
@@ -1085,7 +981,7 @@ Region::clear_sync_position ()
if (!_frozen) {
maybe_uncopy ();
}
- send_change (SyncOffsetChanged);
+ send_change (Properties::sync_position);
}
}
@@ -1184,7 +1080,7 @@ Region::set_layer (layer_t l)
if (_layer != l) {
_layer = l;
- send_change (LayerChanged);
+ send_change (Properties::layer);
}
}
@@ -1239,7 +1135,7 @@ Region::get_state ()
int
Region::set_state (const XMLNode& node, int version)
{
- PropertyChange what_changed = PropertyChange (0);
+ PropertyChange what_changed;
return _set_state (node, version, what_changed, true);
}
@@ -1248,6 +1144,8 @@ Region::_set_state (const XMLNode& node, int version, PropertyChange& what_chang
{
const XMLProperty* prop;
+ cerr << "about to call ::set_properties for an XMLNode\n";
+
what_changed = set_properties (node);
if ((prop = node.property (X_("id")))) {
@@ -1300,7 +1198,11 @@ Region::_set_state (const XMLNode& node, int version, PropertyChange& what_chang
}
if (send) {
- cerr << _name << ": final change to be sent: " << hex << what_changed << dec << endl;
+ cerr << _name << ": final change to be sent: ";
+ for (PropertyChange::iterator i = what_changed.begin(); i != what_changed.end(); ++i) {
+ cerr << g_quark_to_string ((GQuark) *i) << ' ';
+ }
+ cerr << endl;
send_change (what_changed);
}
@@ -1318,7 +1220,7 @@ Region::freeze ()
void
Region::thaw ()
{
- PropertyChange what_changed = PropertyChange (0);
+ PropertyChange what_changed;
{
Glib::Mutex::Lock lm (_lock);
@@ -1327,18 +1229,18 @@ Region::thaw ()
return;
}
- if (_pending_changed) {
+ if (!_pending_changed.empty()) {
what_changed = _pending_changed;
- _pending_changed = PropertyChange (0);
+ _pending_changed.clear ();
}
}
- if (what_changed == PropertyChange (0)) {
+ if (what_changed.empty()) {
return;
}
- if (what_changed & LengthChanged) {
- if (what_changed & PositionChanged) {
+ if (what_changed.contains (Properties::length)) {
+ if (what_changed.contains (Properties::position)) {
recompute_at_start ();
}
recompute_at_end ();
@@ -1348,20 +1250,21 @@ Region::thaw ()
}
void
-Region::send_change (PropertyChange what_changed)
+Region::send_change (const PropertyChange& what_changed)
{
+ if (what_changed.empty()) {
+ return;
+ }
{
Glib::Mutex::Lock lm (_lock);
if (_frozen) {
- _pending_changed = PropertyChange (_pending_changed|what_changed);
+ _pending_changed.add (what_changed);
return;
}
}
- cerr << _name << " actually sends " << hex << what_changed << dec << " @" << get_microseconds() << endl;
- StateChanged (what_changed);
- cerr << _name << " done with " << hex << what_changed << dec << " @" << get_microseconds() << endl;
+ PropertyChanged (what_changed);
if (!_no_property_changes) {
@@ -1371,9 +1274,7 @@ Region::send_change (PropertyChange what_changed)
try {
boost::shared_ptr<Region> rptr = shared_from_this();
- cerr << _name << " actually sends prop change " << hex << what_changed << dec << " @ " << get_microseconds() << endl;
- RegionPropertyChanged (rptr);
- cerr << _name << " done with prop change @ " << get_microseconds() << endl;
+ RegionPropertyChanged (rptr, what_changed);
} catch (...) {
/* no shared_ptr available, relax; */
@@ -1612,11 +1513,9 @@ Region::use_sources (SourceList const & s)
}
-PropertyChange
+bool
Region::set_property (const PropertyBase& prop)
{
- PropertyChange c = PropertyChange (0);
-
DEBUG_TRACE (DEBUG::Properties, string_compose ("region %1 set property %2\n", _name.val(), prop.property_name()));
if (prop == Properties::muted.id) {
@@ -1625,7 +1524,7 @@ Region::set_property (const PropertyBase& prop)
DEBUG_TRACE (DEBUG::Properties, string_compose ("region %1 muted changed from %2 to %3",
_name.val(), _muted.val(), val));
_muted = val;
- c = MuteChanged;
+ return true;
}
} else if (prop == Properties::opaque.id) {
bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
@@ -1633,7 +1532,7 @@ Region::set_property (const PropertyBase& prop)
DEBUG_TRACE (DEBUG::Properties, string_compose ("region %1 opaque changed from %2 to %3",
_name.val(), _opaque.val(), val));
_opaque = val;
- c = OpacityChanged;
+ return true;
}
} else if (prop == Properties::locked.id) {
bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
@@ -1641,7 +1540,7 @@ Region::set_property (const PropertyBase& prop)
DEBUG_TRACE (DEBUG::Properties, string_compose ("region %1 locked changed from %2 to %3",
_name.val(), _locked.val(), val));
_locked = val;
- c = LockChanged;
+ return true;
}
} else if (prop == Properties::automatic.id) {
_automatic = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
@@ -1661,51 +1560,35 @@ Region::set_property (const PropertyBase& prop)
bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
if (val != _hidden) {
_hidden = val;
- c = HiddenChanged;
+ return true;
}
} else if (prop == Properties::position_locked.id) {
_position_locked = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
} else if (prop == Properties::start.id) {
_start = dynamic_cast<const PropertyTemplate<framepos_t>*>(&prop)->val();
} else if (prop == Properties::length.id) {
- const PropertyTemplate<framecnt_t>* pt1 = dynamic_cast<const PropertyTemplate<framecnt_t>* >(&prop);
- const PropertyTemplate<int>* pt2 = dynamic_cast<const PropertyTemplate<int>* >(&prop);
-
- cerr << "Cast to frmecnt = " << pt1 << " to int = " << pt2 << endl;
-
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(), val));
_length = val;
- c = LengthChanged;
- } else {
- DEBUG_TRACE (DEBUG::Properties, string_compose ("length %1 matches %2\n", _length.val(), val));
+ return true;
}
-
} else if (prop == Properties::position.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(), val));
_position = val;
- c = PositionChanged;
+ return true;
}
} else if (prop == Properties::sync_position.id) {
framepos_t val = dynamic_cast<const PropertyTemplate<framepos_t>*>(&prop)->val();
if (val != _sync_position) {
- DEBUG_TRACE (DEBUG::Properties, string_compose ("region %1 syncpos changed from %2 to %3",
- _name.val(), _sync_position, val));
_sync_position = val;
- c = SyncOffsetChanged;
+ return true;
}
} else if (prop == Properties::layer.id) {
layer_t val = dynamic_cast<const PropertyTemplate<layer_t>*>(&prop)->val();
if (val != _layer) {
- DEBUG_TRACE (DEBUG::Properties, string_compose ("region %1 syncpos changed from %2 to %3",
- _name.val(), _sync_position, val));
_layer = val;
- c = LayerChanged;
+ return true;
}
} else if (prop == Properties::ancestral_start.id) {
_ancestral_start = dynamic_cast<const PropertyTemplate<framepos_t>*>(&prop)->val();
@@ -1719,5 +1602,5 @@ Region::set_property (const PropertyBase& prop)
return SessionObject::set_property (prop);
}
- return c;
+ return false;
}
diff --git a/libs/ardour/region_factory.cc b/libs/ardour/region_factory.cc
index ae4df173e4..42a5629e4a 100644
--- a/libs/ardour/region_factory.cc
+++ b/libs/ardour/region_factory.cc
@@ -209,38 +209,9 @@ RegionFactory::create (boost::shared_ptr<Region> region, const SourceList& srcs,
boost::shared_ptr<Region>
RegionFactory::create (boost::shared_ptr<Source> src, const PropertyList& plist, bool announce)
{
- boost::shared_ptr<Region> ret;
- boost::shared_ptr<AudioSource> as;
- boost::shared_ptr<MidiSource> ms;
-
- if ((as = boost::dynamic_pointer_cast<AudioSource>(src)) != 0) {
-
- AudioRegion* ar = new AudioRegion (as);
- boost_debug_shared_ptr_mark_interesting (ar, "Region");
-
- boost::shared_ptr<AudioRegion> arp (ar);
- ret = boost::static_pointer_cast<Region> (arp);
-
- } else if ((ms = boost::dynamic_pointer_cast<MidiSource>(src)) != 0) {
- MidiRegion* mr = new MidiRegion (ms);
- boost_debug_shared_ptr_mark_interesting (mr, "Region");
-
- boost::shared_ptr<MidiRegion> mrp (mr);
- ret = boost::static_pointer_cast<Region> (mrp);
- }
-
- if (ret) {
- ret->set_properties (plist);
- ret->unlock_property_changes ();
-
- map_add (ret);
-
- if (announce) {
- CheckNewRegion (ret);
- }
- }
-
- return ret;
+ SourceList srcs;
+ srcs.push_back (src);
+ return create (srcs, plist, announce);
}
boost::shared_ptr<Region>
@@ -283,18 +254,9 @@ RegionFactory::create (const SourceList& srcs, const PropertyList& plist, bool a
boost::shared_ptr<Region>
RegionFactory::create (Session& session, XMLNode& node, bool yn)
{
- boost::shared_ptr<Region> r = session.XMLRegionFactory (node, yn);
-
- if (r) {
- r->unlock_property_changes ();
- map_add (r);
- CheckNewRegion (r);
- }
-
- return r;
+ return session.XMLRegionFactory (node, yn);
}
-
boost::shared_ptr<Region>
RegionFactory::create (SourceList& srcs, const XMLNode& node)
{
@@ -306,7 +268,7 @@ RegionFactory::create (SourceList& srcs, const XMLNode& node)
if (srcs[0]->type() == DataType::AUDIO) {
- AudioRegion* ar = new AudioRegion (srcs, node);
+ AudioRegion* ar = new AudioRegion (srcs);
boost_debug_shared_ptr_mark_interesting (ar, "Region");
boost::shared_ptr<AudioRegion> arp (ar);
@@ -314,16 +276,21 @@ RegionFactory::create (SourceList& srcs, const XMLNode& node)
} else if (srcs[0]->type() == DataType::MIDI) {
- MidiRegion* mr = new MidiRegion (srcs, node);
+ MidiRegion* mr = new MidiRegion (srcs);
boost::shared_ptr<MidiRegion> mrp (mr);
ret = boost::static_pointer_cast<Region> (mrp);
}
if (ret) {
- ret->unlock_property_changes ();
- map_add (ret);
- CheckNewRegion (ret);
+
+ if (ret->set_state (node, Stateful::loading_state_version)) {
+ ret.reset ();
+ } else {
+ ret->unlock_property_changes ();
+ map_add (ret);
+ CheckNewRegion (ret);
+ }
}
return ret;
diff --git a/libs/ardour/route_group.cc b/libs/ardour/route_group.cc
index 5b998d22f7..5e50c15457 100644
--- a/libs/ardour/route_group.cc
+++ b/libs/ardour/route_group.cc
@@ -40,9 +40,6 @@ using namespace ARDOUR;
using namespace PBD;
using namespace std;
-PropertyChange RouteGroup::FlagsChange = new_change ();
-PropertyChange RouteGroup::PropertiesChange = new_change ();
-
namespace ARDOUR {
namespace Properties {
PropertyDescriptor<bool> relative;
@@ -70,15 +67,15 @@ RouteGroup::make_property_quarks ()
Properties::edit.id = g_quark_from_static_string (X_("edit"));
}
-#define ROUTE_GROUP_DEFAULT_PROPERTIES _relative (Properties::relative, FlagsChange, false) \
- , _active (Properties::active, FlagsChange, false) \
- , _hidden (Properties::hidden, FlagsChange, false) \
- , _gain (Properties::gain, PropertiesChange, false) \
- , _mute (Properties::mute, PropertiesChange, false) \
- , _solo (Properties::solo, PropertiesChange , false) \
- , _recenable (Properties::recenable, PropertiesChange, false) \
- , _select (Properties::select, PropertiesChange, false) \
- , _edit (Properties::edit, PropertiesChange , false)
+#define ROUTE_GROUP_DEFAULT_PROPERTIES _relative (Properties::relative, false) \
+ , _active (Properties::active, false) \
+ , _hidden (Properties::hidden, false) \
+ , _gain (Properties::gain, false) \
+ , _mute (Properties::mute, false) \
+ , _solo (Properties::solo, false) \
+ , _recenable (Properties::recenable, false) \
+ , _select (Properties::select, false) \
+ , _edit (Properties::edit, false)
RouteGroup::RouteGroup (Session& s, const string &n)
: SessionObject (s, n)
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index e5b57115c1..decb2603fe 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -2810,7 +2810,7 @@ Session::add_regions (vector<boost::shared_ptr<Region> >& new_regions)
}
}
- region->StateChanged.connect_same_thread (*this, boost::bind (&Session::region_changed, this, _1, boost::weak_ptr<Region>(region)));
+ region->PropertyChanged.connect_same_thread (*this, boost::bind (&Session::region_changed, this, _1, boost::weak_ptr<Region>(region)));
update_region_name_map (region);
}
@@ -2840,7 +2840,7 @@ Session::update_region_name_map (boost::shared_ptr<Region> region)
}
void
-Session::region_changed (PropertyChange what_changed, boost::weak_ptr<Region> weak_region)
+Session::region_changed (const PropertyChange& what_changed, boost::weak_ptr<Region> weak_region)
{
boost::shared_ptr<Region> region (weak_region.lock ());
@@ -2848,12 +2848,12 @@ Session::region_changed (PropertyChange what_changed, boost::weak_ptr<Region> we
return;
}
- if (what_changed & Region::HiddenChanged) {
+ if (what_changed.contains (Properties::hidden)) {
/* relay hidden changes */
RegionHiddenChange (region);
}
- if (what_changed & NameChanged) {
+ if (what_changed.contains (Properties::name)) {
update_region_name_map (region);
}
}
@@ -3675,7 +3675,7 @@ Session::bundle_by_name (string name) const
}
void
-Session::tempo_map_changed (PropertyChange)
+Session::tempo_map_changed (const PropertyChange&)
{
clear_clicks ();
diff --git a/libs/ardour/session_object.cc b/libs/ardour/session_object.cc
index 0dcda09f26..b245b43ae5 100644
--- a/libs/ardour/session_object.cc
+++ b/libs/ardour/session_object.cc
@@ -37,27 +37,19 @@ SessionObject::make_property_quarks ()
Properties::name.id = g_quark_from_static_string (X_("name"));
}
-PropertyChange
+bool
SessionObject::set_property (const PropertyBase& prop)
{
- PropertyChange c = PropertyChange (0);
-
- DEBUG_TRACE (DEBUG::Properties, string_compose ("session object %1 set property %2\n", _name.val(), prop.property_name()));
-
if (prop == Properties::name.id) {
std::string str = dynamic_cast<const PropertyTemplate<std::string>*>(&prop)->val();
- cerr << "prop @ " << &prop << " has quark " << prop.id() << " str value = " << str << endl;
- cerr << "nameprop @ " << &_name << " has quark " << _name.id() << " str value = " << _name.val() << endl;
if (_name != str) {
DEBUG_TRACE (DEBUG::Properties, string_compose ("session object named %1 renamed %2\n",
_name.val(), str));
_name = str;
- c = _name.change();
- } else {
- DEBUG_TRACE (DEBUG::Properties, string_compose ("name %1 matches %2\n", _name.val(), str));
- }
+ return true;
+ }
}
-
- return c;
+
+ return false;
}
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index face9388bc..434410b39e 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -165,7 +165,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
_base_frame_rate = _current_frame_rate;
_tempo_map = new TempoMap (_current_frame_rate);
- _tempo_map->StateChanged.connect_same_thread (*this, boost::bind (&Session::tempo_map_changed, this, _1));
+ _tempo_map->PropertyChanged.connect_same_thread (*this, boost::bind (&Session::tempo_map_changed, this, _1));
_non_soloed_outs_muted = false;
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc
index be34b79ccc..93470e369b 100644
--- a/libs/ardour/tempo.cc
+++ b/libs/ardour/tempo.cc
@@ -299,7 +299,7 @@ void
TempoMap::move_tempo (TempoSection& tempo, const BBT_Time& when)
{
if (move_metric_section (tempo, when) == 0) {
- StateChanged (PropertyChange (0));
+ PropertyChanged (PropertyChange ());
}
}
@@ -307,7 +307,7 @@ void
TempoMap::move_meter (MeterSection& meter, const BBT_Time& when)
{
if (move_metric_section (meter, when) == 0) {
- StateChanged (PropertyChange (0));
+ PropertyChanged (PropertyChange ());
}
}
@@ -334,7 +334,7 @@ TempoMap::remove_tempo (const TempoSection& tempo)
}
if (removed) {
- StateChanged (PropertyChange (0));
+ PropertyChanged (PropertyChange ());
}
}
@@ -361,7 +361,7 @@ TempoMap::remove_meter (const MeterSection& tempo)
}
if (removed) {
- StateChanged (PropertyChange (0));
+ PropertyChanged (PropertyChange ());
}
}
@@ -406,7 +406,7 @@ TempoMap::add_tempo (const Tempo& tempo, BBT_Time where)
do_insert (new TempoSection (where, tempo.beats_per_minute(), tempo.note_type()), true);
}
- StateChanged (PropertyChange (0));
+ PropertyChanged (PropertyChange ());
}
void
@@ -417,7 +417,7 @@ TempoMap::add_tempo (const Tempo& tempo, nframes64_t where)
do_insert (new TempoSection (where, tempo.beats_per_minute(), tempo.note_type()), false);
}
- StateChanged (PropertyChange (0));
+ PropertyChanged (PropertyChange ());
}
void
@@ -445,7 +445,7 @@ TempoMap::replace_tempo (TempoSection& existing, const Tempo& replacement)
}
if (replaced) {
- StateChanged (PropertyChange (0));
+ PropertyChanged (PropertyChange ());
}
}
@@ -474,7 +474,7 @@ TempoMap::add_meter (const Meter& meter, BBT_Time where)
do_insert (new MeterSection (where, meter.beats_per_bar(), meter.note_divisor()), true);
}
- StateChanged (PropertyChange (0));
+ PropertyChanged (PropertyChange ());
}
void
@@ -485,7 +485,7 @@ TempoMap::add_meter (const Meter& meter, nframes64_t where)
do_insert (new MeterSection (where, meter.beats_per_bar(), meter.note_divisor()), false);
}
- StateChanged (PropertyChange (0));
+ PropertyChanged (PropertyChange ());
}
void
@@ -511,7 +511,7 @@ TempoMap::replace_meter (MeterSection& existing, const Meter& replacement)
}
if (replaced) {
- StateChanged (PropertyChange (0));
+ PropertyChanged (PropertyChange ());
}
}
@@ -524,7 +524,7 @@ TempoMap::change_initial_tempo (double beats_per_minute, double note_type)
for (Metrics::iterator i = metrics->begin(); i != metrics->end(); ++i) {
if ((t = dynamic_cast<TempoSection*> (*i)) != 0) {
*((Tempo*) t) = newtempo;
- StateChanged (PropertyChange (0));
+ PropertyChanged (PropertyChange ());
break;
}
}
@@ -570,7 +570,7 @@ TempoMap::change_existing_tempo_at (nframes64_t where, double beats_per_minute,
/* reset */
*((Tempo*)prev) = newtempo;
- StateChanged (PropertyChange (0));
+ PropertyChanged (PropertyChange ());
}
const MeterSection&
@@ -1609,7 +1609,7 @@ TempoMap::set_state (const XMLNode& node, int /*version*/)
}
}
- StateChanged (PropertyChange (0));
+ PropertyChanged (PropertyChange ());
return 0;
}
@@ -1673,7 +1673,7 @@ TempoMap::insert_time (nframes64_t where, nframes64_t amount)
timestamp_metrics (false);
- StateChanged (PropertyChange (0));
+ PropertyChanged (PropertyChange ());
}
BBT_Time