<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to retrieve settings from ScriptFX in onInit when the plugin starts?]]></title><description><![CDATA[<p dir="auto">Hi everyone,</p>
<p dir="auto">I've built an FX plugin with a “realtime” and a “long latency” option (Lookahead off/on), which means I can switch between them with a button, and depending on the setting, a different latency is sent to the DAW via <code>Engine.setLatencySamples</code>. That works fine. The default setting is “realtime”.</p>
<p dir="auto">Now, if I change a few plugin parameters in the DAW and activate the “latency” mode, save the project, close it, and then reopen it, all plugin parameters load correctly (including the status of the latency button), BUT I can’t access the correct status of the button in the 'onInit' script to send the correct latency to the DAW when loading. This means the plugin always sends the “realtime” latency first, even though “long latency” mode is actually enabled. I’ve already tried using a timer to delay the query, but that doesn’t work either (though the query for the current sample rate does work there):</p>
<pre><code>const var to = Engine.createTimerObject();
var timerStop = 0;

to.setTimerCallback(function()
{
	if (!timerStop) {
		getSamplerate(); //Samlplerate request function works
		if(ScriptFX.getAttribute(ScriptFX.Lookahead)&gt;0) { // THIS DOESNT WORK, but why?
			Engine.setLatencySamples(lookaheadSmpl);
		}
		timerStop = timerStop+1;
	} else {
		to.stopTimer();
	}
});

to.startTimer(400);
</code></pre>
<p dir="auto">Has anyone an idea? :)</p>
]]></description><link>https://forum.hise.audio/topic/14734/how-to-retrieve-settings-from-scriptfx-in-oninit-when-the-plugin-starts</link><generator>RSS for Node</generator><lastBuildDate>Tue, 12 May 2026 14:01:22 GMT</lastBuildDate><atom:link href="https://forum.hise.audio/topic/14734.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 12 May 2026 10:51:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to retrieve settings from ScriptFX in onInit when the plugin starts? on Tue, 12 May 2026 11:16:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/12">@David-Healey</a> Ah very nice, thank you! I will give that a try!</p>
]]></description><link>https://forum.hise.audio/post/120264</link><guid isPermaLink="true">https://forum.hise.audio/post/120264</guid><dc:creator><![CDATA[jojojojonas]]></dc:creator><pubDate>Tue, 12 May 2026 11:16:25 GMT</pubDate></item><item><title><![CDATA[Reply to How to retrieve settings from ScriptFX in onInit when the plugin starts? on Tue, 12 May 2026 10:57:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/3955">@jojojojonas</a> If the controls are set to save in preset then anything you do in <code>on init</code> will be overwriten when the control callback triggers.</p>
<p dir="auto">Use the technique described here (in the snippet) for responding to a DAW session load.</p>
<p dir="auto"><a href="https://docs.hise.dev/tutorials/all/index.html#dynamic-plugin-parameters" rel="nofollow ugc">https://docs.hise.dev/tutorials/all/index.html#dynamic-plugin-parameters</a></p>
]]></description><link>https://forum.hise.audio/post/120261</link><guid isPermaLink="true">https://forum.hise.audio/post/120261</guid><dc:creator><![CDATA[David Healey]]></dc:creator><pubDate>Tue, 12 May 2026 10:57:14 GMT</pubDate></item></channel></rss>