2008-09-18 20:47:49 -04:00
|
|
|
/* This file is part of Evoral.
|
2011-04-06 11:00:16 -04:00
|
|
|
* Copyright (C) 2008 David Robillard <http://drobilla.net>
|
2008-09-18 20:47:49 -04:00
|
|
|
* Copyright (C) 2000-2008 Paul Davis
|
2009-10-14 12:10:01 -04:00
|
|
|
*
|
2008-09-18 20:47:49 -04:00
|
|
|
* Evoral 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.
|
2009-10-14 12:10:01 -04:00
|
|
|
*
|
2008-09-18 20:47:49 -04:00
|
|
|
* Evoral 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 details.
|
2009-10-14 12:10:01 -04:00
|
|
|
*
|
2008-09-18 20:47:49 -04:00
|
|
|
* 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.,
|
|
|
|
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2010-07-13 20:58:15 -04:00
|
|
|
#include <iostream>
|
2008-09-18 20:47:49 -04:00
|
|
|
#include <limits>
|
2008-12-21 15:36:15 -05:00
|
|
|
#include "evoral/ControlSet.hpp"
|
|
|
|
#include "evoral/ControlList.hpp"
|
|
|
|
#include "evoral/Control.hpp"
|
|
|
|
#include "evoral/Event.hpp"
|
2008-09-18 20:47:49 -04:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
namespace Evoral {
|
|
|
|
|
2008-09-21 12:17:02 -04:00
|
|
|
|
2008-09-18 20:47:49 -04:00
|
|
|
ControlSet::ControlSet()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-09-30 13:55:14 -04:00
|
|
|
ControlSet::ControlSet (const ControlSet&)
|
2011-11-22 19:17:31 -05:00
|
|
|
: noncopyable ()
|
2010-05-18 23:03:28 -04:00
|
|
|
{
|
2011-11-22 19:17:31 -05:00
|
|
|
/* derived class must copy controls */
|
2010-05-18 23:03:28 -04:00
|
|
|
}
|
|
|
|
|
2008-09-18 20:47:49 -04:00
|
|
|
void
|
|
|
|
ControlSet::add_control(boost::shared_ptr<Control> ac)
|
|
|
|
{
|
|
|
|
_controls[ac->parameter()] = ac;
|
2010-07-11 20:41:45 -04:00
|
|
|
|
|
|
|
ac->ListMarkedDirty.connect_same_thread (_control_connections, boost::bind (&ControlSet::control_list_marked_dirty, this));
|
2010-07-13 20:58:15 -04:00
|
|
|
|
|
|
|
ac->list()->InterpolationChanged.connect_same_thread (
|
|
|
|
_list_connections, boost::bind (&ControlSet::control_list_interpolation_changed, this, ac->parameter(), _1)
|
2011-11-22 19:17:31 -05:00
|
|
|
);
|
2008-09-18 20:47:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ControlSet::what_has_data (set<Parameter>& s) const
|
|
|
|
{
|
|
|
|
Glib::Mutex::Lock lm (_control_lock);
|
2011-06-11 11:35:34 -04:00
|
|
|
|
2008-09-21 12:17:02 -04:00
|
|
|
for (Controls::const_iterator li = _controls.begin(); li != _controls.end(); ++li) {
|
2011-06-11 11:35:34 -04:00
|
|
|
if (li->second->list() && !li->second->list()->empty()) {
|
|
|
|
s.insert (li->first);
|
|
|
|
}
|
2008-09-18 20:47:49 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-21 12:17:02 -04:00
|
|
|
/** If a control for the given parameter does not exist and \a create_if_missing is true,
|
|
|
|
* a control will be created, added to this set, and returned.
|
|
|
|
* If \a create_if_missing is false this function may return null.
|
2008-09-18 20:47:49 -04:00
|
|
|
*/
|
|
|
|
boost::shared_ptr<Control>
|
2008-09-19 02:30:49 -04:00
|
|
|
ControlSet::control (const Parameter& parameter, bool create_if_missing)
|
2008-09-18 20:47:49 -04:00
|
|
|
{
|
|
|
|
Controls::iterator i = _controls.find(parameter);
|
|
|
|
|
|
|
|
if (i != _controls.end()) {
|
|
|
|
return i->second;
|
|
|
|
|
|
|
|
} else if (create_if_missing) {
|
2008-09-21 12:17:02 -04:00
|
|
|
boost::shared_ptr<Control> ac(control_factory(parameter));
|
2008-09-18 20:47:49 -04:00
|
|
|
add_control(ac);
|
|
|
|
return ac;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
return boost::shared_ptr<Control>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2010-07-27 10:09:16 -04:00
|
|
|
ControlSet::find_next_event (double now, double end, ControlEvent& next_event) const
|
2008-09-18 20:47:49 -04:00
|
|
|
{
|
2009-10-14 12:10:01 -04:00
|
|
|
Controls::const_iterator li;
|
2008-09-18 20:47:49 -04:00
|
|
|
|
2010-07-27 10:09:16 -04:00
|
|
|
next_event.when = std::numeric_limits<double>::max();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-11-22 19:17:31 -05:00
|
|
|
for (li = _controls.begin(); li != _controls.end(); ++li) {
|
2008-09-18 20:47:49 -04:00
|
|
|
ControlList::const_iterator i;
|
|
|
|
boost::shared_ptr<const ControlList> alist (li->second->list());
|
|
|
|
ControlEvent cp (now, 0.0f);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-11-22 19:17:31 -05:00
|
|
|
for (i = lower_bound (alist->begin(), alist->end(), &cp, ControlList::time_comparator);
|
|
|
|
i != alist->end() && (*i)->when < end; ++i) {
|
|
|
|
if ((*i)->when > now) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i != alist->end() && (*i)->when < end) {
|
|
|
|
if ((*i)->when < next_event.when) {
|
|
|
|
next_event.when = (*i)->when;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return next_event.when != std::numeric_limits<double>::max();
|
2008-09-18 20:47:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 02:30:50 -04:00
|
|
|
ControlSet::clear_controls ()
|
2008-09-18 20:47:49 -04:00
|
|
|
{
|
|
|
|
Glib::Mutex::Lock lm (_control_lock);
|
|
|
|
|
2010-07-11 20:41:45 -04:00
|
|
|
_control_connections.drop_connections ();
|
2010-07-13 20:58:15 -04:00
|
|
|
_list_connections.drop_connections ();
|
2010-07-11 20:41:45 -04:00
|
|
|
|
2008-09-18 20:47:49 -04:00
|
|
|
for (Controls::iterator li = _controls.begin(); li != _controls.end(); ++li)
|
|
|
|
li->second->list()->clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Evoral
|