For musicians who want to use Vital as an instrument in a performance context, I’ve developed a temporary solution for the Program Change feature. It’s based on graphical interface manipulation automation, a clickstream. Please, if you want to use it, read the requirements carefully before you try it.
For the Channel filter I’ve used VSTHost to load the Vital plugin. The Channel filter can be found in Plugin -> Window -> Midi Settings -> Fiilter Settings.
Note that this script has only been tested for Vital in standalone mode and for its plugin in VSTHost.
Any comments or questions are welcome.
/* -------------------------------------------------------
Goal :
Change Program ('preset') in Vital VST using graphical interface automation and without using the standard MIDI protocol ; both Vital in standalone mode and Vital used as a plugin in VSTHost (with Channel filter) are supported. The main code of this script has at least 2 potential use cases :
1) embedded function call (where you can use different hotkeys for different presets or replace PC MIDI events for Vital) or
2) (compiled) script call
Author : Bart M
Requirements (testing context) :
- Windows 10
- AutoHotkey version 1.1.
- A running instance of Vital (standalone) or if VSTHost is used,
1) open Vital's plugin window (Plugin Edit mode)
2) make sure that all necessary preset browser controls are visible in VSTHost's pane when it's selected
- Vital's window size at 70%
About Vital presets :
1) All preset names can be obtained with a regular expression match statement like ""(?P<Author>[a-zA-Z0-9_'\-+=. ]+)\/Presets\/((?P<Bank>[a-zA-Z0-9_'\-+=. ]+)\/)?(?P<Sound>[a-zA-Z0-9_'\-+=. ]+)\.vital"" on the FactoryContent.vitalbank binary file ; it depends on the special chars that can be found in the current preset names
2) Styles are binary encoded tags; any info about how they are encoded is welcome.
3) VSTHost can't export Vital's sound banks; it can only export individual presets.
Note that exception handling is minimal. If one of the clicks is wrong, anything might happen.
Use this script at your own risk. No warranty is provided.
*/
#SingleInstance Force ; allow only one instance of this script
; usage example : initiate a soundbank object with some preset names (requirement : each (sub)string must refer to a unique preset name)
SoundBank := {1: "Abbysun"
, 2: "Big Stomp"
, 3: "Cinema Bells"
, 4: "Disrupt"
, 5: "Jupiter Bass"}
Random, RandomNumber, 1, % SoundBank.Length() ; select random sound
SoundName := SoundBank[RandomNumber]
; main code
ActiveHwnd := WinExist("A") ; memorise active window
CoordMode, Mouse, Screen
MouseGetPos, MouseX, MouseY ; memorise current mouse position
CoordMode, Mouse, Relative
; setup clicks data
Clicks := {1: {"x": 805, "y": 50} ; open menu
, 2: {"x": 810, "y": 70} ; select Browse Presets
, 3: {"x": 140, "y": 530} ; select All
, 4: {"x": 120, "y": 380, "text": SoundName} ; click on Search field and fill in preset name
, 5: {"x": 480, "y": 120}} ; select first row
If WinExist("ahk_exe Vital.exe") ; verify if Vital is running
{
WinActivate, ahk_exe Vital.exe
If ErrorLevel
MsgBox, Error
WinGetPos, , , Width, , ahk_exe Vital.exe
If Width not between 1177 and 1197 ; exact width is 1187, but better be safe
{
MsgBox, Vital's window size is not set at 70`%
Exit
}
For Step, Descr in Clicks ; send all clicks and preset name
{
X := Descr.x
Y := Descr.y
SendInput {Click %X%, %Y%, 1}
If Descr.text
SendInput % Descr.text
}
}
Else If WinExist("ahk_exe vsthost.exe") ; verify if VSTHost is running
{
WinActivate, ahk_exe vsthost.exe
If ErrorLevel
MsgBox, Error
SendInput {Click 23, 83, 1} ; click on MIDI client canvas
ControlGetPos, ControlX, ControlY, Width, , AfxFrameOrView90s1 ; where is the Vital Plugin's window?
If Width not between 1181 and 2001 ; exact width is 1191, but better be safe
{
MsgBox, Vital's plugin window size is not set at 70`%
Exit
}
SendInput {Click %ControlX%, %ControlY%, 1} ; click on plugin window
ControlGetText, ControlText, AfxFrameOrView90s1
If ErrorLevel
MsgBox, Error
If InStr(ControlText, "Vital Program") ; verify whether Vital plugin window is open
{
For Step, Descr in Clicks
{
X := Descr.x + ControlX
Y := Descr.y + ControlY
SendInput {Click %X%, %Y%, 1}
If Descr.text
SendInput % Descr.text
}
}
Else
MsgBox, Vital isn't running in VSTHost or isn't in "Plugin Edit" mode.
}
Else
MsgBox, Vital (optionally in VSTHost) isn't running.
WinActivate, ahk_id %ActiveHwnd% ; restore active window
CoordMode, Mouse, Screen
MouseMove, MouseX, MouseY ; restore mouse cursor position
Exit