Combobox attachement produces evenly spaced float values

I’m using the ComboboxAttachement class as proposed in the tutorial. But they always return evenly spaced audio parameters:

Let’s say I set up a Combobox to return the values 1,2 and 1000. The connected float audioparameter will still give me the values 0.f, 0.5f and 1.f for these three. What’s the point in setting them up to have special values if they are ignored here (for audio parameter use anyway)?

I could live with this, but I want to keep the ability to add items to sub-menus later on without messing with the ordering (i.e. all normal wavetables are 1xxx, all additive tables are 2xxx etc.)

So am I using the whole thing incorrectly? There’s always the option to write a manual connection which preserves order, but I was wondering.

Thanks in advance!

The AudioParameterChoice and the ComboBox attachment just deal with contiguous integer values. The ComboBox item ids are not used for anything. (They still need to be increasing ids starting from 1, though.) If you need something more advanced, you will likely have to use AudioParameterInt and a custom ComboBox attachment.

1 Like

Be aware, that in the host the automated value will be stored as a normalised float eventually. So if you change the number of choices, or the range of your int, your data will ultimately no longer line up with stored sessions.

Variant a) would be to use the value not automised. You can add those values simply to the public ValueTree of the AudioProcessorValueTreeState, so it is saved and restored.

The second variant is, to save the maximum number of choices alongside, and have a migration step, that converts the value, if the max value doesn’t line up.