add new Redirect::flush() model to accomodate plugin models where flush != deactivate+activate (such as AU)

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6633 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2010-02-04 17:15:03 +00:00
parent 5e0d0db54c
commit ecc0e21d44
8 changed files with 24 additions and 7 deletions

View file

@ -79,6 +79,7 @@ class AUPlugin : public ARDOUR::Plugin
uint32_t nth_parameter (uint32_t which, bool& ok) const;
void activate ();
void deactivate ();
void flush ();
void set_block_size (nframes_t nframes);
int connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset);

View file

@ -53,6 +53,7 @@ class Insert : public Redirect
virtual void run (vector<Sample *>& bufs, uint32_t nbufs, nframes_t nframes) = 0;
virtual void activate () {}
virtual void deactivate () {}
virtual void flush () {}
virtual int32_t can_do (int32_t in, int32_t& out) = 0;
virtual int32_t configure_io (int32_t magic, int32_t in, int32_t out) = 0;
@ -114,6 +115,7 @@ class PluginInsert : public Insert
void silence (nframes_t nframes);
void activate ();
void deactivate ();
void flush ();
void set_block_size (nframes_t nframes);

View file

@ -113,6 +113,7 @@ class Plugin : public PBD::StatefulDestructible
virtual uint32_t nth_parameter (uint32_t which, bool& ok) const = 0;
virtual void activate () = 0;
virtual void deactivate () = 0;
virtual void flush () { deactivate(); activate(); }
virtual void set_block_size (nframes_t nframes) = 0;
virtual int connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset) = 0;

View file

@ -73,6 +73,7 @@ class Redirect : public IO
virtual void run (vector<Sample *>& ibufs, uint32_t nbufs, nframes_t nframes) = 0;
virtual void activate () = 0;
virtual void deactivate () = 0;
virtual void flush () = 0;
virtual nframes_t latency() { return 0; }
virtual void set_block_size (nframes_t nframes) {}

View file

@ -45,6 +45,7 @@ class Send : public Redirect
void run (vector<Sample *> &bufs, uint32_t nbufs, nframes_t nframes);
void activate() {}
void deactivate () {}
void flush () {}
void set_metering (bool yn);

View file

@ -804,10 +804,16 @@ AUPlugin::activate ()
void
AUPlugin::deactivate ()
{
unit->GlobalReset ();
unit->Uninitialize ();
initialized = false;
}
void
AUPlugin::flush ()
{
unit->GlobalReset ();
}
void
AUPlugin::set_block_size (nframes_t nframes)
{
@ -822,8 +828,7 @@ AUPlugin::_set_block_size (nframes_t nframes)
OSErr err;
if (initialized) {
unit->Uninitialize ();
initialized = false;
deactivate ();
}
if ((err = unit->SetProperty (kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global,
@ -850,8 +855,7 @@ AUPlugin::configure_io (int32_t in, int32_t out)
if ( (in==input_channels) && (out==output_channels) ) {
return 0;
} else {
unit->Uninitialize ();
initialized = false;
deactivate ();
}
}

View file

@ -275,6 +275,14 @@ PluginInsert::deactivate ()
}
}
void
PluginInsert::flush ()
{
for (vector<boost::shared_ptr<Plugin> >::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
(*i)->flush ();
}
}
void
PluginInsert::connect_and_run (vector<Sample*>& bufs, uint32_t nbufs, nframes_t nframes, nframes_t offset, bool with_auto, nframes_t now)
{

View file

@ -2264,8 +2264,7 @@ Route::handle_transport_stopped (bool abort_ignored, bool did_locate, bool can_f
for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
if (Config->get_plugins_stop_with_transport() && can_flush_redirects) {
(*i)->deactivate ();
(*i)->activate ();
(*i)->flush ();
}
(*i)->transport_stopped (now);