The ComboboxAttachment takes the itemId, see here:
So you should be able to add your options in the order you need, just avoid itemId = 0, that is not allowed (i.e. nothing will happen, if you select that one).
However, when reading the source, I wonder, why setValue calls combo.setSelectedItemIndex (roundToInt (newValue), sendNotificationSync);
instead of combo.setSelectedId (roundToInt (newValue), sendNotificationSync);?
@t0m / @jules: was that intentional? maybe I missed something…
But for the first question, as it is stored normalised to 0…1, I’m afraid you will need some kind of migration strategy. Maybe add an information (e.g. version number) to the state, that wasn’t present before and update the numbers in that case.
Yep, the current incarnation of the ComboBoxAttacment is severely restricted because of that strange design as I have noted here:
I needed a more flexible ComboBoxAttachment and so I have created my own version. If you don’t mind using hacked versions of some Juce files You will find that it allows to easily create a Combobox with all the features outlined above.
I have to correct myself. Reconsidering your requirements I found that you would need to write your own custom attachment to enable non incremental ordering of items. This would actually be not a difficult task. I am afraid though the access restrictions implemented in the AudioProcessorValueTreeState class make it impossible to build your own specialized version of the attachment.
You could use my version as a starting point, since here I have given public access to all the required classes.