COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :

Go Back   Cockos Incorporated Forums > Other Software Discussion > WDL users forum

Reply
 
Thread Tools Display Modes
Old 03-25-2019, 01:10 PM   #1
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 396
Default How to update a parameter from Process()?

I would like to export the gain value from a gate plugin so a host can record it as automation data (as a control signal for other tracks, plugins, etc).

1) I have added a parameter to the plugin parameter enum list called "ksidechainsig"

2) I have set up a parameter in the constructor like this: GetParam(ksidechainsig)->InitDouble("Gate signal", 0.5, 0.0, 1.0, .01, "");

3) And I output a data point once per Process call using this: InformHostOfParamChange(ksidechainsig, gategain);


This approach is working great on most hosts but crashes Cakewalk/SONAR. The plugin passes a signal when idle but crashes with "stack overflow" the instant PLAY is initiated (please see attached screenshot from debugger). If I comment out "InformHostOfParamChange()" the plugin works perfectly otherwise.

What is causing this - and why only in Cakewalk? Is it a bug in MY code or in Cakewalk?
Attached Files
File Type: pdf CbB crash.pdf (32.9 KB, 172 views)

Last edited by Nonlinear; 03-25-2019 at 03:00 PM.
Nonlinear is offline   Reply With Quote
Old 03-25-2019, 06:22 PM   #2
olilarkin
Human being with feelings
 
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
Default

calling InformHostOfParamChange on the audio thread is a recipe for disaster.

instead call it on the main thread. you can define USE_IDLE_CALLS at project level to get an Idle() call in VST2. i think that would do it, but you could also make your own timer.
__________________
VirtualCZ | Endless Series | iPlug2 | Linkedin | Facebook
olilarkin is offline   Reply With Quote
Old 03-25-2019, 07:07 PM   #3
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 396
Default

Quote:
Originally Posted by olilarkin View Post
calling InformHostOfParamChange on the audio thread is a recipe for disaster.
Hmm, it works in Reaper, it works in Cubase, it works in Wavelab, it works in VST3 validator - but massively crashes Cakewalk. Why the disaster only in one host?


Quote:
Originally Posted by olilarkin View Post
instead call it on the main thread. you can define USE_IDLE_CALLS at project level to get an Idle() call in VST2. i think that would do it, but you could also make your own timer.
Yes, I have an OnIdle() call working in VST2 version. Now, how to get that same functionality in VST3 and AU? Is there no similar, simple means?

Last edited by Nonlinear; 03-25-2019 at 10:29 PM.
Nonlinear is offline   Reply With Quote
Old 03-26-2019, 06:35 AM   #4
olilarkin
Human being with feelings
 
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
Default

when you say "it works", that means it worked that one time, for you - it doesn't mean it wont fail spectacularly on a users machine or in a real world daw situation.

you have to be extremely careful what you do on the audio thread, and using the method that would usually be for a gui interaction, is gonna cause problems
__________________
VirtualCZ | Endless Series | iPlug2 | Linkedin | Facebook
olilarkin is offline   Reply With Quote
Old 03-26-2019, 08:18 AM   #5
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Just as a sidenote, IPlug really should get a proper timer functionality, so that people don't need to implement their own platform/plugin format specific ones. Even with VST2 one probably can't trust every host will be calling the OnIdle method as expected.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 03-26-2019, 09:48 AM   #6
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 396
Default

Quote:
Originally Posted by Xenakios View Post
Even with VST2 one probably can't trust every host will be calling the OnIdle method as expected.
Funny you posted this - I was just about to add that the "OnIdle()" approach does not work in Reaper. Apparently it doesn't call OnIdle() between Process blocks.

So, what to do in THAT case? How do you update "stuff" outside the audio thread if there is no call to do so?

Last edited by Nonlinear; 03-28-2019 at 06:15 PM.
Nonlinear is offline   Reply With Quote
Old 03-26-2019, 10:39 PM   #7
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by Nonlinear View Post
How do you update "stuff" outside the audio thread if there is no call to do so?
You could try overriding the void IControl::OnGUIIdle() call, but I am not completely sure where you should implement that. (And even then, there's likely no 100% guarantee the calls are really going to happen. )
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios 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 05:47 PM.


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