Custom te::Plugin and latency

I’m having some trouble getting the latency compensation right for a custom plugin I’ve made inheriting from tracktion::engine::Plugin. My plugin is doing some resampling, which introduces some latency (~5 samples) and I’m reporting this to the engine by overriding the getLatencySeconds().
It seems though, that it only works when the plugin is enabled.
I’m testing the latency out by playing back the same audio clip on two tracks - one with the plugin and one without to see if they’re in sync.
When the plugin is bypassed, one track will be slightly later than the other resulting in something like a low-pass.
If enabled, it sounds the same as when I remove the plugin. I have dry/wet parameters and the plugin is just playing back the dry input delayed by the same amount reported by getLatencySeconds().

Furthermore, when I do the same with the built in PitchShiftPlugin (using SoundTouch), I get the same behaviour. When plugin is bypassed the track without the plugin is very audibly delayed. (Latency is 8192 samples).

When bypassed, shouldn’t the engine ensure that the plugin is still delayed by getLatencySeconds()?

I’m using the latest commit on develop. For now, I’ve only tested on Windows - not sure if that makes a difference.

I think there might be a logic error on line 95 of tracktion_PluginNode.cpp. If you change

if (canProcessBypassed)


if (! canProcessBypassed)

Does it work then?

I’ll need to think about this carefully as ExternalPlugins can sometimes apply their own latency when bypassed but sometimes they don’t. I can’t remember what I ended up deciding in the past but the current logic doesn’t look consistent with that.

Yes, that works!

Ok, let me have a think about revising that logic. Just need to remember how it interplays with external plugins again…

Yes, of course, I see the pickle. Thanks!