Impulse Response File switching?
-
@RastaChess This is how I'm doing it in Sordina - https://github.com/davidhealey/sordina/blob/master/Scripts/ScriptProcessors/sordina/Interface.js#L131
-
@d-healey Thank you, I'll try to figure it out from your example. :anxious_face_with_sweat:
-
@d-healey Hi! I would post a new topic but I can't because the forum has gone weird.
Anyway the title would have been: Impulse Responses list in ComboBox different in compiled plug-in
So I have a load of impulse responses loaded into a Convolution Reverb module, and a ComboBox for the user to select the one they want. In the project the list is alphabetical but in the exported plugin one of the entries (Fender Twin) has jumped to the top of the list. Here's my code and images below... Any help much appreciated!
//Combo box IRs const irs = Engine.loadAudioFilesIntoPool(); const CabinetType = Synth.getAudioSampleProcessor("Cabinet Type"); //cmbIr const cmbIr = Content.getComponent("cmbIr"); inline function oncmbIrControl(component, value) { if (value > 0) CabinetType.setFile(irs[value - 1]); }; Content.getComponent("cmbIr").setControlCallback(oncmbIrControl); cmbIr.set("items", ""); for (x in irs) cmbIr.addItem(x.replace("{PROJECT_FOLDER}cabs/").replace(".wav"));
Images:
in Plug-In -
in Hise -
-
@DanH What happens if you sort the list of IRs first?
-
-
@DanH I think so... I can't remember if that only works for numbers - I made a video about it a while back. There is also sortNatural. Test and see.
-
@d-healey .sort() = no joy. Will try natural.
-
@d.healey no joy there either. It's strange - this is a v2 of a project. v1 didn't have this issue yet the code is identical... Same version of Hise too...
I wonder if LAF changes to the combobox itself have made a difference?!
Is there a way to force the list settings? i.e create the list as I want it?
-
@DanH said in Impulse Response File switching?:
create the list as I want it?
You could add the items one by one with
myComboBox.addItem()
-
@d-healey thanks, I've renamed the actual file numerically so I'll see if that helps first!
-
@Christoph-Hart So I'm tentatively going to say that this could be a bug with the Default user Preset system and - in this case - Engine.loadAudioFilesIntoPool / ComboBox callback...
I've loaded some impulse responses into the convolution reverb module using Engine.loadAudioFilesIntoPool and used a combobox to select them. All is fine within HISE and Exported Plug-In.
However, when I set a specific preset as the Default User Preset in the project settings then whatever value that preset has saved in it for the combobox, it will reorder the array of impulse responses with that saved value at the top of the list. In HISE everything is ok - this only affects the exported plugin / standalone.
I tested the Default User Preset setting with different presets and changed the combobox value in those the presets and each time the combobox list would change to reflect this buggy order of putting the Default preset's value at the top of the combobox list.
So if the ComboBox list is A, B, C, and the Default User Preset has B saved in it, then when you export the plugin the list will now appear as B, A, C.
-
@DanH Are you populating the combobox with the list returned from
loadAudioSamplesIntoPool()
? Because then it might cause a switch in order because the item that's loaded in the default user preset is being loaded before this call.Try sorting the array before passing It to
ComboBox.set("items", list.join("\n"))
in your onInit. -
@Christoph-Hart Ah that would explain it! Ok will try, thanks!