summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-03-02 00:00:00 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-03-02 00:00:00 +0000
commitdb8b575c30845bafc34b87bacd52129c95d1c478 (patch)
tree7a521b7795cc6cc4e41d717a0feabd1aefb83e1f /libs/ardour/ardour
parent3540594dc53137eb9e857f9e3c1309382a6d7bef (diff)
the mega-properties/SequenceProperty patch. split is broken at present (right hand starts has start-in-source of zero)
git-svn-id: svn://localhost/ardour2/branches/3.0@6718 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r--libs/ardour/ardour/debug.h59
-rw-r--r--libs/ardour/ardour/playlist.h46
-rw-r--r--libs/ardour/ardour/region.h2
-rw-r--r--libs/ardour/ardour/region_factory.h7
-rw-r--r--libs/ardour/ardour/session.h5
-rw-r--r--libs/ardour/ardour/session_object.h1
-rw-r--r--libs/ardour/ardour/session_playlists.h5
7 files changed, 77 insertions, 48 deletions
diff --git a/libs/ardour/ardour/debug.h b/libs/ardour/ardour/debug.h
index b7ee4c328c..5b4405b7d8 100644
--- a/libs/ardour/ardour/debug.h
+++ b/libs/ardour/ardour/debug.h
@@ -24,51 +24,28 @@
#include <sstream>
-namespace ARDOUR {
-
- extern uint64_t debug_bits;
- void debug_print (const char* prefix, std::string str);
- void set_debug_bits (uint64_t bits);
- int parse_debug_options (const char* str);
- void list_debug_options ();
+#include "pbd/debug.h"
+namespace PBD {
namespace DEBUG {
-
- /* this namespace is so that we can write DEBUG::bit_name */
-
- enum DebugBits {
- MidiSourceIO = 0x1,
- MidiPlaylistIO = 0x2,
- MidiDiskstreamIO = 0x4,
- SnapBBT = 0x8,
- Configuration = 0x10,
- Latency = 0x20,
- Processors = 0x40,
- Graph = 0x80,
- Destruction = 0x100,
- MTC = 0x200,
- Transport = 0x400,
- Slave = 0x800,
- SessionEvents = 0x800,
- MidiIO = 0x1000,
- MackieControl = 0x2000,
- MidiClock = 0x4000,
- Properties = 0x8000
- };
+ extern uint64_t MidiSourceIO;
+ extern uint64_t MidiPlaylistIO;
+ extern uint64_t MidiDiskstreamIO;
+ extern uint64_t SnapBBT;
+ extern uint64_t Configuration;
+ extern uint64_t Latency;
+ extern uint64_t Processors;
+ extern uint64_t Graph;
+ extern uint64_t Destruction;
+ extern uint64_t MTC;
+ extern uint64_t Transport;
+ extern uint64_t Slave;
+ extern uint64_t SessionEvents;
+ extern uint64_t MidiIO;
+ extern uint64_t MackieControl;
+ extern uint64_t MidiClock;
}
-
}
-#ifndef NDEBUG
-#define DEBUG_TRACE(bits,str) if ((bits) & ARDOUR::debug_bits) { ARDOUR::debug_print (# bits, str); }
-#define DEBUG_STR_DECL(id) std::stringstream __debug_str ## id;
-#define DEBUG_STR(id) __debug_str ## id
-#define DEBUG_STR_APPEND(id,s) __debug_str ## id << s;
-#else
-#define DEBUG_TRACE(bits,fmt,...) /*empty*/
-#define DEBUG_STR(a) /* empty */
-#define DEBUG_STR_APPEND(a,b) /* empty */
-#endif
-
#endif /* __ardour_debug_h__ */
diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h
index 38469f4723..3c79ec0ec4 100644
--- a/libs/ardour/ardour/playlist.h
+++ b/libs/ardour/ardour/playlist.h
@@ -36,6 +36,7 @@
#include "pbd/undo.h"
#include "pbd/stateful.h"
#include "pbd/statefuldestructible.h"
+#include "pbd/sequence_property.h"
#include "evoral/types.hpp"
@@ -49,11 +50,43 @@ namespace ARDOUR {
class Session;
class Region;
+class Playlist;
+
+namespace Properties {
+ /* fake the type, since regions are handled by SequenceProperty which doesn't
+ care about such things.
+ */
+ extern PBD::PropertyDescriptor<bool> regions;
+}
+
+class RegionListProperty : public PBD::SequenceProperty<std::list<boost::shared_ptr<Region > > >
+{
+ public:
+ RegionListProperty (Playlist&);
+
+ boost::shared_ptr<Region> lookup_id (const PBD::ID& id);
+ void diff (PBD::PropertyList& before, PBD::PropertyList& after) const;
+
+ private:
+ friend class Playlist;
+ std::list<boost::shared_ptr<Region> > rlist() { return _val; }
+
+ /* we live and die with our playlist, no lifetime management needed */
+ Playlist& _playlist;
+
+ /* create a copy of this RegionListProperty that only
+ has what is needed for use in a history list command. This
+ means that it won't contain the actual region list but
+ will have the added/removed list.
+ */
+ RegionListProperty* copy_for_history () const;
+};
class Playlist : public SessionObject
, public boost::enable_shared_from_this<Playlist> {
public:
typedef std::list<boost::shared_ptr<Region> > RegionList;
+ static void make_property_quarks ();
Playlist (Session&, const XMLNode&, DataType type, bool hidden = false);
Playlist (Session&, std::string name, DataType type, bool hidden = false);
@@ -62,6 +95,13 @@ class Playlist : public SessionObject
virtual ~Playlist ();
+ bool set_property (const PBD::PropertyBase&);
+ void update (const RegionListProperty::ChangeRecord&);
+
+ PBD::PropertyList* property_factory (const XMLNode&) const;
+
+ boost::shared_ptr<Region> region_by_id (const PBD::ID&);
+
void set_region_ownership ();
virtual void clear (bool with_signals=true);
@@ -107,7 +147,7 @@ class Playlist : public SessionObject
boost::shared_ptr<Playlist> copy (std::list<AudioRange>&, bool result_is_hidden = true);
int paste (boost::shared_ptr<Playlist>, framepos_t position, float times);
- const RegionList& region_list () const { return regions; }
+ const RegionListProperty& region_list () const { return regions; }
RegionList* regions_at (framepos_t frame);
RegionList* regions_touched (framepos_t start, framepos_t end);
@@ -192,7 +232,7 @@ class Playlist : public SessionObject
friend class RegionLock;
- RegionList regions; /* the current list of regions in the playlist */
+ RegionListProperty regions; /* the current list of regions in the playlist */
std::set<boost::shared_ptr<Region> > all_regions; /* all regions ever added to this playlist */
PBD::ScopedConnectionList region_state_changed_connections;
DataType _type;
@@ -277,8 +317,6 @@ class Playlist : public SessionObject
virtual XMLNode& state (bool);
- boost::shared_ptr<Region> region_by_id (PBD::ID);
-
bool add_region_internal (boost::shared_ptr<Region>, framepos_t position);
int remove_region_internal (boost::shared_ptr<Region>);
diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h
index fb827e308d..1da185c6f2 100644
--- a/libs/ardour/ardour/region.h
+++ b/libs/ardour/ardour/region.h
@@ -91,6 +91,8 @@ class Region
static PBD::Signal2<void,boost::shared_ptr<ARDOUR::Region>, const PBD::PropertyChange&> RegionPropertyChanged;
+ PBD::PropertyList* property_factory (const XMLNode&) const;
+
void unlock_property_changes () { _no_property_changes = false; }
void block_property_changes () { _no_property_changes = true; }
diff --git a/libs/ardour/ardour/region_factory.h b/libs/ardour/ardour/region_factory.h
index 16e48828d4..a01103603a 100644
--- a/libs/ardour/ardour/region_factory.h
+++ b/libs/ardour/ardour/region_factory.h
@@ -21,6 +21,7 @@
#define __ardour_region_factory_h__
#include <map>
+#include <glibmm/thread.h>
#include "pbd/id.h"
@@ -37,8 +38,10 @@ class AudioRegion;
class RegionFactory {
public:
+ typedef std::map<PBD::ID,boost::shared_ptr<Region> > RegionMap;
static boost::shared_ptr<Region> region_by_id (const PBD::ID&);
+ static const RegionMap all_regions() { return region_map; }
static void clear_map ();
/** This is emitted only when a new id is assigned. Therefore,
@@ -75,8 +78,10 @@ class RegionFactory {
static boost::shared_ptr<Region> create (SourceList& srcs, const XMLNode&);
private:
- static std::map<PBD::ID,boost::weak_ptr<Region> > region_map;
+ static Glib::StaticMutex region_map_lock;
+ static RegionMap region_map;
static void map_add (boost::shared_ptr<Region>);
+ static void map_remove (boost::shared_ptr<Region>);
};
}
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index edeeeb11ef..d26c84a795 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -501,6 +501,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
/* region info */
+ boost::shared_ptr<Region> region_by_id (const PBD::ID&) const;
+ boost::shared_ptr<Region> find_whole_file_parent (boost::shared_ptr<Region const>) const;
+
void add_regions (std::vector<boost::shared_ptr<Region> >&);
PBD::Signal1<void,boost::weak_ptr<Region> > RegionAdded;
@@ -511,8 +514,6 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
std::string new_region_name (std::string);
std::string path_from_region_name (DataType type, std::string name, std::string identifier);
- boost::shared_ptr<Region> find_whole_file_parent (boost::shared_ptr<Region const>);
-
boost::shared_ptr<Region> XMLRegionFactory (const XMLNode&, bool full);
boost::shared_ptr<AudioRegion> XMLAudioRegionFactory (const XMLNode&, bool full);
boost::shared_ptr<MidiRegion> XMLMidiRegionFactory (const XMLNode&, bool full);
diff --git a/libs/ardour/ardour/session_object.h b/libs/ardour/ardour/session_object.h
index d18a1f9d41..3e401a66ce 100644
--- a/libs/ardour/ardour/session_object.h
+++ b/libs/ardour/ardour/session_object.h
@@ -23,6 +23,7 @@
#include <string>
#include "pbd/statefuldestructible.h"
#include "pbd/signals.h"
+#include "pbd/properties.h"
#include "ardour/ardour.h"
#include "ardour/session_handle.h"
diff --git a/libs/ardour/ardour/session_playlists.h b/libs/ardour/ardour/session_playlists.h
index db29ee8c05..d654595d60 100644
--- a/libs/ardour/ardour/session_playlists.h
+++ b/libs/ardour/ardour/session_playlists.h
@@ -31,6 +31,10 @@
class XMLNode;
+namespace PBD {
+ class ID;
+}
+
namespace ARDOUR {
class Playlist;
@@ -44,6 +48,7 @@ public:
~SessionPlaylists ();
boost::shared_ptr<Playlist> by_name (std::string name);
+ boost::shared_ptr<Playlist> by_id (const PBD::ID&);
uint32_t source_use_count (boost::shared_ptr<const Source> src) const;
template<class T> void foreach (T *obj, void (T::*func)(boost::shared_ptr<Playlist>));
void get (std::vector<boost::shared_ptr<Playlist> >&);