mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 20:26:30 +01:00
Clean up is_instrument vs needs-midi-in API
The latter is only really relevant for Audio Units. This fixes an issue with vocoders or audio-plugins that simply have a MIDI input for other purposes to be wrongly categorized as Instruments.. .. and thereby override strict-i/o rules (prefer stereo)
This commit is contained in:
parent
b497bb9db4
commit
97111b0ec2
4 changed files with 14 additions and 8 deletions
|
|
@ -395,7 +395,7 @@ class LIBARDOUR_API PluginInfo {
|
||||||
|
|
||||||
virtual PluginPtr load (Session& session) = 0;
|
virtual PluginPtr load (Session& session) = 0;
|
||||||
virtual bool is_instrument() const;
|
virtual bool is_instrument() const;
|
||||||
virtual bool needs_midi_input() const { return is_instrument (); }
|
virtual bool needs_midi_input() const;
|
||||||
virtual bool in_category (const std::string &) const { return false; }
|
virtual bool in_category (const std::string &) const { return false; }
|
||||||
|
|
||||||
virtual std::vector<Plugin::PresetRecord> get_presets (bool user_only) const = 0;
|
virtual std::vector<Plugin::PresetRecord> get_presets (bool user_only) const = 0;
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ class LIBARDOUR_API PluginInsert : public Processor
|
||||||
|
|
||||||
bool has_no_inputs() const;
|
bool has_no_inputs() const;
|
||||||
bool has_no_audio_inputs() const;
|
bool has_no_audio_inputs() const;
|
||||||
bool needs_midi_input() const;
|
bool is_instrument () const;
|
||||||
bool has_output_presets (
|
bool has_output_presets (
|
||||||
ChanCount in = ChanCount (DataType::MIDI, 1),
|
ChanCount in = ChanCount (DataType::MIDI, 1),
|
||||||
ChanCount out = ChanCount (DataType::AUDIO, 2)
|
ChanCount out = ChanCount (DataType::AUDIO, 2)
|
||||||
|
|
|
||||||
|
|
@ -81,10 +81,16 @@ static bool seen_set_state_message = false;
|
||||||
|
|
||||||
PBD::Signal2<void, std::string, Plugin*> Plugin::PresetsChanged;
|
PBD::Signal2<void, std::string, Plugin*> Plugin::PresetsChanged;
|
||||||
|
|
||||||
|
bool
|
||||||
|
PluginInfo::needs_midi_input () const
|
||||||
|
{
|
||||||
|
return (n_inputs.n_midi() != 0);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PluginInfo::is_instrument () const
|
PluginInfo::is_instrument () const
|
||||||
{
|
{
|
||||||
return (n_inputs.n_midi() != 0) && (n_outputs.n_audio() > 0);
|
return (n_inputs.n_midi() != 0) && (n_outputs.n_audio() > 0) && (n_inputs.n_audio() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Plugin::Plugin (AudioEngine& e, Session& s)
|
Plugin::Plugin (AudioEngine& e, Session& s)
|
||||||
|
|
|
||||||
|
|
@ -394,13 +394,13 @@ PluginInsert::plugin_latency () const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PluginInsert::needs_midi_input() const
|
PluginInsert::is_instrument() const
|
||||||
{
|
{
|
||||||
PluginInfoPtr pip = _plugins[0]->get_info();
|
PluginInfoPtr pip = _plugins[0]->get_info();
|
||||||
if (pip->needs_midi_input ()) {
|
if (pip->is_instrument ()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return pip->n_inputs.n_midi() != 0 && pip->n_outputs.n_audio() != 0;
|
return pip->n_inputs.n_midi () != 0 && pip->n_outputs.n_audio () > 0 && pip->n_inputs.n_audio () == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
@ -426,7 +426,7 @@ PluginInsert::has_output_presets (ChanCount in, ChanCount out)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!needs_midi_input ()) {
|
if (!is_instrument ()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1994,7 +1994,7 @@ PluginInsert::internal_can_support_io_configuration (ChanCount const & inx, Chan
|
||||||
m.strict_io = true;
|
m.strict_io = true;
|
||||||
|
|
||||||
/* special case MIDI instruments */
|
/* special case MIDI instruments */
|
||||||
if (needs_midi_input ()) {
|
if (is_instrument ()) {
|
||||||
// output = midi-bypass + at most master-out channels.
|
// output = midi-bypass + at most master-out channels.
|
||||||
ChanCount max_out (DataType::AUDIO, 2); // TODO use master-out
|
ChanCount max_out (DataType::AUDIO, 2); // TODO use master-out
|
||||||
max_out.set (DataType::MIDI, out.get(DataType::MIDI));
|
max_out.set (DataType::MIDI, out.get(DataType::MIDI));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue