Is there any way to distinguish between VST and VSTi plugins?

Post Reply
MusikMan74
Posts: 34
Joined: 06 Jan 2018 23:03

Is there any way to distinguish between VST and VSTi plugins?

Post by MusikMan74 »

The 'getInstrumentTypeName' API function returns "VST" for both my effect (reverb) plugin ("Oril River 1") and my instrument plugin ("DPiano-E 1"):
2plugins.png
2plugins.png (45.69 KiB) Viewed 13687 times
I am ultimately trying to get a list of midi-playable plugins open in the program:

1. Use getNumAudioInstruments to find number of audio instruments.
2. Use getAudioInstrumentId to get instrument id from instrument number
3. Use getInstrumentTypeName to get instrument type [currently returns 'VST' even when plugin is VSTi]
4. Use getInstrumentName to get instrument name from instrument ids that are VSTi. (ideally from step 3)

Is there some other way to accomplish this?


It seems the plugin itself has properties to determine whether it is a VSTi:
(this is a screenshot of the same two plugins above opened in Hermann Sieb's freeware VSTHost, http://hermannseib.com/english/vsthost.htm)
vsthost.png
vsthost.png (105.91 KiB) Viewed 13687 times
kjetil
Site Admin
Posts: 582
Joined: 20 Jul 2017 20:45

Re: Is there any way to distinguish between VST and VSTi plugins?

Post by kjetil »

VST plugins report whether they accept MIDI or not. In addition, there is a string reported by the plugins called category, which is often set to "Effect" or "Synth" (see plugin manager). As far as I can see, there isn't an API function to get info about whether it accepts MIDI or not, but you can get the category by using the getSoundPluginRegistry function, although that function returns a lot of stuff, and the format of it might change.
kjetil
Site Admin
Posts: 582
Joined: 20 Jul 2017 20:45

Re: Is there any way to distinguish between VST and VSTi plugins?

Post by kjetil »

As a followup to getSoundPluginRegistry, you can find category of an instrument by iterating the hash tables returned by getSoundPluginRegistry and use getInstrumentTypeName and getInstrumentPluginName to find correct entry.
kjetil
Site Admin
Posts: 582
Joined: 20 Jul 2017 20:45

Re: Is there any way to distinguish between VST and VSTi plugins?

Post by kjetil »

You can actually get info about whether the instrument accepts midi or not by using the function getInstrumentInfo. However this function just returns a long string with lots of info separated by lineshifts, so you have to parse the info from it manually. Note though, that lots of effect plugins also accept MIDI, so it's probably better to use "category".
kjetil
Site Admin
Posts: 582
Joined: 20 Jul 2017 20:45

Re: Is there any way to distinguish between VST and VSTi plugins?

Post by kjetil »

Code: Select all

(define (get-instrument-category instrument-id)
  (define entry (find-first (to-list (<ra> :get-sound-plugin-registry))
                            (lambda (entry)
                              (and (entry :type-name)
                                   (entry :name)
                                   (string=? (entry :type-name) (<ra> :get-instrument-type-name instrument-id))
                                   (string=? (entry :name) (<ra> :get-instrument-plugin-name instrument-id))))))
  (and entry
       (entry :category)))
MusikMan74
Posts: 34
Joined: 06 Jan 2018 23:03

Re: Is there any way to distinguish between VST and VSTi plugins?

Post by MusikMan74 »

Thanks for the detailed responses.
kjetil wrote: 12 Jun 2019 19:53 As a followup to getSoundPluginRegistry, you can find category of an instrument by iterating the hash tables returned by getSoundPluginRegistry and use getInstrumentTypeName and getInstrumentPluginName to find correct entry.
I am successfully parsing the getSoundPluginRegistry info and finding the instruments with hash tables containing ':category "Synth"''.

IMHO, the 'ideal' solution would be to update the getInstrumentTypeName function to return "VSTi" if you already know the VST plugin instrument category is 'Synth'... but I am in no position to be dictating feature requests. :D

Ultimately my goal is to add "Next Midi Instrument" / "Previous Midi Instrument' actions (shortcuts) so I can easily cycle through all the available playable midi instruments in the mixer without having to find/click on them in the GUI...
PlayableInstruments.png
PlayableInstruments.png (47 KiB) Viewed 13658 times
kjetil
Site Admin
Posts: 582
Joined: 20 Jul 2017 20:45

Re: Is there any way to distinguish between VST and VSTi plugins?

Post by kjetil »

> IMHO, the 'ideal' solution would be to update the getInstrumentTypeName function to return "VSTi" if you already know the VST plugin instrument category is 'Synth'... but I am in no position to be dictating feature requests.

That would create an inconsistent API since type name is used to distinguish instrument types (plugin types / etc.), and there is no plugin type called "VSTi'". A "VSTi" plugin is just a vst plugin that creates sound when receiving midi notes. I don't think there is any way for a host to safely determine whether a vst plugin does that or not.
kjetil
Site Admin
Posts: 582
Joined: 20 Jul 2017 20:45

Re: Is there any way to distinguish between VST and VSTi plugins?

Post by kjetil »

It would in my opinion make more sense to add an API call called "InstrumentIsPlayingNotes" (or something like that), or a more general "getInstrumentProperties" function that returns a hash table with all types of info about an instrument.
MusikMan74
Posts: 34
Joined: 06 Jan 2018 23:03

Re: Is there any way to distinguish between VST and VSTi plugins?

Post by MusikMan74 »

Thanks for weighing in- an 'InstrumentIsPlayingNotes' API addition sounds like the right approach...
Post Reply