Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 07-27-2022, 04:53 AM   #1
Ehs
Human being with feelings
 
Ehs's Avatar
 
Join Date: Sep 2014
Location: cheltenham, uk
Posts: 24
Default Missing call to initialise VST3 plugin for Take FX causes latency issues (FIXED)

Issue:
When using action - Item: Glue items, ignoring time selection, Reaper does not initialise the plugins. Plugins with Latency will either cause injected silence or discard samples.

This is particularly troublesome for our users working on game audio using Reaper.

Repro steps:
+Add a short sample with a quick onset as an sample item.
+action - Item: Show FX chain for item take
+Add a plugin that has a variable latency (pm me if you need something, I am using UrsaDSP Boost VST3 beta 1.5.9)
- This will call initialize() and setupProcessing() and then setActive() twice all of which filter through to juce::AudioProcessor:repareToPlay() which is good as this can set the latency.

+Change the plugin latency - in Boost just make the attack / lookahead longer e.g. 40ms
+action - Item: Glue items, ignoring time selection
- this does NOT re-init the plugin. The plugin then adjusts the latency during IAudioProcessorrocess and Reaper ends up injecting samples.

I have a feeling that the above might be intermittent*. If it works as expected (without the bug) then follow these additional steps.

+action - Edit:undo (revert the glue and bring back the take FX chain)
+Change the plugin latency from long to short - in Boost just make the attack the other extreme e.g. toggle 40ms <-> 2ms
+action - Item: Glue items, ignoring time selection

+Repeat from undo if required.

---

Possible solutions:
Please either re-init the plugin before action - Item: Glue items.
OR
It might offer better plugin compatibilty to process a blank block (after the parameters are updated) to allow plugins that only set latency in the process method to stabilize ahead of glueing the item.
*I suspect you are already doing this, however that blank block is not sent in some cases (after the action - Edit:undo)


Thanks for a great DAW and thanks especially for not being one of the DAWs that tries to forbid debugging!

Dave
__________________
Owner at UrsaDSP
https://ursadsp.com/
https://deviousmachines.com/boost/
Ehs is offline   Reply With Quote
Old 07-27-2022, 05:11 AM   #2
Ehs
Human being with feelings
 
Ehs's Avatar
 
Join Date: Sep 2014
Location: cheltenham, uk
Posts: 24
Default

Issue in action: https://www.youtube.com/watch?v=FWzqeaqEaNo
__________________
Owner at UrsaDSP
https://ursadsp.com/
https://deviousmachines.com/boost/
Ehs is offline   Reply With Quote
Old 07-27-2022, 11:07 AM   #3
ArchimonDe
Human being with feelings
 
Join Date: Jul 2021
Posts: 4
Default [6.64] missing call to initialise VST3 plugin for Take FX causes latency issues

I can confirm this bug on my side.
ArchimonDe is offline   Reply With Quote
Old 08-16-2022, 02:06 AM   #4
Ehs
Human being with feelings
 
Ehs's Avatar
 
Join Date: Sep 2014
Location: cheltenham, uk
Posts: 24
Default

I have retested, the issue is still present in 6.65 and 6.66rc1

Please let me know if you need additional information or repro steps.

Thanks,
Dave
__________________
Owner at UrsaDSP
https://ursadsp.com/
https://deviousmachines.com/boost/
Ehs is offline   Reply With Quote
Old 08-16-2022, 04:09 AM   #5
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 14,806
Default

If you press the [+] button at the top of the plugin UI, under compatibility settings, is "hard reset on playback start" enabled? If enabled, the plugin should receive setupProcessing(), etc. If disabled (default), then playback start only triggers stopProcessing/startProcessing in order to flush buffers. Does it handle your issue to enable hard reset for these plugins?
schwa is offline   Reply With Quote
Old 08-18-2022, 03:27 AM   #6
Ehs
Human being with feelings
 
Ehs's Avatar
 
Join Date: Sep 2014
Location: cheltenham, uk
Posts: 24
Default

Quote:
Originally Posted by schwa View Post
If you press the [+] button at the top of the plugin UI, under compatibility settings, is "hard reset on playback start" enabled? If enabled, the plugin should receive setupProcessing(), etc. If disabled (default), then playback start only triggers stopProcessing/startProcessing in order to flush buffers. Does it handle your issue to enable hard reset for these plugins?
Hi,
Thanks for the suggestion, but unfortunately that doesn't change the behaviour.

Note that on playback (or on render) this works as expected - Reaper calls prepare to play (regardless of wheter that option is ticked) and, I think it also processes a block of silence with the updated parameters to allow the plugin to update latency.

It is only when glueing an item that has item FX that the issue occurs. The plugin changes latency in response to the users' parameter changes during the first block and I'm assuming that the PDC does not cope with this as there is either silence or missing samples where that first block should have been.

Thanks,
Dave
__________________
Owner at UrsaDSP
https://ursadsp.com/
https://deviousmachines.com/boost/
Ehs is offline   Reply With Quote
Old 08-18-2022, 04:36 AM   #7
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 14,806
Default

I've looked into this more and I think this is something the plugin needs to handle differently. At present, when the user does something on the UI that changes the latency, the plugin does not call IComponentHandler:: restartComponent(kLatencyChanged) until *during* the next call to IAudioProcessor:: process(). Even if I add a call to IAudioProcessor:: getLatencySamples() immediately after IAudioProcessor:: setActive(), the new value is not returned.

This means that the host is not informed of the latency change until after the first buffer block has been sent to the plugin. I think this happens in all FX contexts, but it's not necessarily noticeable in a track FX context, because the plugin is processing constantly.

The only way I can think of for the host to handle this is to always assume the latency may have changed before every call to process(), which shouldn't be necessary because kLatencyChanged does exist. But as a worst case backstop, we could possibly add that check when the user has enabled buggy plugin compatibility mode for the plugin.

But the correct fix I think is for the plugin to send the kLatencyChanged notification before processing starts. I would guess the reason this plugin waits is that it wants to send the notification from the audio thread, but if playback is stopped, there's no reason not to send the notification from the main thread.
schwa is offline   Reply With Quote
Old 08-18-2022, 08:43 AM   #8
Ehs
Human being with feelings
 
Ehs's Avatar
 
Join Date: Sep 2014
Location: cheltenham, uk
Posts: 24
Default

Fantastic info, thankyou for looking into this.

In response to the original user's bug report I modified the plugin to set latency in the initial prepareToPlay method (which I believe corresponds to IAudioProcessor:: setActive())

You can get that beta (v1.5.9) here: https://deviousmachines.com/boost-downloads/

Note that I do not believe the JUCE framework guarantees that parameters are updated / available until AudioProcessor:rocessBlock (https://docs.juce.com/master/classAu...c4bc97326dcb58 e.g. IAudioProcessor:: process()) is called.

This presents a bit of a conundrum as I (and I'd bet a fair few other plugins that use lookahead) cannot set the latency until they know what lookahead the user's parameters require.

Let me know if that doesn't make sense,
Dave
__________________
Owner at UrsaDSP
https://ursadsp.com/
https://deviousmachines.com/boost/
Ehs is offline   Reply With Quote
Old 08-18-2022, 10:44 AM   #9
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 14,806
Default

You might want to ping @reuk here or post an issue over on the JUCE github to see if there's an already established way to do what you need to do.
schwa is offline   Reply With Quote
Old 08-19-2022, 06:22 AM   #10
Ehs
Human being with feelings
 
Ehs's Avatar
 
Join Date: Sep 2014
Location: cheltenham, uk
Posts: 24
Default

It would be super helpful if Reaper could either:
1. call IAudioProcessor:: setActive() prior to glueing item fx (especially if 'hard reset on playback start' was ticked). This is something that Boost 1.5.9 now caters for as per my previous message.
or
2. push a blank block through the plugin chain prior to rendering it, which is something I think reaper does when playback starts?

I'll definitely chase up the conundrum side of things with the JUCE team, but I'm not sure if they will change in future versions of JUCE, nor would it affect all the plugins that are already out there.

HTH,
Dave
__________________
Owner at UrsaDSP
https://ursadsp.com/
https://deviousmachines.com/boost/
Ehs is offline   Reply With Quote
Old 09-13-2022, 04:10 AM   #11
Ehs
Human being with feelings
 
Ehs's Avatar
 
Join Date: Sep 2014
Location: cheltenham, uk
Posts: 24
Default

Hi,

I've checked this in v6.67 and “Hard reset on playback start” now works when Glueing items with take FX.

This option with Boost 1.5.9 which is available as a beta release solves the problems of our users.

Thanks for your help with this,
Dave @ UrsaDSP
__________________
Owner at UrsaDSP
https://ursadsp.com/
https://deviousmachines.com/boost/
Ehs is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:57 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.