Different DAWs seem to call OnActivate() and OnReset() at different times so it is not clear to me the purpose of these two functions.
For example, some DAWs call OnActivate() when the plugin is “powered On/Off” while other DAWs call it whenever the transport is started/stopped.
Likewise, some DAWs call OnReset() only when the plugin is first constructed and other DAWs call it any time a change is made in the track (a wave file is loaded, project samplerate change, etc.).
So, is there a distinct purpose for each of these functions or is it as I describe and not consistent across DAWs?
Could you outline which DAWs don’t call OnReset() when you’d expect them to?
From the header of IPlugProcessor:
/** Override OnActivate() which should be called by the API class when a plug-in is "switched on" by the host on a track when the channel count is known.
* This may not work reliably because different hosts have different interpretations of "activate".
* Unlike OnReset() which called when the transport is reset or the sample rate changes OnActivate() is a good place to handle change of I/O connections.
and for OnReset()
/** Override this method in your plug-in class to do something prior to playback etc. (e.g.clear buffers, update internal DSP with the latest sample rate) */
For what it is worth I have never used OnActivate(), and just tend to use OnReset(). I have never seen an example where this wouldn’t be called for changing sample rate or render reset (this is the method where I store sample rate and clear all filters/delay lines), but it can be called and different times (Live calls it when transport stops which I consider incorrect, but it’s been that way for a while). There are two issues here 0- one is when we call these things in relation to different formats (which if something is consistently wrong might be something to investigate) and the other is how hosts interact with plugin formats. Sadly, in my experience that is not consistent, and searching for 100% consistency of behaviour across DAWs is probably unrealistic.
1 Like
Thank you for the reply.
This may not work reliably because different hosts have different interpretations of "activate".
Yes, I have found that some DAWs set “active” true in OnActivate() when others set it false.
For what it is worth I have never used OnActivate()…
I use a lot of FIR filters and delay lines in my plugins that must be flushed whenever the transport is stopped (or resumed). I have found that OnActivate() is the place to do that as it seems OnReset() only gets called in many DAWs when there is a change to the project. I flush my buffers in both places just to be safe.
Sadly, in my experience that is not consistent, and searching for 100% consistency of behaviour across DAWs is probably unrealistic.
Agree and that’s unfortunate. The plugin “specs” seem to be widely interpreted. Some DAWs, like FL Studio, are really bad at it and seem to do things unlike any other DAW. I suspect most DAWs support 3rd party plugins as a “favor” and not as a “must do” and so build their own plugins however they want.
Could you outline which DAWs don’t call OnReset() when you’d expect them to?
Yes, it will take me some time but I will put together a chart showing what DAWs call which of these functions and when. I have about a dozen test DAWs on my system so it will take some time but hopefully I can post back here in the coming week.
BTW - one lesson I have learned is to never call OnReset from anywhere inside your plugin code. Only the DAW should call it. If you need to refresh something on stop/start create your own function for doing that (or use On Activate) and do not call OnReset directly. Calling OnReset from inside the plugin locks up the audio in Cubase/Nuendo. Had it happen more than once until I found out what was causing it.