|
03-25-2019, 01:10 PM
|
#1
|
Human being with feelings
Join Date: Apr 2018
Posts: 396
|
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?
Last edited by Nonlinear; 03-25-2019 at 03:00 PM.
|
|
|
03-25-2019, 06:22 PM
|
#2
|
Human being with feelings
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
|
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.
|
|
|
03-25-2019, 07:07 PM
|
#3
|
Human being with feelings
Join Date: Apr 2018
Posts: 396
|
Quote:
Originally Posted by olilarkin
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
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.
|
|
|
03-26-2019, 06:35 AM
|
#4
|
Human being with feelings
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
|
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
|
|
|
03-26-2019, 08:18 AM
|
#5
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
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.
|
|
|
03-26-2019, 09:48 AM
|
#6
|
Human being with feelings
Join Date: Apr 2018
Posts: 396
|
Quote:
Originally Posted by Xenakios
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.
|
|
|
03-26-2019, 10:39 PM
|
#7
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by Nonlinear
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.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 11:34 PM.
|