<?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[Dynamically adding Curve EQ with Effect Slot Save Preset Problem.]]></title><description><![CDATA[<p dir="auto">Hello!</p>
<p dir="auto">I'm having an issue with, adding and removing dynamically the Curve EQ using the Effect Slot processor.</p>
<p dir="auto">I think my problem is in this function. -&gt;</p>
<pre><code>inline function oncmbFxControl(component, value)
{
	local index = cmbFxSlot.indexOf(component);
	local fxType = cmbFxSlot[index].getItemText();
	
	if (fxType == "Empty")
	    fxSlot[index].setEffect("EmptyFX");
	else
	    fxSlot[index].setEffect(fxType);
	    
    btnShowPanel[index].setValue(1);
	btnShowPanel[index].changed();
		
	if (fxType == "CurveEq")
	{
		local tileData = {
			"Type": "DraggableFilterPanel",
			"ProcessorId": "fx"+index+"_CurveEq",
			"Index": -1
		};
		
		//Console.print(index);
		showFltFxEq(index);
		
		fltFxEq[index].setContentData(tileData);
	    Engine.addModuleStateToUserPreset("fx"+index+"_CurveEq");
	}	
};
</code></pre>
<p dir="auto">I think the problem is here -&gt;</p>
<pre><code>Engine.addModuleStateToUserPreset("fx"+index+"_CurveEq");
</code></pre>
<p dir="auto">When I save a preset with a CurveEQ it works. If I change the combobox to Empty and Save Preset then I get a crash.</p>
<pre><code>Exception thrown: read access violation.
p was nullptr.

</code></pre>
<pre><code>juce::ValueTree UserPresetHelpers::createModuleStateTree(ModulatorSynthChain* chain)
{
	ValueTree modules("Modules");

	if (auto sp = JavascriptMidiProcessor::getFirstInterfaceScriptProcessor(chain-&gt;getMainController()))
	{
		for (auto id : sp-&gt;getListOfModuleIds())
		{
			auto p = ProcessorHelpers::getFirstProcessorWithName(chain, id);
			auto mTree = p-&gt;exportAsValueTree();

			mTree.removeChild(mTree.getChildWithName("EditorStates"), nullptr);
			mTree.removeChild(mTree.getChildWithName("EditorStates"), nullptr);

			modules.addChild(mTree, -1, nullptr);
	
		}
	}

	return modules;
}
</code></pre>
<p dir="auto">So I tried this in the source code -&gt;</p>
<pre><code>juce::ValueTree UserPresetHelpers::createModuleStateTree(ModulatorSynthChain* chain)
{
	ValueTree modules("Modules");

	if (auto sp = JavascriptMidiProcessor::getFirstInterfaceScriptProcessor(chain-&gt;getMainController()))
	{
		for (auto id : sp-&gt;getListOfModuleIds())
		{
			
			auto p = ProcessorHelpers::getFirstProcessorWithName(chain, id);
			

			if (p != nullptr)
			{
				auto mTree = p-&gt;exportAsValueTree();

				mTree.removeChild(mTree.getChildWithName("EditorStates"), nullptr);
				mTree.removeChild(mTree.getChildWithName("EditorStates"), nullptr);

				modules.addChild(mTree, -1, nullptr);
			}
	
		}
	}
</code></pre>
<p dir="auto">Hise is not crashing anymore but I think my fix breaks it in some other way.</p>
<p dir="auto">IN CONCLUSION (lol)</p>
<p dir="auto">I think this nullptr problem is caused by .<strong>addModuleStateToUserPreset</strong> once I Save my combobox with Empty after setting it to CurveEq. I don't have this problem with other FX.</p>
<p dir="auto">Is there a way to remove addModuleStateToUserPreset - removeModuleStateToUserPreset or something similar? Maybe this will solve my problem.</p>
<p dir="auto">Cheers!</p>
]]></description><link>https://forum.hise.audio/topic/4748/dynamically-adding-curve-eq-with-effect-slot-save-preset-problem</link><generator>RSS for Node</generator><lastBuildDate>Fri, 14 Aug 2026 09:11:06 GMT</lastBuildDate><atom:link href="https://forum.hise.audio/topic/4748.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 27 Sep 2021 18:21:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Dynamically adding Curve EQ with Effect Slot Save Preset Problem. on Thu, 30 Sep 2021 17:39:08 GMT]]></title><description><![CDATA[<p dir="auto">UPDATE with</p>
<pre><code>juce::ValueTree UserPresetHelpers::createModuleStateTree(ModulatorSynthChain* chain)
{
   ValueTree modules("Modules");

   if (auto sp = JavascriptMidiProcessor::getFirstInterfaceScriptProcessor(chain-&gt;getMainController()))
   {
   	for (auto id : sp-&gt;getListOfModuleIds())
   	{
   		
   		auto p = ProcessorHelpers::getFirstProcessorWithName(chain, id);
   		

   		if (p != nullptr)
   		{
   			auto mTree = p-&gt;exportAsValueTree();

   			mTree.removeChild(mTree.getChildWithName("EditorStates"), nullptr);
   			mTree.removeChild(mTree.getChildWithName("EditorStates"), nullptr);

   			modules.addChild(mTree, -1, nullptr);
   		}
   
   	}
   }
</code></pre>
<p dir="auto">It does work! But I need to click twice to recall the CurveEq values if coming from Empty Slot or other FX. If I'm already on a CureveEq then it loads on first attempt  -&gt;</p>
<p dir="auto"><img src="https://i.imgur.com/5N3KuNS.gif" alt="glitch.gif" class=" img-fluid img-markdown" /></p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/1">@Christoph-Hart</a></p>
]]></description><link>https://forum.hise.audio/post/41645</link><guid isPermaLink="true">https://forum.hise.audio/post/41645</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Thu, 30 Sep 2021 17:39:08 GMT</pubDate></item></channel></rss>