Parsing Error
-
@Ender It doesn't look like you have a reference to the filter.
Do you save your project before you close it?
-
@d-healey
oh yes, i didn't noticed that. I added that line, but it still shows the error:const var filter = Content.getComponent("MAIN FILTER");
I called the filter "MAIN FILTER".
Yes, i save the project. At least, i do a CTRL+Shift+S to save the xml. I don't know if there's something else to do.
-
@Ender Oh I just noticed you don't have a reference to the combo box either, in which case you probably haven't assigned the control callback to it and are still using processor/parameter ID.
When you reopen your project are you loading the xml?
-
@d-healey
I added a reference to the comboBox, but i don't know how to assigne the control callback you talk about. Here's what i got:const var filter = Content.getComponent("MAIN FILTER"); const var comboBox = Content.getComponent("FilterType"); const var modes = Engine.getFilterModeList(); const var myFilters = [modes.LowPass, modes.HighPass, modes.BandPass]; comboBox.addItem("LowPass"); comboBox.addItem("HighPass"); comboBox.addItem("BandPass"); inline function onComboBoxControl(component, value) { local filterIndex = value - 1; filter.setAttribute(filter.Mode, myFilters[filterIndex]); }
Did i forget anything?
I go to the open recent xml tabe and select my project, which is in the case "3xOSC".
-
@Ender Call
comboBox.setControlCallback(onComboBoxControl);
(remember to remove the processor/parameter ID assignment in the interface designer).I go to the open recent xml tabe and select my project, which is in the case "3xOSC".
Should work.
-
@d-healey
it doesn't seem to work. here's a screenshot. Is the processor ID the underlined parameter? -
it doesn't seem to work.
You've put your code in the on control callback instead of on init.
Is the processor ID the underlined parameter?
Yes, and parameter ID is below it. You need to clear those out so it can use the control callback you've assigned.
-
@d-healey
I now get another error while running the synth: Interface:! Line 16, column 23: Unknown function 'setAttribute'
I also noticed that every filter type is written twice. -
I now get another error while running the synth
You don't have a reference to your filter effect, you have a component reference called
filter
.I also noticed that every filter type is written twice.
Every time you recompile you're script it is running
comboBox.addItem("LowPass"); comboBox.addItem("HighPass"); comboBox.addItem("BandPass");
So you need to clear that out first, otherwise it will just keep adding to the list.
-
@d-healey said in Parsing Error:
You don't have a reference to your filter effect, you have a component reference called
filter
.
How can i add this reference? I thoughtconst var filter = Content.getComponent("MAIN FILTER");
was the way to reference the filter. I'm used to C#, and it worked well there.
-
@Ender
getComponent
is for getting components (UI widgets). You need to get the filter effect. -
@d-healey i tried to reference the filter with this:
const var filter = Synth.addEffect("PolyphonicFilter", "MAIN FILTER", -1);
but i get API call with undefined parameter 1
What should i use for the last parameter in the Synth.addEffect line?
here's my code again,const var filter = Synth.addEffect("PolyphonicFilter", "MAIN FILTER", -1) const var comboBox = Content.getComponent("FilterType"); const var modes = Engine.getFilterModeList(); const var myFilters = [modes.LowPass, modes.HighPass, modes.BandPass]; comboBox.addItem("LowPass"); comboBox.addItem("HighPass"); comboBox.addItem("BandPass"); inline function onComboBoxControl(component, value) { local filterIndex = value - 1; filter.setAttribute(filter.Mode, myFilters[filterIndex]); } comboBox.setControlCallback(onComboBoxControl);
-
@Ender
addEffect
is for adding an effect. You already have the effect in your module tree, so you just need to get a reference to it. Right-click on the filter in the module tree. -
@d-healey did a right-click on the filter in module tree => create generic script reference.
Then i used the line written in the console to replace the filter const var. i still get the same API call error, and the filter type doesn't change at all. here's a screenshot of what i did
-
@Ender Looks like you've changed
local filterIndex = value - 1;
tolocal filterIndex = value;
Also I just checked in the auto-complete in HISE and there is no BandPass constant. Go through the auto-complete list yourself and see if you can find a suitable alternative.
-
@d-healey said in Parsing Error:
I found what was wrong!
put it back tolocal filterIndex = value - 1;
, but the same message came again. i suddenly thought abput the name i gave to the filter module. I changed it and everything worked well! i maybe got the issue because i left a space in "MAIN FILTER".I'm so glad to see this filter behaving like i want it to do so. Thank you so much for your help, i would probably be mad if you didn't answer to my post :)