Plug'n'Script Bug?

Official support for: bluecataudio.com
Post Reply New Topic
RELATED
PRODUCTS

Post

I have a PnS script in which there is a one-element inputStrings defined. If I put a value in the corresponding screen field and save and close my DAW project (Cubase 8.0) and reload the project, the value previously placed in the field is shown on the screen. All well and good - just the way I would expect things to work.

However, if I read that field (assign it to a string and print that string) when in initialize(), inputStrings[0] appears to be empty. If I access the valud of inputStrings[0] again in the first invocation of updateInputParametersForBlock, the value shown on the screen is returned as expected.

Am I doing something wrong or is this not behaving as it should?

Post

The initialize function is called before the actual parameters and strings are created. You can even change the definition of the exposed parameters and strings in it (in case it depends on the number of audio channels or sample rate). So it is expected that the values are not initialized by the audio engine at this stage.

updateInputParametersForBlock or updateInputParameters is the place where input data is set by the audio engine, so that's where you can read the actual state of the variables as set by the GUI or automation.

Can you maybe tell us what you are trying to achieve so that we can help?

Post

Blue Cat Audio wrote:Can you maybe tell us what you are trying to achieve so that we can help?
Simple. I have a plug-in that reads a control file in a specific directory. The file name has a default name that's to be used if none is specified in the UI field. If there is a name given in the override field in the UI, the plug-in needs to read that control file instead. Since the control file governs what happens even in the first call to processBlock, I need to read that file before anything else happens.

I could introduce some trickery to check if the control file hasn't yet been processed when I get to the first process block call, but reading and parsing the control file results in some slightly sluggish processing (like reading several short sample files), so I'd like to keep that out of processBlock where optimal efficiency is desirable.

Does updateInputParametersForBlock get called upon the value being written into an inputStrings slot some time after initialize has been called? I could defer reading and parsing the control file until that point, if so.

Thanks for any suggestions.

Post

updateInputParametersForBlock or updateInputParameters is indeed guaranteed to be called before any block is processed, so that your internal variables are up to date.

Post

Great. Thanks for the assistance. Much appreciated!

Post Reply

Return to “Blue Cat Audio”