refine definition of "generator" plugins, and only send silence through the route is there is a REAL generator plugin (i.e. no inputs at all). Fixes #4144 (hopefully without breaking anything else)

git-svn-id: svn://localhost/ardour2/branches/3.0@9814 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis
2011-07-08 21:58:34 +00:00
parent 0f7e423422
commit 9a2fe5aad3
3 changed files with 25 additions and 9 deletions

View File

@@ -72,7 +72,9 @@ class PluginInsert : public Processor
bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
bool configure_io (ChanCount in, ChanCount out);
bool is_generator() const;
bool has_no_inputs() const;
bool has_no_audio_inputs() const;
bool is_midi_instrument() const;
void realtime_handle_transport_stopped ();

View File

@@ -181,13 +181,27 @@ PluginInsert::natural_input_streams() const
}
bool
PluginInsert::is_generator() const
PluginInsert::has_no_inputs() const
{
return _plugins[0]->get_info()->n_inputs == ChanCount::ZERO;
}
bool
PluginInsert::has_no_audio_inputs() const
{
return _plugins[0]->get_info()->n_inputs.n_audio() == 0;
}
bool
PluginInsert::is_midi_instrument() const
{
/* XXX more finesse is possible here. VST plugins have a
a specific "instrument" flag, for example.
*/
PluginInfoPtr pi = _plugins[0]->get_info();
return _plugins[0]->get_info()->n_inputs.n_audio() == 0;
return pi->n_inputs.n_midi() != 0 &&
pi->n_outputs.n_audio() > 0;
}
void
@@ -414,7 +428,7 @@ PluginInsert::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end
} else {
if (is_generator()) {
if (has_no_audio_inputs()) {
/* silence all (audio) outputs. Should really declick
* at the transitions of "active"

View File

@@ -909,7 +909,7 @@ Route::add_processor (boost::shared_ptr<Processor> processor, ProcessorList::ite
if ((pi = boost::dynamic_pointer_cast<PluginInsert>(processor)) != 0) {
if (pi->natural_input_streams() == ChanCount::ZERO) {
if (pi->has_no_inputs ()) {
/* generator plugin */
_have_internal_generator = true;
}
@@ -1062,7 +1062,7 @@ Route::add_processors (const ProcessorList& others, boost::shared_ptr<Processor>
boost::shared_ptr<PluginInsert> pi;
if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) {
if (pi->is_generator()) {
if (pi->has_no_inputs ()) {
_have_internal_generator = true;
break;
}
@@ -1361,7 +1361,7 @@ Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStream
boost::shared_ptr<PluginInsert> pi;
if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) {
if (pi->is_generator()) {
if (pi->has_no_inputs ()) {
_have_internal_generator = true;
break;
}
@@ -1451,7 +1451,7 @@ Route::remove_processors (const ProcessorList& to_be_deleted, ProcessorStreams*
boost::shared_ptr<PluginInsert> pi;
if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) {
if (pi->is_generator()) {
if (pi->has_no_inputs ()) {
_have_internal_generator = true;
break;
}
@@ -2432,7 +2432,7 @@ Route::set_processor_state (const XMLNode& node)
boost::shared_ptr<PluginInsert> pi;
if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) {
if (pi->is_generator()) {
if (pi->has_no_inputs ()) {
_have_internal_generator = true;
break;
}