Get name of attribute

  • Method:

    Synth.getAttribute(int attributeIndex)

    Returns the current value of the given attribute index, but i'm looking for a way to get the name of the attribute. How do i accomplish this, i can't find any method (like getAttributeName(int attributeIndex)) that does this.

    Ps. Logically, given the name i would expect that getAttribute() returns an object containing both the attributes name and it's value. 🙂

  • @bastiaan Don't think of HISE script as OO 😛 Very few functions return objects (at least in the form they would be in javascript). What are you trying to achieve?

  • I'm trying to get a list of all available attributes from a processor (in this case a waveform generator). Trying to build a custom user control that dynamically builds up a display of all available configuration parameters. So it would be nice if i could query a processor and tell it to give me all its attributes with name and current value. 🙂

    So in an ideal world i would like to be able to do something like this:

    var attributeCount = WaveformGenerator1.getNumAttributes();
    for(var attributeIndex=0; attributeIndex < attributeCount; attributeIndex++){
        Console.print("Name: " + WaveformGenerator1.getAttributeName(attributeIndex));
        Console.print("Value: " + WaveformGenerator1.getAttribute(attributeIndex));

    But, as i don't have a way to get the attribute name, i run the following code:

    var attributeCount = WaveformGenerator1.getNumAttributes();
    for(var attributeIndex=0; attributeIndex < attributeCount; attributeIndex++){

    And it outputs:

    Interface: 0.25
    Interface: 0
    Interface: 256
    Interface: 20
    Interface: 5
    Interface: 2
    Interface: 0
    Interface: 0
    Interface: 0
    Interface: 3
    Interface: 0
    Interface: 0
    Interface: 0.5
    Interface: 1
    Interface: 0.5
    Interface: 0.5

    So getNumAttributes() return 16, and as you can see i can get the values of all 16 attributes. But which parameter index is which knob in the UI? I have been able to get this list of parameters from the Waveform Generator C++ source:


    But those are only 12 parameters, and i found out that the first parameter in this list is Index 4 in the list of Attributes which i see in Javascript. So what are those 4 preceding attributes? That's why i think a method like getAttributeName(int attributeIndex) that returns something like "OctaveTranspose1" would be very handy 🙂

    Ps. sorry for my noobish questions, second day of HISE programming 😉

  • There is supposed to be a parameter list when you right click a module in the module browser but it hasn't worked for quite a while now.

    Parameters 0-2 are probably the bypass button, intensity value, and pan. I'm not sure what parameter 3 would be though...

  • Cool! Learned something new, i wasn't aware of the module browser. In my build it seem to work 😎

    So this will at least solve my question about which attribute index is what. Still i would love to have a method which can be used to get these names programmatically 😉 I hate magic numbers in my code.

    0_1540559794312_Screenshot 2018-10-26 at 15.14.29.png

  • @bastiaan Oh you can do that. It might be documented somewhere, I can't remember. @Christoph-Hart will be able to give us the proper info but you can do something like waveformGenerator.Gain to get 0 and waveformGenerator.Balance to get 1 etc.

  • Yes the parameter indexes are constant properties of each module object. The autocomplete popup is your best friend in this case.

Log in to reply