mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
Avoid direct use of PluginInfo->n_in/outputs
This is in preparation for VST3 setBusArrangements variable bus I/O count.
This commit is contained in:
parent
a2198f5aef
commit
6674123dc9
4 changed files with 42 additions and 50 deletions
|
|
@ -277,6 +277,7 @@ private:
|
||||||
|
|
||||||
void parameter_changed_externally (uint32_t, float);
|
void parameter_changed_externally (uint32_t, float);
|
||||||
void property_changed_externally (uint32_t which, Variant);
|
void property_changed_externally (uint32_t which, Variant);
|
||||||
|
void cache_sidechain_count ();
|
||||||
|
|
||||||
void set_parameter (Evoral::Parameter param, float val, sampleoffset_t);
|
void set_parameter (Evoral::Parameter param, float val, sampleoffset_t);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -302,19 +302,13 @@ ARDOUR::find_plugin(Session& session, string identifier, PluginType type)
|
||||||
ChanCount
|
ChanCount
|
||||||
Plugin::output_streams () const
|
Plugin::output_streams () const
|
||||||
{
|
{
|
||||||
/* LADSPA & VST should not get here because they do not
|
return get_info()->n_outputs;
|
||||||
return "infinite" i/o counts.
|
|
||||||
*/
|
|
||||||
return ChanCount::ZERO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ChanCount
|
ChanCount
|
||||||
Plugin::input_streams () const
|
Plugin::input_streams () const
|
||||||
{
|
{
|
||||||
/* LADSPA & VST should not get here because they do not
|
return get_info()->n_inputs;
|
||||||
return "infinite" i/o counts.
|
|
||||||
*/
|
|
||||||
return ChanCount::ZERO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
samplecnt_t
|
samplecnt_t
|
||||||
|
|
|
||||||
|
|
@ -328,14 +328,12 @@ PluginInsert::internal_output_streams() const
|
||||||
{
|
{
|
||||||
assert (!_plugins.empty());
|
assert (!_plugins.empty());
|
||||||
|
|
||||||
PluginInfoPtr info = _plugins.front()->get_info();
|
ChanCount out (_plugins.front()->output_streams ());
|
||||||
|
|
||||||
if (info->reconfigurable_io()) {
|
if (_plugins.front()->get_info()->reconfigurable_io()) {
|
||||||
ChanCount out = _plugins.front()->output_streams ();
|
|
||||||
// DEBUG_TRACE (DEBUG::Processors, string_compose ("Plugin insert, reconfigur(able) output streams = %1\n", out));
|
// DEBUG_TRACE (DEBUG::Processors, string_compose ("Plugin insert, reconfigur(able) output streams = %1\n", out));
|
||||||
return out;
|
return out;
|
||||||
} else {
|
} else {
|
||||||
ChanCount out = info->n_outputs;
|
|
||||||
// DEBUG_TRACE (DEBUG::Processors, string_compose ("Plugin insert, static output streams = %1 for %2 plugins\n", out, _plugins.size()));
|
// DEBUG_TRACE (DEBUG::Processors, string_compose ("Plugin insert, static output streams = %1 for %2 plugins\n", out, _plugins.size()));
|
||||||
out.set_audio (out.n_audio() * _plugins.size());
|
out.set_audio (out.n_audio() * _plugins.size());
|
||||||
out.set_midi (out.n_midi() * _plugins.size());
|
out.set_midi (out.n_midi() * _plugins.size());
|
||||||
|
|
@ -348,15 +346,7 @@ PluginInsert::internal_input_streams() const
|
||||||
{
|
{
|
||||||
assert (!_plugins.empty());
|
assert (!_plugins.empty());
|
||||||
|
|
||||||
ChanCount in;
|
ChanCount in (_plugins.front()->input_streams ());
|
||||||
|
|
||||||
PluginInfoPtr info = _plugins.front()->get_info();
|
|
||||||
|
|
||||||
if (info->reconfigurable_io()) {
|
|
||||||
in = _plugins.front()->input_streams();
|
|
||||||
} else {
|
|
||||||
in = info->n_inputs;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::Processors, string_compose ("Plugin insert, input streams = %1, match using %2\n", in, _match.method));
|
DEBUG_TRACE (DEBUG::Processors, string_compose ("Plugin insert, input streams = %1, match using %2\n", in, _match.method));
|
||||||
|
|
||||||
|
|
@ -397,7 +387,7 @@ PluginInsert::natural_output_streams() const
|
||||||
return ChanCount::min (_configured_out, ChanCount (DataType::AUDIO, 2));
|
return ChanCount::min (_configured_out, ChanCount (DataType::AUDIO, 2));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return _plugins[0]->get_info()->n_outputs;
|
return _plugins[0]->output_streams ();
|
||||||
}
|
}
|
||||||
|
|
||||||
ChanCount
|
ChanCount
|
||||||
|
|
@ -408,7 +398,7 @@ PluginInsert::natural_input_streams() const
|
||||||
return ChanCount::min (_configured_in, ChanCount (DataType::AUDIO, 2));
|
return ChanCount::min (_configured_in, ChanCount (DataType::AUDIO, 2));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return _plugins[0]->get_info()->n_inputs;
|
return _plugins[0]->input_streams ();
|
||||||
}
|
}
|
||||||
|
|
||||||
ChanCount
|
ChanCount
|
||||||
|
|
@ -2311,11 +2301,12 @@ PluginInsert::internal_can_support_io_configuration (ChanCount const & inx, Chan
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const bool reconfigurable_io = _plugins.front()->get_info()->reconfigurable_io();
|
||||||
|
|
||||||
/* if a user specified a custom cfg, so be it. */
|
/* if a user specified a custom cfg, so be it. */
|
||||||
if (_custom_cfg) {
|
if (_custom_cfg) {
|
||||||
PluginInfoPtr info = _plugins.front()->get_info();
|
|
||||||
out = _custom_out;
|
out = _custom_out;
|
||||||
if (info->reconfigurable_io()) {
|
if (reconfigurable_io) {
|
||||||
return Match (Delegate, 1, _strict_io, true);
|
return Match (Delegate, 1, _strict_io, true);
|
||||||
} else {
|
} else {
|
||||||
return Match (ExactMatch, get_count(), _strict_io, true);
|
return Match (ExactMatch, get_count(), _strict_io, true);
|
||||||
|
|
@ -2325,9 +2316,8 @@ PluginInsert::internal_can_support_io_configuration (ChanCount const & inx, Chan
|
||||||
/* try automatic configuration */
|
/* try automatic configuration */
|
||||||
Match m = PluginInsert::automatic_can_support_io_configuration (inx, out);
|
Match m = PluginInsert::automatic_can_support_io_configuration (inx, out);
|
||||||
|
|
||||||
PluginInfoPtr info = _plugins.front()->get_info();
|
ChanCount inputs = natural_input_streams ();
|
||||||
ChanCount inputs = info->n_inputs;
|
ChanCount outputs = natural_output_streams ();
|
||||||
ChanCount outputs = info->n_outputs;
|
|
||||||
|
|
||||||
/* handle case strict-i/o */
|
/* handle case strict-i/o */
|
||||||
if (_strict_io && m.method != Impossible) {
|
if (_strict_io && m.method != Impossible) {
|
||||||
|
|
@ -2375,7 +2365,7 @@ PluginInsert::internal_can_support_io_configuration (ChanCount const & inx, Chan
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::ChanMapping, string_compose ("%1: resolving 'Impossible' match...\n", name()));
|
DEBUG_TRACE (DEBUG::ChanMapping, string_compose ("%1: resolving 'Impossible' match...\n", name()));
|
||||||
|
|
||||||
if (info->reconfigurable_io()) {
|
if (reconfigurable_io) {
|
||||||
//out = inx; // hint
|
//out = inx; // hint
|
||||||
ChanCount main_in = inx;
|
ChanCount main_in = inx;
|
||||||
ChanCount aux_in = sidechain_input_pins ();
|
ChanCount aux_in = sidechain_input_pins ();
|
||||||
|
|
@ -2446,11 +2436,12 @@ PluginInsert::automatic_can_support_io_configuration (ChanCount const& inx, Chan
|
||||||
return Match();
|
return Match();
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginInfoPtr info = _plugins.front()->get_info();
|
const bool reconfigurable_io = _plugins.front()->get_info()->reconfigurable_io();
|
||||||
|
|
||||||
ChanCount in; in += inx;
|
ChanCount in; in += inx;
|
||||||
ChanCount midi_bypass;
|
ChanCount midi_bypass;
|
||||||
|
|
||||||
if (info->reconfigurable_io()) {
|
if (reconfigurable_io) {
|
||||||
/* Plugin has flexible I/O, so delegate to it
|
/* Plugin has flexible I/O, so delegate to it
|
||||||
* pre-seed outputs, plugin tries closest match
|
* pre-seed outputs, plugin tries closest match
|
||||||
*/
|
*/
|
||||||
|
|
@ -2467,8 +2458,8 @@ PluginInsert::automatic_can_support_io_configuration (ChanCount const& inx, Chan
|
||||||
return Match (Delegate, 1);
|
return Match (Delegate, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChanCount inputs = info->n_inputs;
|
ChanCount inputs = natural_input_streams ();
|
||||||
ChanCount outputs = info->n_outputs;
|
ChanCount outputs = natural_output_streams ();
|
||||||
ChanCount ns_inputs = inputs - sidechain_input_pins ();
|
ChanCount ns_inputs = inputs - sidechain_input_pins ();
|
||||||
|
|
||||||
if (in.get(DataType::MIDI) == 1 && outputs.get(DataType::MIDI) == 0) {
|
if (in.get(DataType::MIDI) == 1 && outputs.get(DataType::MIDI) == 0) {
|
||||||
|
|
@ -2990,7 +2981,6 @@ PluginInsert::get_impulse_analysis_plugin()
|
||||||
ChanCount out (internal_output_streams ());
|
ChanCount out (internal_output_streams ());
|
||||||
ChanCount aux_in;
|
ChanCount aux_in;
|
||||||
if (ret->get_info ()->reconfigurable_io ()) {
|
if (ret->get_info ()->reconfigurable_io ()) {
|
||||||
// populate get_info ()->n_inputs and ->n_outputs
|
|
||||||
ret->match_variable_io (ins, aux_in, out);
|
ret->match_variable_io (ins, aux_in, out);
|
||||||
assert (out == internal_output_streams ());
|
assert (out == internal_output_streams ());
|
||||||
}
|
}
|
||||||
|
|
@ -3027,6 +3017,21 @@ PluginInsert::collect_signal_for_analysis (samplecnt_t nframes)
|
||||||
_signal_analysis_collect_nsamples_max = nframes;
|
_signal_analysis_collect_nsamples_max = nframes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PluginInsert::cache_sidechain_count ()
|
||||||
|
{
|
||||||
|
_cached_sidechain_pins.reset ();
|
||||||
|
const ChanCount& nis (plugin()->input_streams ());
|
||||||
|
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
|
||||||
|
for (uint32_t in = 0; in < nis.get (*t); ++in) {
|
||||||
|
const Plugin::IOPortDescription& iod (plugin()->describe_io_port (*t, true, in));
|
||||||
|
if (iod.is_sidechain) {
|
||||||
|
_cached_sidechain_pins.set (*t, 1 + _cached_sidechain_pins.n(*t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Add a plugin to our list */
|
/** Add a plugin to our list */
|
||||||
void
|
void
|
||||||
PluginInsert::add_plugin (std::shared_ptr<Plugin> plugin)
|
PluginInsert::add_plugin (std::shared_ptr<Plugin> plugin)
|
||||||
|
|
@ -3041,18 +3046,6 @@ PluginInsert::add_plugin (std::shared_ptr<Plugin> plugin)
|
||||||
plugin->PropertyChanged.connect_same_thread (*this, std::bind (&PluginInsert::property_changed_externally, this, _1, _2));
|
plugin->PropertyChanged.connect_same_thread (*this, std::bind (&PluginInsert::property_changed_externally, this, _1, _2));
|
||||||
plugin->StartTouch.connect_same_thread (*this, std::bind (&PluginInsert::start_touch, this, _1));
|
plugin->StartTouch.connect_same_thread (*this, std::bind (&PluginInsert::start_touch, this, _1));
|
||||||
plugin->EndTouch.connect_same_thread (*this, std::bind (&PluginInsert::end_touch, this, _1));
|
plugin->EndTouch.connect_same_thread (*this, std::bind (&PluginInsert::end_touch, this, _1));
|
||||||
_custom_sinks = plugin->get_info()->n_inputs;
|
|
||||||
// cache sidechain port count
|
|
||||||
_cached_sidechain_pins.reset ();
|
|
||||||
const ChanCount& nis (plugin->get_info()->n_inputs);
|
|
||||||
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
|
|
||||||
for (uint32_t in = 0; in < nis.get (*t); ++in) {
|
|
||||||
const Plugin::IOPortDescription& iod (plugin->describe_io_port (*t, true, in));
|
|
||||||
if (iod.is_sidechain) {
|
|
||||||
_cached_sidechain_pins.set (*t, 1 + _cached_sidechain_pins.n(*t));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin->set_insert (this, _plugins.size ());
|
plugin->set_insert (this, _plugins.size ());
|
||||||
|
|
@ -3062,6 +3055,10 @@ PluginInsert::add_plugin (std::shared_ptr<Plugin> plugin)
|
||||||
if (_plugins.size() > 1) {
|
if (_plugins.size() > 1) {
|
||||||
_plugins[0]->add_slave (plugin, true);
|
_plugins[0]->add_slave (plugin, true);
|
||||||
plugin->DropReferences.connect_same_thread (*this, std::bind (&PluginInsert::plugin_removed, this, std::weak_ptr<Plugin> (plugin)));
|
plugin->DropReferences.connect_same_thread (*this, std::bind (&PluginInsert::plugin_removed, this, std::weak_ptr<Plugin> (plugin)));
|
||||||
|
} else {
|
||||||
|
/* first plugin */
|
||||||
|
_custom_sinks = plugin->get_info()->n_inputs; // XXX
|
||||||
|
cache_sidechain_count ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -992,8 +992,8 @@ RegionFxPlugin::configure_io (ChanCount in, ChanCount out)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChanCount natural_input_streams = _plugins[0]->get_info ()->n_inputs;
|
ChanCount natural_input_streams = _plugins[0]->input_streams ();
|
||||||
ChanCount natural_output_streams = _plugins[0]->get_info ()->n_outputs;
|
ChanCount natural_output_streams = _plugins[0]->output_streams ();
|
||||||
|
|
||||||
_match = private_can_support_io_configuration (in, out);
|
_match = private_can_support_io_configuration (in, out);
|
||||||
|
|
||||||
|
|
@ -1143,8 +1143,8 @@ RegionFxPlugin::check_inplace ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ChanCount natural_input_streams = _plugins[0]->get_info ()->n_inputs;
|
ChanCount natural_input_streams = _plugins[0]->input_streams ();
|
||||||
ChanCount natural_output_streams = _plugins[0]->get_info ()->n_outputs;
|
ChanCount natural_output_streams = _plugins[0]->output_streams ();
|
||||||
|
|
||||||
if (natural_input_streams * get_count () != _configured_in) {
|
if (natural_input_streams * get_count () != _configured_in) {
|
||||||
inplace_ok = false;
|
inplace_ok = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue