summaryrefslogtreecommitdiff
path: root/libs/ardour/vca_manager.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-02-29 14:44:25 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2016-05-31 15:30:38 -0400
commitf44cac5cc60c0ad93da3a44db2517f09cc82f345 (patch)
tree1035815b0f93b2ae39fef15402f9a9e4ea87fb1e /libs/ardour/vca_manager.cc
parent089549acb67e9f11039853eb5af48b00d206b7a5 (diff)
expand and improve VCA API
Diffstat (limited to 'libs/ardour/vca_manager.cc')
-rw-r--r--libs/ardour/vca_manager.cc45
1 files changed, 37 insertions, 8 deletions
diff --git a/libs/ardour/vca_manager.cc b/libs/ardour/vca_manager.cc
index c5164982c3..476cd02bda 100644
--- a/libs/ardour/vca_manager.cc
+++ b/libs/ardour/vca_manager.cc
@@ -17,6 +17,9 @@
*/
+#include "pbd/convert.h"
+#include "pbd/replace_all.h"
+
#include "ardour/vca.h"
#include "ardour/vca_manager.h"
@@ -41,21 +44,34 @@ VCAManager::vcas () const
return _vcas;
}
-boost::shared_ptr<VCA>
-VCAManager::create_vca (std::string const & name)
+int
+VCAManager::create_vca (uint32_t howmany, std::string const & name_template)
{
- boost::shared_ptr<VCA> vca = boost::shared_ptr<VCA> (new VCA (_session, name));
+ VCAList vcal;
+
{
Mutex::Lock lm (lock);
- _vcas.push_back (vca);
- }
- VCAList vcal;
- vcal.push_back (vca);
+ for (uint32_t n = 0; n < howmany; ++n) {
+
+ int num = VCA::next_vca_number ();
+ string name = name_template;
+
+ if (name.find ("%n")) {
+ string sn = PBD::to_string (n, std::dec);
+ replace_all (name, "%n", sn);
+ }
+
+ boost::shared_ptr<VCA> vca = boost::shared_ptr<VCA> (new VCA (_session, name, num));
+
+ _vcas.push_back (vca);
+ vcal.push_back (vca);
+ }
+ }
VCAAdded (vcal); /* EMIT SIGNAL */
- return vca;
+ return 0;
}
@@ -73,3 +89,16 @@ VCAManager::remove_vca (boost::shared_ptr<VCA> vca)
VCARemoved (vcal); /* EMIT SIGNAL */
}
+boost::shared_ptr<VCA>
+VCAManager::vca_by_number (uint32_t n) const
+{
+ Mutex::Lock lm (lock);
+
+ for (VCAS::const_iterator i = _vcas.begin(); i != _vcas.end(); ++i) {
+ if ((*i)->number() == n) {
+ return *i;
+ }
+ }
+
+ return boost::shared_ptr<VCA>();
+}