diff --git a/libs/ardour/ardour/vca_manager.h b/libs/ardour/ardour/vca_manager.h new file mode 100644 index 0000000000..14a044070a --- /dev/null +++ b/libs/ardour/ardour/vca_manager.h @@ -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 +#include + +#include + +#include + +#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 create_vca (std::string const & name = std::string()); + void remove_vca (boost::shared_ptr); + + typedef std::list > VCAS; + VCAS vcas() const; + + PBD::Signal1 > VCAAdded; + PBD::Signal1 > 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 index 0000000000..2350f4df61 --- /dev/null +++ b/libs/ardour/vca_manager.cc @@ -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 +VCAManager::create_vca (std::string const & name) +{ + boost::shared_ptr vca = boost::shared_ptr (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) +{ + { + Mutex::Lock lm (lock); + _vcas.remove (vca); + } + + VCARemoved (vca); /* EMIT SIGNAL */ +} + diff --git a/libs/ardour/wscript b/libs/ardour/wscript index a5ef2da595..625bac8742 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -232,6 +232,7 @@ libardour_sources = [ 'user_bundle.cc', 'utils.cc', 'vca.cc', + 'vca_manager.cc', 'vumeterdsp.cc', 'worker.cc' ]