2 Copyright (C) 2000 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include "libardour-config.h"
26 #include <sigc++/bind.h>
28 #include "pbd/failed_constructor.h"
29 #include "pbd/xml++.h"
31 #include "ardour/audio_buffer.h"
32 #include "ardour/automation_list.h"
33 #include "ardour/buffer_set.h"
34 #include "ardour/event_type_map.h"
35 #include "ardour/ladspa_plugin.h"
36 #include "ardour/plugin.h"
37 #include "ardour/plugin_insert.h"
38 #include "ardour/port.h"
39 #include "ardour/route.h"
42 #include "ardour/lv2_plugin.h"
46 #include "ardour/vst_plugin.h"
49 #ifdef HAVE_AUDIOUNITS
50 #include "ardour/audio_unit.h"
53 #include "ardour/audioengine.h"
54 #include "ardour/session.h"
55 #include "ardour/types.h"
60 using namespace ARDOUR;
63 const string PluginInsert::port_automation_node_name = "PortAutomation";
65 PluginInsert::PluginInsert (Session& s, boost::shared_ptr<Plugin> plug)
66 : Processor (s, plug->name())
67 , _signal_analysis_collected_nframes(0)
68 , _signal_analysis_collect_nframes_max(0)
70 /* the first is the master */
72 _plugins.push_back (plug);
77 Glib::Mutex::Lock em (_session.engine().process_lock());
78 IO::PortCountChanged (max(input_streams(), output_streams()));
81 ProcessorCreated (this); /* EMIT SIGNAL */
84 PluginInsert::PluginInsert (Session& s, const XMLNode& node)
85 : Processor (s, "unnamed plugin insert"),
86 _signal_analysis_collected_nframes(0),
87 _signal_analysis_collect_nframes_max(0)
89 if (set_state (node)) {
90 throw failed_constructor();
93 // XXX: This would dump all automation, which has already been loaded by
94 // Processor. But this could also have been related to the Parameter change..
95 // will look into this later.
99 Glib::Mutex::Lock em (_session.engine().process_lock());
100 IO::PortCountChanged (max(input_streams(), output_streams()));
105 PluginInsert::set_count (uint32_t num)
107 bool require_state = !_plugins.empty();
109 /* this is a bad idea.... we shouldn't do this while active.
110 only a route holding their redirect_lock should be calling this
115 } else if (num > _plugins.size()) {
116 uint32_t diff = num - _plugins.size();
118 for (uint32_t n = 0; n < diff; ++n) {
119 _plugins.push_back (plugin_factory (_plugins[0]));
122 /* XXX do something */
126 } else if (num < _plugins.size()) {
127 uint32_t diff = _plugins.size() - num;
128 for (uint32_t n= 0; n < diff; ++n) {
137 PluginInsert::init ()
142 PluginInsert::~PluginInsert ()
144 GoingAway (); /* EMIT SIGNAL */
148 PluginInsert::auto_state_changed (Evoral::Parameter which)
150 if (which.type() != PluginAutomation)
153 boost::shared_ptr<AutomationControl> c
154 = boost::dynamic_pointer_cast<AutomationControl>(data().control (which));
156 if (c && ((AutomationList*)c->list().get())->automation_state() != Off) {
157 _plugins[0]->set_parameter (which.id(), c->list()->eval (_session.transport_frame()));
162 PluginInsert::output_streams() const
164 ChanCount out = _plugins.front()->get_info()->n_outputs;
166 if (out == ChanCount::INFINITE) {
167 return _plugins.front()->output_streams ();
169 out.set_audio (out.n_audio() * _plugins.size());
170 out.set_midi (out.n_midi() * _plugins.size());
176 PluginInsert::input_streams() const
178 ChanCount in = _plugins[0]->get_info()->n_inputs;
180 if (in == ChanCount::INFINITE) {
181 return _plugins[0]->input_streams ();
183 in.set_audio (in.n_audio() * _plugins.size());
184 in.set_midi (in.n_midi() * _plugins.size());
190 PluginInsert::natural_output_streams() const
192 return _plugins[0]->get_info()->n_outputs;
196 PluginInsert::natural_input_streams() const
198 return _plugins[0]->get_info()->n_inputs;
202 PluginInsert::is_generator() const
204 /* XXX more finesse is possible here. VST plugins have a
205 a specific "instrument" flag, for example.
208 return _plugins[0]->get_info()->n_inputs.n_audio() == 0;
212 PluginInsert::set_automatable ()
214 set<Evoral::Parameter> a = _plugins.front()->automatable ();
216 Plugin::ParameterDescriptor desc;
218 for (set<Evoral::Parameter>::iterator i = a.begin(); i != a.end(); ++i) {
219 if (i->type() == PluginAutomation) {
221 _plugins.front()->get_parameter_descriptor(i->id(), desc);
222 Evoral::Parameter param(*i);
223 param.set_range(desc.lower, desc.upper, _plugins.front()->default_value(i->id()));
224 boost::shared_ptr<AutomationList> list(new AutomationList(param));
225 add_control(boost::shared_ptr<AutomationControl>(new PluginControl(this, *i, list)));
231 PluginInsert::parameter_changed (Evoral::Parameter which, float val)
233 if (which.type() != PluginAutomation)
236 Plugins::iterator i = _plugins.begin();
238 /* don't set the first plugin, just all the slaves */
240 if (i != _plugins.end()) {
242 for (; i != _plugins.end(); ++i) {
243 (*i)->set_parameter (which, val);
249 PluginInsert::set_block_size (nframes_t nframes)
251 for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
252 (*i)->set_block_size (nframes);
257 PluginInsert::activate ()
259 for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
265 PluginInsert::deactivate ()
267 for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
273 PluginInsert::connect_and_run (BufferSet& bufs, nframes_t nframes, nframes_t offset, bool with_auto, nframes_t now)
275 // Calculate if, and how many frames we need to collect for analysis
276 nframes_t collect_signal_nframes = (_signal_analysis_collect_nframes_max -
277 _signal_analysis_collected_nframes);
278 if (nframes < collect_signal_nframes) { // we might not get all frames now
279 collect_signal_nframes = nframes;
282 ChanMapping in_map(input_streams());
283 ChanMapping out_map(output_streams());
285 /* Note that we've already required that plugins
286 be able to handle in-place processing.
293 for (Controls::iterator li = data().controls().begin(); li != data().controls().end(); ++li, ++n) {
295 boost::shared_ptr<AutomationControl> c
296 = boost::dynamic_pointer_cast<AutomationControl>(li->second);
298 if (c->parameter().type() == PluginAutomation && c->automation_playback()) {
301 const float val = c->list()->rt_safe_eval (now, valid);
311 if (collect_signal_nframes > 0) {
313 //std::cerr << "collect input, bufs " << bufs.count().n_audio() << " count, " << bufs.available().n_audio() << " available" << std::endl;
314 //std::cerr << " streams " << input_streams().n_audio() << std::endl;
315 //std::cerr << "filling buffer with " << collect_signal_nframes << " frames at " << _signal_analysis_collected_nframes << std::endl;
317 _signal_analysis_inputs.set_count(input_streams());
319 for (uint32_t i = 0; i < input_streams().n_audio(); ++i) {
320 _signal_analysis_inputs.get_audio(i).read_from(
322 collect_signal_nframes,
323 _signal_analysis_collected_nframes); // offset is for target buffer
328 for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
329 (*i)->connect_and_run(bufs, in_map, out_map, nframes, offset);
330 for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
331 in_map.offset_to(*t, natural_input_streams().get(*t));
332 out_map.offset_to(*t, natural_output_streams().get(*t));
336 if (collect_signal_nframes > 0) {
338 //std::cerr << " output, bufs " << bufs.count().n_audio() << " count, " << bufs.available().n_audio() << " available" << std::endl;
339 //std::cerr << " streams " << output_streams().n_audio() << std::endl;
341 _signal_analysis_outputs.set_count(output_streams());
343 for (uint32_t i = 0; i < output_streams().n_audio(); ++i) {
344 _signal_analysis_outputs.get_audio(i).read_from(
346 collect_signal_nframes,
347 _signal_analysis_collected_nframes); // offset is for target buffer
350 _signal_analysis_collected_nframes += collect_signal_nframes;
351 assert(_signal_analysis_collected_nframes <= _signal_analysis_collect_nframes_max);
353 if (_signal_analysis_collected_nframes == _signal_analysis_collect_nframes_max) {
354 _signal_analysis_collect_nframes_max = 0;
355 _signal_analysis_collected_nframes = 0;
357 AnalysisDataGathered(&_signal_analysis_inputs,
358 &_signal_analysis_outputs);
361 /* leave remaining channel buffers alone */
365 PluginInsert::silence (nframes_t nframes)
367 ChanMapping in_map(input_streams());
368 ChanMapping out_map(output_streams());
371 for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
372 (*i)->connect_and_run (_session.get_silent_buffers ((*i)->get_info()->n_inputs), in_map, out_map, nframes, 0);
378 PluginInsert::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
380 if (_active || _pending_active) {
382 if (_session.transport_rolling()) {
383 automation_run (bufs, nframes);
385 connect_and_run (bufs, nframes, 0, false);
390 /* FIXME: type, audio only */
392 uint32_t in = _plugins[0]->get_info()->n_inputs.n_audio();
393 uint32_t out = _plugins[0]->get_info()->n_outputs.n_audio();
397 /* not active, but something has make up for any channel count increase */
399 for (uint32_t n = out - in; n < out; ++n) {
400 memcpy (bufs.get_audio(n).data(), bufs.get_audio(in - 1).data(), sizeof (Sample) * nframes);
404 bufs.count().set_audio(out);
407 _active = _pending_active;
411 PluginInsert::set_parameter (Evoral::Parameter param, float val)
413 if (param.type() != PluginAutomation)
416 /* the others will be set from the event triggered by this */
418 _plugins[0]->set_parameter (param.id(), val);
420 boost::shared_ptr<AutomationControl> ac
421 = boost::dynamic_pointer_cast<AutomationControl>(data().control(param));
426 warning << "set_parameter called for nonexistant parameter "
427 << EventTypeMap::instance().to_symbol(param) << endmsg;
430 _session.set_dirty();
434 PluginInsert::get_parameter (Evoral::Parameter param)
436 if (param.type() != PluginAutomation)
440 _plugins[0]->get_parameter (param.id());
444 PluginInsert::automation_run (BufferSet& bufs, nframes_t nframes)
446 Evoral::ControlEvent next_event (0, 0.0f);
447 nframes_t now = _session.transport_frame ();
448 nframes_t end = now + nframes;
449 nframes_t offset = 0;
451 Glib::Mutex::Lock lm (data().control_lock(), Glib::TRY_LOCK);
454 connect_and_run (bufs, nframes, offset, false);
458 if (!data().find_next_event (now, end, next_event)) {
460 /* no events have a time within the relevant range */
462 connect_and_run (bufs, nframes, offset, true, now);
468 nframes_t cnt = min (((nframes_t) ceil (next_event.when) - now), nframes);
470 connect_and_run (bufs, cnt, offset, true, now);
476 if (!data().find_next_event (now, end, next_event)) {
481 /* cleanup anything that is left to do */
484 connect_and_run (bufs, nframes, offset, true, now);
489 PluginInsert::default_parameter_value (const Evoral::Parameter& param)
491 if (param.type() != PluginAutomation)
494 if (_plugins.empty()) {
495 fatal << _("programming error: ") << X_("PluginInsert::default_parameter_value() called with no plugin")
500 return _plugins[0]->default_value (param.id());
503 boost::shared_ptr<Plugin>
504 PluginInsert::plugin_factory (boost::shared_ptr<Plugin> other)
506 boost::shared_ptr<LadspaPlugin> lp;
508 boost::shared_ptr<LV2Plugin> lv2p;
511 boost::shared_ptr<VSTPlugin> vp;
513 #ifdef HAVE_AUDIOUNITS
514 boost::shared_ptr<AUPlugin> ap;
517 if ((lp = boost::dynamic_pointer_cast<LadspaPlugin> (other)) != 0) {
518 return boost::shared_ptr<Plugin> (new LadspaPlugin (*lp));
520 } else if ((lv2p = boost::dynamic_pointer_cast<LV2Plugin> (other)) != 0) {
521 return boost::shared_ptr<Plugin> (new LV2Plugin (*lv2p));
524 } else if ((vp = boost::dynamic_pointer_cast<VSTPlugin> (other)) != 0) {
525 return boost::shared_ptr<Plugin> (new VSTPlugin (*vp));
527 #ifdef HAVE_AUDIOUNITS
528 } else if ((ap = boost::dynamic_pointer_cast<AUPlugin> (other)) != 0) {
529 return boost::shared_ptr<Plugin> (new AUPlugin (*ap));
533 fatal << string_compose (_("programming error: %1"),
534 X_("unknown plugin type in PluginInsert::plugin_factory"))
537 return boost::shared_ptr<Plugin> ((Plugin*) 0);
541 PluginInsert::configure_io (ChanCount in, ChanCount out)
543 if (set_count (count_for_configuration (in, out)) < 0) {
547 /* if we're running replicated plugins, each plugin has
548 the same i/o configuration and we may need to announce how many
549 output streams there are.
551 if we running a single plugin, we need to configure it.
554 if (_plugins.front()->configure_io (in, out) < 0) {
558 // we don't know the analysis window size, so we must work with the
559 // current buffer size here. each request for data fills in these
560 // buffers and the analyser makes sure it gets enough data for the
562 session().ensure_buffer_set (_signal_analysis_inputs, in);
563 //_signal_analysis_inputs.set_count (in);
565 session().ensure_buffer_set (_signal_analysis_outputs, out);
566 //_signal_analysis_outputs.set_count (out);
568 // std::cerr << "set counts to i" << in.n_audio() << "/o" << out.n_audio() << std::endl;
570 return Processor::configure_io (in, out);
574 PluginInsert::can_support_io_configuration (const ChanCount& in, ChanCount& out) const
576 // Plugin has flexible I/O, so delegate to it
577 if (_plugins.front()->reconfigurable_io()) {
578 return _plugins.front()->can_support_io_configuration (in, out);
581 ChanCount inputs = _plugins[0]->get_info()->n_inputs;
582 ChanCount outputs = _plugins[0]->get_info()->n_outputs;
584 // Plugin inputs match requested inputs exactly
590 // See if replication is possible
591 // We can replicate if there exists a single factor f such that, for every type,
592 // the number of plugin inputs * f = the requested number of inputs
594 bool can_replicate = true;
595 for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
596 // No inputs of this type
597 if (inputs.get(*t) == 0 && in.get(*t) == 0) {
600 // Plugin has more inputs than requested, can not replicate
601 } else if (inputs.get(*t) >= in.get(*t)) {
602 can_replicate = false;
605 // Plugin inputs is not a factor of requested inputs, can not replicate
606 } else if (inputs.get(*t) == 0 || in.get(*t) % inputs.get(*t) != 0) {
607 can_replicate = false;
610 // Potential factor not set yet
612 f = in.get(*t) / inputs.get(*t);;
615 // Factor for this type does not match another type, can not replicate
616 if (f != (in.get(*t) / inputs.get(*t))) {
617 can_replicate = false;
623 for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
624 out.set (*t, outputs.get(*t) * f);
632 /* Number of plugin instances required to support a given channel configuration.
636 PluginInsert::count_for_configuration (ChanCount in, ChanCount out) const
638 if (_plugins.front()->reconfigurable_io()) {
639 /* plugin has flexible I/O, so the answer is always 1 */
640 /* this could change if we ever decide to replicate AU's */
644 // FIXME: take 'out' into consideration
646 ChanCount outputs = _plugins[0]->get_info()->n_outputs;
647 ChanCount inputs = _plugins[0]->get_info()->n_inputs;
649 if (inputs.n_total() == 0) {
650 /* instrument plugin, always legal, but throws away any existing streams */
654 if (inputs.n_total() == 1 && outputs == inputs
655 && ((inputs.n_audio() == 0 && in.n_audio() == 0)
656 || (inputs.n_midi() == 0 && in.n_midi() == 0))) {
657 /* mono plugin, replicate as needed to match in */
666 // assumes in is valid, so we must be replicating
667 if (inputs.n_total() < in.n_total()
668 && (in.n_total() % inputs.n_total() == 0)) {
670 return in.n_total() / inputs.n_total();
678 PluginInsert::get_state(void)
684 PluginInsert::state (bool full)
686 XMLNode& node = Processor::state (full);
688 node.add_property("type", _plugins[0]->state_node_name());
689 node.add_property("unique-id", _plugins[0]->unique_id());
690 node.add_property("count", string_compose("%1", _plugins.size()));
691 node.add_child_nocopy (_plugins[0]->get_state());
693 /* add port automation state */
694 //XMLNode *autonode = new XMLNode(port_automation_node_name);
695 set<Evoral::Parameter> automatable = _plugins[0]->automatable();
697 for (set<Evoral::Parameter>::iterator x = automatable.begin(); x != automatable.end(); ++x) {
699 /*XMLNode* child = new XMLNode("port");
700 snprintf(buf, sizeof(buf), "%" PRIu32, *x);
701 child->add_property("number", string(buf));
703 child->add_child_nocopy (automation_list (*x).state (full));
704 autonode->add_child_nocopy (*child);
706 //autonode->add_child_nocopy (((AutomationList*)data().control(*x)->list().get())->state (full));
709 //node.add_child_nocopy (*autonode);
715 PluginInsert::set_state(const XMLNode& node)
717 XMLNodeList nlist = node.children();
718 XMLNodeIterator niter;
719 XMLPropertyList plist;
720 const XMLProperty *prop;
721 ARDOUR::PluginType type;
723 if ((prop = node.property ("type")) == 0) {
724 error << _("XML node describing insert is missing the `type' field") << endmsg;
728 if (prop->value() == X_("ladspa") || prop->value() == X_("Ladspa")) { /* handle old school sessions */
729 type = ARDOUR::LADSPA;
730 } else if (prop->value() == X_("lv2")) {
732 } else if (prop->value() == X_("vst")) {
735 error << string_compose (_("unknown plugin type %1 in plugin insert state"),
741 prop = node.property ("unique-id");
743 error << _("Plugin has no unique ID field") << endmsg;
747 boost::shared_ptr<Plugin> plugin;
749 plugin = find_plugin (_session, prop->value(), type);
752 error << string_compose(_("Found a reference to a plugin (\"%1\") that is unknown.\n"
753 "Perhaps it was removed or moved since it was last used."), prop->value())
760 if ((prop = node.property ("count")) != 0) {
761 sscanf (prop->value().c_str(), "%u", &count);
764 if (_plugins.size() != count) {
766 _plugins.push_back (plugin);
768 for (uint32_t n=1; n < count; ++n) {
769 _plugins.push_back (plugin_factory (plugin));
773 for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
774 if ((*niter)->name() == plugin->state_node_name()) {
775 for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
776 (*i)->set_state (**niter);
782 const XMLNode* insert_node = &node;
784 // legacy sessions: search for child IOProcessor node
785 for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
786 if ((*niter)->name() == "IOProcessor") {
787 insert_node = *niter;
792 Processor::set_state (*insert_node);
794 /* look for port automation node */
796 for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
798 if ((*niter)->name() != port_automation_node_name) {
804 XMLNodeConstIterator iter;
809 cnodes = (*niter)->children ("Port");
811 for (iter = cnodes.begin(); iter != cnodes.end(); ++iter) {
815 if ((cprop = child->property("number")) != 0) {
816 port = cprop->value().c_str();
818 warning << _("PluginInsert: Auto: no plugin port number") << endmsg;
822 sscanf (port, "%" PRIu32, &port_id);
824 if (port_id >= _plugins[0]->parameter_count()) {
825 warning << _("PluginInsert: Auto: port id out of range") << endmsg;
829 boost::shared_ptr<AutomationControl> c = boost::dynamic_pointer_cast<AutomationControl>(
830 data().control(Evoral::Parameter(PluginAutomation, 0, port_id), true));
832 if (!child->children().empty()) {
833 c->alist()->set_state (*child->children().front());
835 if ((cprop = child->property("auto")) != 0) {
840 sscanf (cprop->value().c_str(), "0x%x", &x);
841 c->alist()->set_automation_state (AutoState (x));
847 c->alist()->set_automation_state (Off);
858 // The name of the PluginInsert comes from the plugin, nothing else
859 _name = plugin->get_info()->name;
865 PluginInsert::describe_parameter (Evoral::Parameter param)
867 if (param.type() != PluginAutomation)
868 return Automatable::describe_parameter(param);
870 return _plugins[0]->describe_parameter (param);
874 PluginInsert::signal_latency() const
877 return _user_latency;
880 return _plugins[0]->signal_latency ();
884 PluginInsert::type ()
886 boost::shared_ptr<LadspaPlugin> lp;
888 boost::shared_ptr<VSTPlugin> vp;
890 #ifdef HAVE_AUDIOUNITS
891 boost::shared_ptr<AUPlugin> ap;
894 PluginPtr other = plugin ();
896 if ((lp = boost::dynamic_pointer_cast<LadspaPlugin> (other)) != 0) {
897 return ARDOUR::LADSPA;
899 } else if ((vp = boost::dynamic_pointer_cast<VSTPlugin> (other)) != 0) {
902 #ifdef HAVE_AUDIOUNITS
903 } else if ((ap = boost::dynamic_pointer_cast<AUPlugin> (other)) != 0) {
904 return ARDOUR::AudioUnit;
908 return (ARDOUR::PluginType) 0;
912 PluginInsert::PluginControl::PluginControl (PluginInsert* p, const Evoral::Parameter ¶m, boost::shared_ptr<AutomationList> list)
913 : AutomationControl (p->session(), param, list, p->describe_parameter(param))
916 Plugin::ParameterDescriptor desc;
917 p->plugin(0)->get_parameter_descriptor (param.id(), desc);
918 _logarithmic = desc.logarithmic;
919 _toggled = desc.toggled;
923 PluginInsert::PluginControl::set_value (float val)
925 /* FIXME: probably should be taking out some lock here.. */
935 /*const float range = _list->get_max_y() - _list->get_min_y();
936 const float lower = _list->get_min_y();
939 val = lower + (range * val);
941 float log_lower = 0.0f;
943 log_lower = log(lower);
946 val = exp(log_lower + log(range) * val);
951 for (Plugins::iterator i = _plugin->_plugins.begin();
952 i != _plugin->_plugins.end(); ++i) {
953 (*i)->set_parameter (_list->parameter().id(), val);
956 boost::shared_ptr<Plugin> iasp = _plugin->_impulseAnalysisPlugin.lock();
958 iasp->set_parameter (_list->parameter().id(), val);
961 AutomationControl::set_value(val);
965 PluginInsert::PluginControl::get_value (void) const
967 /* FIXME: probably should be taking out some lock here.. */
969 float val = _plugin->get_parameter (_list->parameter());
983 return ((val - lower) / range);
987 boost::shared_ptr<Plugin>
988 PluginInsert::get_impulse_analysis_plugin()
990 boost::shared_ptr<Plugin> ret;
991 if (_impulseAnalysisPlugin.expired()) {
992 ret = plugin_factory(_plugins[0]);
993 _impulseAnalysisPlugin = ret;
995 ret = _impulseAnalysisPlugin.lock();
1002 PluginInsert::collect_signal_for_analysis(nframes_t nframes)
1004 // called from outside the audio thread, so this should be safe
1005 // only do audio as analysis is (currently) only for audio plugins
1006 _signal_analysis_inputs.ensure_buffers( DataType::AUDIO, input_streams().n_audio(), nframes);
1007 _signal_analysis_outputs.ensure_buffers( DataType::AUDIO, output_streams().n_audio(), nframes);
1009 _signal_analysis_collected_nframes = 0;
1010 _signal_analysis_collect_nframes_max = nframes;