Changing the filter mode from a ComboBox

  • OK, checked here and in the documentation cant see any thing defining this. I've created a comboBox and linked it to the myFilter.Mode and added a line for every filter type - but whilst it changes the filter type when I use it it seems to do so in a way that is not mapped 1-to-1 with the filter types.

    HiseSnippet 1120.3oc2X8rbaSDFeUr2NwBnSZoSG3lNvgxLvLQP3O2picra7fchhUZfac1H8Y6cxpcUWsJsFFtyS.O.7lva.yvKRuBWfckjijAgwNyPJo9h2u+o8298u8SxSJBfjDgDY05z4w.x5sw9y4pYcmQnbzfCPVuKtOko.4HQH3CJEkOE0YdLIIABQVVMdhQQqVMQY+d0i6PXDd.TxBgNSPCfgzHppjqW6uhxX8IgvoznJZuW6AABdWASjpAUC7tnXRvEjovQDiZagQV2oWHUIj9JhBRPVM6HBm6OS7Bdt9mQSnmy.CgKxW+fxY2WvBMH1rF0cFkE5s3vmfPVXuRWQibWwCvingzq3W5R1ISfSoEU8GVasJ34VEd6VK7bqAdnJnqYN5zfPDlxHpkQlIbTHfJ3KgrAbEvSnp4UCWuVg68vdTUvr5w6V0fWcf5+Z7VD7eGbuISf.UIXah6+M2rQ56lCk2B6S4PVYYFPdXFsyWStDbdBvAowo5thhxeYcKJiW6hxiCT5s+TIgmDKRV5A6CQzSEbiGoj4SSf9R34iMQ4p76JHxZE8pG2WeHq0FehJUlktrejHkqVJ8nwZGSp1bX4plJ5WSmhluF5TrAMxr960d2C6GHowpRI4M1y4Vhtkygxkhr9Q7jTdfwu3H3GITvw7G8g1emcK6u29uJYxj5D0UvURAiAx5jZR0jqvrGwSiNGjejykDVJrPO8gaYum8548z4w5tJpJJJ3C3T0wwvUz4GxEb1Ec0gqJqxCUUtYGlZTqjUMk7cywjI3UntVUUQay7vPWQz4hNhWhnglFBKHcQYNkxJfsaid5fCHJxhGl94p2qXPpnFuj0Avk55977hV3CfjKTh3Lcih0EslposWys9kkaqa6JMo2ocDQKCasilfpfH899SXWGOACbF5YWr5POa+y5aXX9qfR6nClkspim89LlIczdjPL0nWG5ySIgUVcXEdNigu0dn3EN9y.1DmdmXeHc5rRJOfbg4+gjvPP5r2BzLVOPiit1GEuHjLHz3Zxm5wUO9gTO4gdog8cL2hA2fWG2X8tS4eoOPqEXzmFEyfd7KAlNmHCi2WmDLgjxTK3tbWfQBtHdlfSCp1lcLnjzoSAYUrW6AZekRO+VImGzdLv.R0qL9f1C0s5IYSXdM8EtquuXUwq2CmCWGSYryaFiQ03MnwntlWCVj9eertleddxbd0cFfJK0+mmfBgLShjB7fRu3O7qsOoZJvxoua29jTBqhW+2+M5O2gFKXD4ZEQt9Y6MWyzlGhu5PcaJW2DYt8f22GWDzcLN6aO39t3S9e.XGKRMevgQD80MlQJNJMxW+NHAfFnbNvRLiYrkYDpb5cMz4uDBOLi3Oz+JD5ZnsJD5tP3MxdDQBjhmEjObmoFc6LN5yMO6yZzBOxP6b07bFeSj9UGdVPfok4Gq8N0awmrwV7oarE6swV7YarEe9FawWrwV7kqvBy6osepRDkmuqY30KaNZKqdbhNyMK0G8mltdFF.

  • 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"?

  • @Lindon

    Ok well I found this:

    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>);

    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 -

  • @Christoph-Hart It seems the getFilterModeList() function isn't working properly

    This gives a no iterable type error.

    const var indexes = Engine.getFilterModeList();
    for (k in indexes)

  • 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)    
       else (Button1 == 1)  
    const var Filter1 = Synth.getEffect("Filter1");

    For now button switch with Biquad LP & Biquad HP (no Biquad LP Rez)

Log in to reply