initial implementation of a VCA Manager object

This commit is contained in:
Paul Davis 2016-01-25 22:15:07 -05:00
parent c5ba2d1eb6
commit ab9bb49f39
3 changed files with 131 additions and 0 deletions

View File

@ -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__ */

View File

@ -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 */
}

View File

@ -232,6 +232,7 @@ libardour_sources = [
'user_bundle.cc',
'utils.cc',
'vca.cc',
'vca_manager.cc',
'vumeterdsp.cc',
'worker.cc'
]