Changing the filter mode from a ComboBox
-
This was brought up some months ago. There is a mismatch between the indexes which I believe was caused by new filter types being added and Christoph trying to avoid causing backwards compatibility issues. The current work-around is to do it via a custom callback.
-
@d-healey ok so what are the values I need ot set, and where do I put this "custom callback"?
-
Ok well I found this:
How to control modules with scripts
A scripted interface for your instrument is pretty useless unless it can change the parameters or data of the modules in your patch. Basically there are two ...
Forum (forum.hise.audio)
Which is helpful, in some ways. It tells you how to set a value IF you know what the "magic numbers" are - sadly it is not uncommonly pretty poor at telling you how to find these magic numbers.
oit says this:
"But there is no need for magic numbers, there are several ways to obtain the index:
In the development tools area, there is a searchable list with all modules. You can right click on a module and a popup with all parameter names and their respective index should popup."
but of course the world moved on and there is no "searchable list" that I can find. In tools menus or in the UI...
So for those of you wanting to set the mode of a filter here's the code you will need:
const var yourFilterName= Synth.getEffect("yourFilterName"); inline function onButton1Control(component, value) { //Add your custom logic here... yourFilterName.setAttribute(yourFilterName.Mode, <a magic number>); }; Content.getComponent("Button1").setControlCallback(onButton1Control);
The magic numbers seem to be:
0 = Biquad LP
1 = Biquad HP
2 = Lo Shelf EQ
3 = Hi Shelf EQ
4 = Peak EQ
5 = Biquad LP Rez
6 =SVF LP
7 =SVF HP
8 =Moog LP
9 =1 Pole LP
10 =1 Pole HP
11 = not assigned
12 = SVF Notch
13 = SVF BP
14 = Allpass
15 = Ladder 4 Pole-- who knows where Ring Mod is, anything above 15 seems to be unasigned , anything below 0 crashes HISE -- you were warned.
-
@Lindon Ringmod Filter is 17 ;)
-
@orange thanks mate - I tried 17 and it didnt seem to work - but clearly I didnt cause its working now...
-
const var list = Engine.getFilterModeList();
the object returned from this method contains all filter indexes as constants. You can use it in a combobox in conjunction with an array of string like this:
const var list = Engine.getFilterModeList(); const var myIndexes = [ list.LowPass, list.RingMod, list.Peak ]; const var myNames = ["Fnky VA LopazZ", "Ringmod", "Ultra clean super analog style peak PULTEC Simulation"];
-
Oh I was late getting back to this post tonight. Seems a solution has been provided. For reference though I will include a link to the related thread - https://forum.hise.audio/topic/877/filter-mode-dropdown-bug/6
-
@Christoph-Hart It seems the
getFilterModeList()
function isn't working properlyThis gives a no iterable type error.
const var indexes = Engine.getFilterModeList(); for (k in indexes) { Console.print(k); }
-
The object that is returned from this function is not a standard Javascript object, but a special object with read only properties.
I didn't add iterator support for it because it would defeat the entire purpose of the object which is selecting a few filter types that you want to show. Relying on the order and how many filter types I have added to HISE is the exactly why there is this object :)
-
@Christoph-Hart Ah gotcha, I understand now.
-
i want assign Biquad Lp Rez & Biquad HP mono filter mode on button.
see my code :Content.makeFrontInterface(600, 600); const var list = Engine.getFilterModeList(); const var BqLPR = list.BiquadLpRez; const var BqHP = list.BiquadHp; const var Button1 = Content.addButton("Button1", BqLPR, BqHP); if (Button1 == 0) { Synth.getEffect(BqLPR); } else (Button1 == 1) { Synth.getEffect(BqHP); } const var Filter1 = Synth.getEffect("Filter1");
For now button switch with Biquad LP & Biquad HP (no Biquad LP Rez)