Multiple instruments, single project or multiple projects?
-
For what do you need the Sampler IDs besides setting the label on the interface?
If its only for displaying the name on the label, it should be doable with JSON:
// onInit reg instrumentData; // in onControl // This will come in from the preset recall value = { "name": "Trombones", "releaseSamplerEnabled": false, // ... }; instrumentData = value; // Activate an additional sampler if needed ReleaseSampler.setBypassed(!instrumentData.releaseSamplerEnabled); // Set the label name mainLabel.set("text", instrumentData.name);
I still think it'll be more cleaner using just one plugin and you can't underestimate the workflow benefits of just having one preset file.
If we're at it: I don't know if you knew this, but you can save the presets as .XML file instead of the binary .hip file format. While it increases loading times a bit (only in HISE, not in the compiled plugin), you'll get a ton of benefits by using a version control system like Git for the XML file and the scripts. It even extracts the scripts from the preset when saving and stores them in local .js files and reassembles them if you reload the plugin.
If you do this right, you'll end up with nice clean commit history that looks like this:
Especially if you are planning to release the library on GitHub as GPL, it would make a hell of a impression if you could actually reconstruct the building process in a nice clean way.
-
This looks too tempting, okay, I'll dig in a bit more and see if I can get on with it :) and the GitHub stuff is an awesome idea
-
What is the ValueTree automationData expecting in the
Content.storeAllControlsAsPreset()
function?Also, I keep getting this message with the latest version when I select a User Preset (even a new one)
-
I think a filename string with (or without) an extension. it will write it in the user presets folder.
You need to use semantic versioning for your project in order to use user presets. The reason is that then you'll be able to bump the patch version number a.b.x without having this popup appear (which is annoying for small bug fixes). If you add new controls, bump the minor version number a.x.c and it will add default values of those new controls when you press OK there.
-
I think I'm misunderstanding something
-
You need a patch version number.
1.0.0
will do :) -
Ah and you don't need to specify the version number in the filename of the preset, it will be stored inside the XML itself (using the current Project Version Number)
-
This is a preset I created in the preset browser not in the script that is causing this popup
-
The preset has probably still the old wrong version
1.0
baked in. You can edit the .preset file (it's just an ordinary XML file) and correct the version number manually.But I'll add a safe check that you have a valid semantic version syntax in your Project Version before creating the first preset to avoid this in the future...
-
Do you mean the .hip preset or the user preset? That might be where I'm getting confused
-
.preset
is the file extension for user presets (=collection of front end interface values). The .hip preset (NOT a preset, poor name, bad decision :) doesn't store the version value (only the Build Version of HISE), because it doesn't need it as it can get that info easily from the Project Setting file, while the.preset
files are supposed to be distributed along with the plugin and don't have that kind of privilege :) -
Ok that's what I thought. Then I'm still confused, thank you for your patience :)
I made a brand new project folder, inserted a script processor, put in one command
Content.makeFrontInterface(600, 250);
compiled it. Then I opened the plugin preview and went to the preset browser, created a preset and then when I try to load that preset by clicking on it I get the version number error. This hasn't happened to me previously. I can make a little video if it helps.Update:
So I opened the preset file in sublime text and the version was set to 0.0. I changed this to 1.0.0. I tried opening it in the preset browser again and I got the same error (it said version 1.0.0 this time though). I click Ok to update it and it resets it back to 0.0. So I think there is a bug here. -
have you set the Project Version at File Setting Project Setting?
-
Aha! mystery solved. Nope I hadn't set that, never have, I will from now on :) thanks again.
-
This is important as it will also show up as version of the compiled app / plugin. I'll add a safe check that requires to set this before exporting.
-
Excellent, that will help newbies like me :p
-
I've got this test project with 2 script processors:
<?xml version="1.0" encoding="UTF-8"?> <Processor Type="SynthChain" ID="Master Chain" Bypassed="0" Gain="1" Balance="0" VoiceLimit="64" KillFadeTime="20" IconColour="0" packageName="" views="32.rk1bzA........JPT.............+Oe7wG+SA...." currentView="-1"> <EditorStates BodyShown="0" Visible="1" Solo="0" InterfaceShown="0"/> <ChildProcessors> <Processor Type="MidiProcessorChain" ID="Midi Processor" Bypassed="0"> <EditorStates BodyShown="1" Visible="1" Solo="0" Folded="0"/> <ChildProcessors> <Processor Type="ScriptProcessor" ID="Script Processor" Bypassed="0" Script="Content.makeFrontInterface(600, 200); const var knob = Content.addKnob("knob", 0, 0);function onNoteOn() { 	 } function onNoteOff() { 	 } function onController() { 	 } function onTimer() { 	 } function onControl(number, value) { 	 } "> <EditorStates BodyShown="1" Visible="1" Solo="0" contentShown="1" onInitOpen="0" onNoteOnOpen="0" onNoteOffOpen="0" onControllerOpen="0" onTimerOpen="0" onControlOpen="0"/> <ChildProcessors/> <Content> <Control type="ScriptSlider" id="knob" value="0.46000001"/> </Content> </Processor> <Processor Type="ScriptProcessor" ID="Script Processor2" Bypassed="0" Script=" const var knob = Content.addKnob("knob1", 0, 0); const button = Content.addButton("Save Preset", 150, 10); //CALLBACKS function onNoteOn() { 	 } function onNoteOff() { 	 } function onController() { 	 } function onTimer() { 	 } function onControl(number, value) { 	if (number == button) 	{ 		Content.storeAllControlsAsPreset("Test Bank/Test Category/Another Test.preset", ""); 	} }"> <EditorStates BodyShown="1" Visible="1" Solo="0" contentShown="1" onInitOpen="1" onNoteOnOpen="0" onNoteOffOpen="0" onControllerOpen="0" onTimerOpen="0" onControlOpen="0"/> <ChildProcessors/> <Content> <Control type="ScriptSlider" id="knob1" value="0"/> <Control type="ScriptButton" id="Save Preset" value="1"/> </Content> </Processor> </ChildProcessors> </Processor> <Processor Type="ModulatorChain" ID="GainModulation" Bypassed="0" Intensity="1"> <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/> <ChildProcessors/> </Processor> <Processor Type="ModulatorChain" ID="PitchModulation" Bypassed="1" Intensity="0"> <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/> <ChildProcessors/> </Processor> <Processor Type="EffectChain" ID="FX" Bypassed="0"> <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/> <ChildProcessors/> </Processor> </ChildProcessors> <RoutingMatrix NumSourceChannels="2" Channel0="0" Send0="-1" Channel1="1" Send1="-1"/> <macro_controls> <macro name="Macro 1" value="0" midi_cc="-1"/> <macro name="Macro 2" value="0" midi_cc="-1"/> <macro name="Macro 3" value="0" midi_cc="-1"/> <macro name="Macro 4" value="0" midi_cc="-1"/> <macro name="Macro 5" value="0" midi_cc="-1"/> <macro name="Macro 6" value="0" midi_cc="-1"/> <macro name="Macro 7" value="0" midi_cc="-1"/> <macro name="Macro 8" value="0" midi_cc="-1"/> </macro_controls> <MidiAutomation/> </Processor>
I've got this preset
<?xml version="1.0" encoding="UTF-8"?> <Preset Version="1.0.0"> <Content Processor="Script Processor2"> <Control type="ScriptSlider" id="knob1" value="0.63"/> <Control type="ScriptButton" id="Save Preset" value="1"/> </Content> <MidiAutomation/> </Preset>
But it doesn't do anything when I load it. It seems presets will only affect script 1 which is set to frontInterface.
-
Yeah, as I said, it just supports one front interface.
Check out this example:
0_1488794377602_Preset Example.zip
The second Script Processor is no front interface. Instead it uses a global object that contains the value for its knob which will be restored by the main interfaces' onControl callback.
This is a little bit complicated at first, but once you understand how it's connected, its a pretty easy procedure.
-
Aha I get it now, thank you! It seems a little awkward though if you have a lot of scripts (like I do) and want to save the state of most of the controls in the preset. Can users overwrite or delete factory presets after the plugin has been compiled?
Edit: Just reread the blog post about these being read-only :)
-
I'm struggling to find an efficient way to organise my preset handling script. I can see this being more suited to smaller instruments.
So I have my woowind .hip file and I'd like the user to be able to change between all of the different woodwind instruments. There will be at least 10 instruments and each one will have 10 or more samplers that will need to have their sample maps swapped as the preset is selected. Each will also need it's key range setting, modulator settings adjusted, and various behind-the-scenes knobs adjusted on scripts.
To hardcode all of this seems a very large task. I could add code to each script so that its values are stored in the userPresetData globals object (although it would be better if HISE did this anyway I think). But I will still have to write all of the sample maps into code, and if I want to add new sample maps I will have to edit the code again. Is there a more generic and automated way to populate the userPresetData object?