summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/utils.h
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-04-08 16:49:47 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-05-31 15:30:40 -0400
commit653ae4acd639fef149314fe6f8c7a0d862afae40 (patch)
treeba32ff0efd9b105c207ad7e3b2e89d73e76b4355 /libs/ardour/ardour/utils.h
parentc107f1ab56270f4485ca2a787d575c2b5b53cfcf (diff)
universal change in the design of the way Route/Track controls are designed and used. The controls now own their own state, rather than proxy for state in their owners.
Massive changes all over the code to accomodate this. Many things are not finished. Consider this a backup safety commit
Diffstat (limited to 'libs/ardour/ardour/utils.h')
-rw-r--r--libs/ardour/ardour/utils.h33
1 files changed, 31 insertions, 2 deletions
diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h
index f3767d471a..1dc7c2baf4 100644
--- a/libs/ardour/ardour/utils.h
+++ b/libs/ardour/ardour/utils.h
@@ -28,19 +28,26 @@
#include <string>
#include <cmath>
+#include "boost/shared_ptr.hpp"
+
#if __APPLE__
#include <CoreFoundation/CoreFoundation.h>
#endif /* __APPLE__ */
-#include "ardour/libardour_visibility.h"
#include "ardour/ardour.h"
#include "ardour/data_type.h"
#include "ardour/dB.h"
+#include "ardour/types.h"
+
+#include "ardour/libardour_visibility.h"
class XMLNode;
namespace ARDOUR {
+class Route;
+class Track;
+
LIBARDOUR_API std::string legalize_for_path (const std::string& str);
LIBARDOUR_API std::string legalize_for_universal_path (const std::string& str);
LIBARDOUR_API std::string legalize_for_uri (const std::string& str);
@@ -169,6 +176,29 @@ LIBARDOUR_API bool matching_unsuffixed_filename_exists_in (const std::string& di
LIBARDOUR_API uint32_t how_many_dsp_threads ();
+template<typename T> boost::shared_ptr<ControlList> route_list_to_control_list (boost::shared_ptr<RouteList> rl, boost::shared_ptr<T> (Route::*get_control)() const) {
+ boost::shared_ptr<ControlList> cl (new ControlList);
+ for (RouteList::const_iterator r = rl->begin(); r != rl->end(); ++r) {
+ boost::shared_ptr<AutomationControl> ac = ((*r).get()->*get_control)();
+ if (ac) {
+ cl->push_back (ac);
+ }
+ }
+ return cl;
+}
+
+template<typename T> boost::shared_ptr<ControlList> route_list_to_control_list (boost::shared_ptr<RouteList> rl, boost::shared_ptr<T> (Track::*get_control)() const) {
+ boost::shared_ptr<ControlList> cl (new ControlList);
+ for (RouteList::const_iterator r = rl->begin(); r != rl->end(); ++r) {
+ boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track> (*r);
+ boost::shared_ptr<AutomationControl> ac = (t.get()->*get_control)();
+ if (ac) {
+ cl->push_back (ac);
+ }
+ }
+ return cl;
+}
+
#if __APPLE__
LIBARDOUR_API std::string CFStringRefToStdString(CFStringRef stringRef);
#endif // __APPLE__
@@ -176,4 +206,3 @@ LIBARDOUR_API std::string CFStringRefToStdString(CFStringRef stringRef);
} //namespave
#endif /* __ardour_utils_h__ */
-