SelectPreset works fine but there are a couple of things you have to be aware of
The SelectPreset applies to something that recognizes presets, in particular you tried to select a preset in the MidiInBlock. You need to be selecting a preset in your VB3 block (presets are not the same as sending program changes via MIDI)
Your synth has to be capable of responding to SelectPreset function. Many synth plugins don’t actually support it. The native instruments FM8 is an example of a synth that DOES support it and so the following code will work to change the preset in FM8. I just tested it.
Note that I changed a couple of things: you do not need that long IF statement to test newValue. You can actually concatenate an integer value to a string and intToStr conversion will be done automatically. See my updated version below
var wVB3Knob : Widget
var wVB3Name : Widget
var FM8 : Block
On WidgetValueChange (newValue : double) from wVB3Knob
var i : integer
// newValue represents a value between 0.0 and 1.0
i = Floor(30.0*newValue)
SelectPreset(FM8, i)
SetWidgetLabel(wVB3Name, "Preset #" + i)
The reason I deprecated them was because you CAN always say “” + value where value is int or double or bool. If you think we should have explicit conversion functions then I can certainly undeprecate the other ones and add one for double
It’s not really important, I asked more out of interest which solution you’d recommend. I think it would be nice to have one more function for doubles to have them complete if someone prefers to use them. I’m also very okay with “” + value because…it works
The if then block in my code will be used to display the name of the preset which I don’t believe the scripting language returns (yet). So when i==0, it will display “Wurlitzer” and for i==1 it will display “Suitcase” etc… (an an example)
So is there a list of types that are available in the language? I defined the plugin as a MidiInBlock which is obviously incorrect. Do I need to define a plugin via var, or is it implied when I give it a name?
Can you please elaborate further on your comment “Your synth has to be capable of responding to SelectPreset function.”. How is the script behaving differently to me left-clicking the preset on the plugin dialog window?
Has anyone suggested a new function that allows a plugin to load external FXB files?
Cheers guys - hopefully I’m not too much of a PITA.
If you’re talking about OUR dialog where we display presets exposed by a plugin, then SelectPreset works fine. However, (unfortunately), there are a lot of plugins out there that have their own “presets” but they don’t expose them to the host so we can’t see them. In that case, we have no way to change them via SelectPreset. You might still be able to change the preset using program change messages (which you would send to the MidiInBlock that’s connected to your synth, by the way)
“Can you please elaborate further on your comment “Your synth has to be capable of responding to SelectPreset function.”. How is the script behaving differently to me left-clicking the preset on the plugin dialog window”
No official list yet and in fact this stuff is still changing. If you want to refer to an arbitrary plugin block, then the type is “PluginBlock” (as of the release coming next, right now I think it’s still “AudioBlock”)
“So is there a list of types that are available in the language”
Interesting suggestion but I’m not sure it makes sense to support this. What’s the use case?
“Has anyone suggested a new function that allows a plugin to load external FXB files”
No, your feedback is extremely valuable and appreciated
“Cheers guys – hopefully I’m not too much of a PITA.”
The plugin I was using does have presets available as per your plugin on the right so maybe my script didn’t work because I defined the plugin pVB3 as the wrong type.
<var wVB3Knob : Widget
var wVB3Name : Widget
var FM8 : Block
On WidgetValueChange (newValue : double) from wVB3Knob
var i : integer
// newValue represents a value between 0.0 and 1.0
i = Floor(30.0*newValue)
SelectPreset(FM8, i) SetWidgetLabel(wVB3Name, “Preset #” + i)
End
initialization
Print(“Ready”)
end>
I tested your script. I will work with VB3 (at least on Windows), but it won’t work for FM8 because FM8 has its own preset management system and doesn’t expose those presets to the host. What you can do for a plugin like the KORG Wavestation VSTi is:
var wVB3Knob : Widget
var wVB3Name : Widget
//var FM8 : Block
var MidiIn : MidiInBlock
On WidgetValueChange (newValue : double) from wVB3Knob
var i : integer
programChangeMsg : programChangeMessage
// newValue represents a value between 0.0 and 1.0
i = Floor(30.0*newValue)
//SelectPreset(FM8, i)
programChangeMsg = MakeProgramChangeMessage(i)
SendNow(MidiIn, programChangeMsg)
SetWidgetLabel(wVB3Name, “Preset #” + i)
End
initialization
Print(“Ready”)
end
That does work for every instrument that supports program change messages - like Wavestation. Be aware that you need your MidiIn block to be activated for scripting, it needs to have the scripting name “MidiIn” and of course it has to be connected to the plugin. Unfortunately the FM8 doesn’t support any of those ideas so you won’t be able to select FM8 presets with GP scripting.
I have tried sending the program change message, but most of my plugins didn’t respond. I’ll need to do a combination of program change messages and setting presets.
I noticed in your example you defined (and commented out) FM8 as a Block. Where can I find a list of object types supported by GPScript?