diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-05-12 00:16:16 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-05-12 00:16:16 +0000 |
commit | e22f93407b01faddc09c736f1a5205e591a462ea (patch) | |
tree | 29ceb736d40cdefab2e537af0ae8cd9199a363f1 | |
parent | 3ae786bb06c58eee8dcef2b63a1bc871daf6a7ff (diff) |
make instruments/generators do the right thing when bypassed
git-svn-id: svn://localhost/ardour2/branches/3.0@9498 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | libs/ardour/plugin_insert.cc | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index de6896bb31..48ffb9bf0c 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -413,21 +413,38 @@ PluginInsert::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end } else { - /* FIXME: type, audio only */ + if (is_generator()) { - uint32_t in = _plugins[0]->get_info()->n_inputs.n_audio(); - uint32_t out = _plugins[0]->get_info()->n_outputs.n_audio(); + /* silence all (audio) outputs. Should really declick + * at the transitions of "active" + */ - if (out > in) { + uint32_t out = _plugins[0]->get_info()->n_outputs.n_audio(); - /* not active, but something has make up for any channel count increase */ + for (uint32_t n = 0; n < out; ++n) { + bufs.get_audio (n).silence (nframes); + } + + bufs.count().set_audio (out); + + } else { - for (uint32_t n = out - in; n < out; ++n) { - memcpy (bufs.get_audio(n).data(), bufs.get_audio(in - 1).data(), sizeof (Sample) * nframes); + /* does this need to be done with MIDI? it appears not */ + + uint32_t in = _plugins[0]->get_info()->n_inputs.n_audio(); + uint32_t out = _plugins[0]->get_info()->n_outputs.n_audio(); + + if (out > in) { + + /* not active, but something has make up for any channel count increase */ + + for (uint32_t n = out - in; n < out; ++n) { + memcpy (bufs.get_audio(n).data(), bufs.get_audio(in - 1).data(), sizeof (Sample) * nframes); + } } + + bufs.count().set_audio (out); } - - bufs.count().set_audio(out); } _active = _pending_active; |