What should I do to add a plugin through a script and modify the properties on the plugin?

I am currently researching how to add plugins through scripts, and I have found the following plugins available through studio.project.findAvailablePlugins:
Resolution Audio Listener
Resolution Audio Soundfield
Resolution Audio Source
McDSP ML1 Limited
AudioGaming AudioMotors
AudioGaming AudioRain
AudioGaming AudioWeather
AudioGaming AudioWind
But I made an error by adding it in the following way, did I understand it wrong
Var event=studio.window.browserCurrent();
Var plugin=studio.project.workspace.createPlugin (“Resolution Audio Source”);
Var ef=event.masterTrack.mixerGroup.effectChain.addEffect (plugin);
What should I do to add a plugin through a script and modify the properties on the plugin? Thank you.


There seem to be two issue with the code you’ve provided - the plugin is “Resonance Audio Source” and not “Resolution Audio Source”, and PluginEffects cannot be added to effect chains with addEffect(), only preset effects can be. The latter of these seems like a bug, so I’ve passed it along to the development team for further investigation.

That said, you can work around this by setting the owner of the plugin to be the effect Chain:

var event = studio.window.browserCurrent();
var pluginEffect = studio.project.workspace.createPlugin("Resonance Audio Source");
pluginEffect.owner = event.masterTrack.mixerGroup.effectChain;

Plugin properties are stored in the pluginParameters array belonging to the child plugin object. For example, the first parameter of a Resonance Audio Source plugin effect, Gain, can be accessed and set as follows:

console.log(pluginEffect.plugin.pluginParameters[0].name); // "Gain"
pluginEffect.plugin.pluginParameters[0].value = -30;