initial implementation of a VCA Manager object
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 26 Jan 2016 03:15:07 +0000 (22:15 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 31 May 2016 19:30:38 +0000 (15:30 -0400)
libs/ardour/ardour/vca_manager.h [new file with mode: 0644]
libs/ardour/vca_manager.cc [new file with mode: 0644]
libs/ardour/wscript

diff --git a/libs/ardour/ardour/vca_manager.h b/libs/ardour/ardour/vca_manager.h
new file mode 100644 (file)
index 0000000..14a0440
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+  Copyright (C) 2016 Paul Davis
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __libardour_vca_manager_h__
+#define __libardour_vca_manager_h__
+
+#include <string>
+#include <list>
+
+#include <boost/shared_ptr.hpp>
+
+#include <glibmm/threads.h>
+
+#include "pbd/signals.h"
+
+#include "ardour/session_handle.h"
+
+namespace ARDOUR {
+
+class VCA;
+
+class VCAManager : public SessionHandleRef
+{
+     public:
+       VCAManager (ARDOUR::Session&);
+       ~VCAManager ();
+
+       boost::shared_ptr<VCA> create_vca (std::string const & name = std::string());
+       void remove_vca (boost::shared_ptr<VCA>);
+
+       typedef std::list<boost::shared_ptr<VCA> > VCAS;
+       VCAS vcas() const;
+
+       PBD::Signal1<void,boost::shared_ptr<VCA> > VCAAdded;
+       PBD::Signal1<void,boost::shared_ptr<VCA> > VCARemoved;
+
+     private:
+       mutable Glib::Threads::Mutex lock;
+       VCAS _vcas;
+
+};
+
+} // namespace
+
+#endif /* __libardour_vca_manager_h__ */
diff --git a/libs/ardour/vca_manager.cc b/libs/ardour/vca_manager.cc
new file mode 100644 (file)
index 0000000..2350f4d
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+  Copyright (C) 2016 Paul Davis
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "ardour/vca.h"
+#include "ardour/vca_manager.h"
+
+using namespace ARDOUR;
+using namespace Glib::Threads;
+using std::string;
+
+
+VCAManager::VCAManager (Session& s)
+       : SessionHandleRef (s)
+{
+}
+
+VCAManager::~VCAManager ()
+{
+}
+
+VCAManager::VCAS
+VCAManager::vcas () const
+{
+       Mutex::Lock lm (lock);
+       return _vcas;
+}
+
+boost::shared_ptr<VCA>
+VCAManager::create_vca (std::string const & name)
+{
+       boost::shared_ptr<VCA> vca = boost::shared_ptr<VCA> (new VCA (_session, name));
+       {
+               Mutex::Lock lm (lock);
+               _vcas.push_back (vca);
+       }
+
+       VCAAdded (vca); /* EMIT SIGNAL */
+       return vca;
+
+}
+
+
+void
+VCAManager::remove_vca (boost::shared_ptr<VCA> vca)
+{
+       {
+               Mutex::Lock lm (lock);
+               _vcas.remove (vca);
+       }
+
+       VCARemoved (vca); /* EMIT SIGNAL */
+}
+
index a5ef2da595ae8c8b4053f8b13541c34d78d77d48..625bac8742eacb9d238f795106e3886c1b161c96 100644 (file)
@@ -232,6 +232,7 @@ libardour_sources = [
         'user_bundle.cc',
         'utils.cc',
         'vca.cc',
+        'vca_manager.cc',
         'vumeterdsp.cc',
         'worker.cc'
 ]