VSTPlugin v0.5.4 released!

Hi,

I am happy to announce a new bug fix release for VSTPlugin - a Supercollider extension for hosting VST2 and VST3 plugins on Windows, macOS and Linux.

Pre-built binaries for all platforms + full change log: https://git.iem.at/pd/vstplugin/-/releases

If possible, please report any issues at https://git.iem.at/pd/vstplugin/-/issues; otherwise leave a message here.

Most important changes/fixes:

  • fix crash with bridging + multi-threading (regression introduced in v0.5.1)
  • bridge/sandbox: allow to write large presets
  • cmake: add NATIVE option for native code generation
  • cmake: support Apple M1 + x86_64 plugin bridge (see the README for build instructions); no official binaries yet
  • fix regression in VSTPlugin.readPlugins

Have fun!

Christof

5 Likes

BTW, VSTPlugin can now be compiled for Apple M1, with a plugin bridge for 64-bit Intel plugins!

Unfortunately, I don’t have access to an M1 (yet), so I couldn’t really test it myself, but a few kind souls have done it for me. For some it seemed to work, others have experienced issues. I’d love to hear more reports!

Thank you for this great plugin!

The binary seems to be running really well in SC 3.12.

I also tried using it in a standalone I have of SC 3.6 but get an error about ERROR: API Version Mismatch: VSTPlugin.scx . Do you think it would be possible to use it if I build it against the SC 3.6 source code or is the API Version Mismatch referring to something else? I am on OS X 10.14 if that makes any difference.

Cheers,
Martin

Thanks :slight_smile:

Do you think it would be possible to use it if I build it against the SC 3.6 source code

Yes, that should work. Be aware, however, that for technical reasons the plugin UI can only be shown on SC 3.11 and above!

Great!

I’m giving it a try now and got a fatal error: 'sndfile.h' file not found. do you know what to do with that?

Here is the process that got me there with the full error at the bottom:

$ cmake .. -DPD=OFF -DSC_INCLUDEDIR=/Users/martin/Downloads/supercollider-3.6 -DSC_INSTALLDIR=/Users/martin/scwork/Extensions

-- Project: vstplugin
-- Build type: Release
-- LOGLEVEL: 2
-- Build with VST2 support
-- VST2DIR: /Users/martin/Downloads/vstplugin-master/vst/VST_SDK/VST2_SDK
-- Build with VST3 support
-- VST3DIR: /Users/martin/Downloads/vstplugin-master/vst/VST_SDK/VST3_SDK
-- Enable plugin bridge
-- ---
*** VSTPlugin ***
-- SC_INCLUDEDIR: /Users/martin/Downloads/supercollider-3.6
-- SC_INSTALLDIR: /Users/martin/scwork/Extensions
-- SUPERNOVA: OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/martin/Downloads/vstplugin-master/build

$ cmake --build . -j -v

//lots of  compiling code and then this:

In file included from /Users/martin/Downloads/vstplugin-master/sc/src/VSTPlugin.cpp:1:
In file included from /Users/martin/Downloads/vstplugin-master/sc/src/VSTPlugin.h:3:
In file included from /Users/martin/Downloads/supercollider-3.6/include/plugin_interface/SC_PlugIn.hpp:24:
In file included from /Users/martin/Downloads/supercollider-3.6/include/plugin_interface/SC_PlugIn.h:28:
/Users/martin/Downloads/supercollider-3.6/include/plugin_interface/SC_InterfaceTable.h:35:10: fatal error: 'sndfile.h' file not
      found
#include <sndfile.h>
         ^~~~~~~~~~~
1 error generated.
make[2]: *** [sc/CMakeFiles/VSTPlugin.dir/src/VSTPlugin.cpp.o] Error 1
make[1]: *** [sc/CMakeFiles/VSTPlugin.dir/all] Error 2
make: *** [all] Error 2

In SC 3.6, the plugin interface requires the sndfile.h header:

In later versions this has been replaced with a simple forward declaration:

As a quick fix you can add -DNO_LIBSNDFILE to your CPPFLAGS.

BTW, what’s your reason for using SC 3.6 in the first place?

Thanks for helping with this, I know next to nothing about using cmake and building source code, just stumbling through examples from the web :slight_smile:

Where/how exactly do I put the -DNO_LIBSNDFILE ?

While looking for solutions I found libsoundfile in ‘/external libraries/’ path in the sc3.6 source and tried to add it to the searchpath of cmake with -DADDITIONAL_PATH but that didn’t work.

My main use of SC is a standalone of 3.6 with an extensive GUI. It’s a sound design / live performance tool for my theater work that has just grown bigger with time and I haven’t seen much reason to try and make a new standalone from the new IDE yet. I do quite like how in my standalone, which is plain GUI on launch, I can just cmd+N and get a code window if I need to adjust or add some code somewhere.

I’ve actually just recently started to properly explore the new (to me) IDE and seeing what’s been developing, like your plugin - and it made me want to convert some max patches I have that are relying on VST plugins to SC. I’m quite fed up with apps/runtimes made from old max versions that doesn’t work on newer systems etc. If I get them to SC I know they will be good for the future and not locked behind some proprietary walls :slight_smile:

It is on my to-do list now to try making a standalone from the latest build though :wink:

Where/how exactly do I put the -DNO_LIBSNDFILE ?

This should do the trick:
cmake -DCMAKE_CXX_FLAGS="-DNO_LIBSNDFILE" ..

Alternatively, you can set the CPPFLAGS environment variable (i.e. export CPPFLAGS=-DNO_LIBSNDFILE) before running cmake for the first time. (If you already have run cmake, just delete the build folder.)

Alright! That got me quite a bit further in the build, then I get this error:

/Users/martin/Downloads/vstplugin-master/sc/src/VSTPlugin.cpp:700:30: error: use of undeclared identifier 'numOutputs'
        auto end = mOutBuf + numOutputs();
                             ^
/Users/martin/Downloads/vstplugin-master/sc/src/VSTPlugin.cpp:793:25: error: use of undeclared identifier 'numOutputs'
    for (int i = 0; i < numOutputs(); ++i){
                        ^
2 errors generated.
make[2]: *** [sc/CMakeFiles/VSTPlugin.dir/src/VSTPlugin.cpp.o] Error 1
make[1]: *** [sc/CMakeFiles/VSTPlugin.dir/all] Error 2
make: *** [all] Error 2

Tough luck. Seems like SC 3.6 is missing some member functions in the C++ wrapper…

Actually, I just realized that you can use the SC 3.7 or 3.8 header files, they should be backwards compatible with SC 3.6 and they don’t have any of the problems above.

By this do you mean to build with the 3.7 or 3.8 source or should I replace some files in 3.6 with files from one of them? What files would that be in case?

I just tried to build with 3.7 and it finished building :slight_smile: But it gave me errors in SC3.6 when executing the examples in VSTPluginController help file:

SynthDef:insert

Synth("insert" : 1000)

ERROR: couldn't find SynthDef 'insert' in global SynthDescLib!
RECEIVER:
class VSTPluginController (0x10e8973c0) {
  instance variables [19]
    name : Symbol 'VSTPluginController'
    nextclass : instance of Meta_VSTPluginDesc (0x10ea83dc0, size=19, set=5)
    superclass : Symbol 'Object'
    subclasses : instance of Array (0x10f30f480, size=1, set=2)
    methods : instance of Array (0x10e897540, size=118, set=7)
    instVarNames : instance of SymbolArray (0x10e897dc0, size=21, set=4)
    classVarNames : nil
    iprototype : instance of Array (0x10e897f40, size=21, set=5)
    cprototype : nil
    constNames : instance of SymbolArray (0x10e8981c0, size=1, set=2)
    constValues : instance of Array (0x10e898280, size=1, set=2)
    instanceFormat : Integer 0
    instanceFlags : Integer 0
    classIndex : Integer 324
    classFlags : Integer 0
    maxSubclassIndex : Integer 325
    filenameSymbol : Symbol '/Applications/SamplerCentral 2.6.app/Contents/Resources/SCClassLibrary/Extensions/VSTPlugin/classes/VSTPluginController.sc'
    charPos : Integer 0
    classVarIndex : Integer 660
}
CALL STACK:
	MethodError:reportError   0x1279190a8
		arg this = <instance of MethodError>
	Nil:handleError   0x127919418
		arg this = nil
		arg error = <instance of MethodError>
	Thread:handleError   0x127917ec8
		arg this = <instance of Thread>
		arg error = <instance of MethodError>
	Object:throw   0x127917738
		arg this = <instance of MethodError>
	Meta_VSTPluginController:prFindPlugins   0x128079528
		arg this = <instance of Meta_VSTPluginController>
		arg synth = <instance of Synth>
		arg synthDef = nil
		var desc = nil
		var metadata = nil
		var plugins = nil
	Meta_VSTPluginController:new   0x128079658
		arg this = <instance of Meta_VSTPluginController>
		arg synth = <instance of Synth>
		arg id = nil
		arg synthDef = nil
		arg wait = -1
		var plugins = nil
		var desc = nil
		var info = nil
	< closed FunctionDef >  (no arguments or variables)
	Interpreter:interpretPrintCmdLine   0x128079928
		arg this = <instance of Interpreter>
		var res = nil
		var func = <instance of Function>
		var code = "~fx = VSTPluginController(~s..."
		var doc = <instance of CocoaDocument>
	Process:interpretPrintCmdLine   0x127918448
		arg this = <instance of Main>
For advice: [http://supercollider.sf.net/wiki/index.php/MethodError]

Yes!

But it gave me errors in SC3.6 when executing the examples in VSTPluginController help file:

Please provide the exact complete code that you’ve been trying to execute.

Yes, this is the code, it’s executed one by one:

(
SynthDef(\insert, { arg bus;
    ReplaceOut.ar(bus, VSTPlugin.ar(In.ar(bus, 2), 2));
}).add;
)

~synth = Synth(\insert, [\bus, 0]);

~fx = VSTPluginController(~synth);

and here is the result again:

SynthDef:insert

Synth("insert" : 1000)

ERROR: couldn't find SynthDef 'insert' in global SynthDescLib!
RECEIVER:
class VSTPluginController (0x10e8973c0) {
  instance variables [19]
    name : Symbol 'VSTPluginController'
    nextclass : instance of Meta_VSTPluginDesc (0x10ea83dc0, size=19, set=5)
    superclass : Symbol 'Object'
    subclasses : instance of Array (0x10f30f480, size=1, set=2)
    methods : instance of Array (0x10e897540, size=118, set=7)
    instVarNames : instance of SymbolArray (0x10e897dc0, size=21, set=4)
    classVarNames : nil
    iprototype : instance of Array (0x10e897f40, size=21, set=5)
    cprototype : nil
    constNames : instance of SymbolArray (0x10e8981c0, size=1, set=2)
    constValues : instance of Array (0x10e898280, size=1, set=2)
    instanceFormat : Integer 0
    instanceFlags : Integer 0
    classIndex : Integer 324
    classFlags : Integer 0
    maxSubclassIndex : Integer 325
    filenameSymbol : Symbol '/Applications/SamplerCentral 2.6.app/Contents/Resources/SCClassLibrary/Extensions/VSTPlugin/classes/VSTPluginController.sc'
    charPos : Integer 0
    classVarIndex : Integer 660
}
CALL STACK:
	MethodError:reportError   0x1279190a8
		arg this = <instance of MethodError>
	Nil:handleError   0x127919418
		arg this = nil
		arg error = <instance of MethodError>
	Thread:handleError   0x127917ec8
		arg this = <instance of Thread>
		arg error = <instance of MethodError>
	Object:throw   0x127917738
		arg this = <instance of MethodError>
	Meta_VSTPluginController:prFindPlugins   0x128079528
		arg this = <instance of Meta_VSTPluginController>
		arg synth = <instance of Synth>
		arg synthDef = nil
		var desc = nil
		var metadata = nil
		var plugins = nil
	Meta_VSTPluginController:new   0x128079658
		arg this = <instance of Meta_VSTPluginController>
		arg synth = <instance of Synth>
		arg id = nil
		arg synthDef = nil
		arg wait = -1
		var plugins = nil
		var desc = nil
		var info = nil
	< closed FunctionDef >  (no arguments or variables)
	Interpreter:interpretPrintCmdLine   0x128079928
		arg this = <instance of Interpreter>
		var res = nil
		var func = <instance of Function>
		var code = "~fx = VSTPluginController(~s..."
		var doc = <instance of CocoaDocument>
	Process:interpretPrintCmdLine   0x127918448
		arg this = <instance of Main>
For advice: [http://supercollider.sf.net/wiki/index.php/MethodError]

Strange. What is the result of ~synth.defName?

One workaround you can try is to pass the SynthDef explicitly to the Synth constructor:

(
~def = SynthDef(\insert, { arg bus;
    ReplaceOut.ar(bus, VSTPlugin.ar(In.ar(bus, 2), 2));
}).add;
)

~synth = Synth(\insert, [\bus, 0]);

~fx = VSTPluginController(~synth, synthDef: ~def);

If this doesn’t work, you’d have to debug and patch it yourself. Unfortunately, I can only “officially” support SC 3.9 and above.

After some digging, it seems that in 3.6 Synth.defName returns a String while in later versions it returns a Symbol. I added asSymbol to the instances of synth.defName in the VSTPluginController class and now it is indeed working :slight_smile:

1 Like

Cool! I just pushed a fix to the develop branch.

Just to report on the final success - I’ve now managed to build it with Xcode 9.4 with VST2, VST3 and 32bit support and it works great. If you or anyone else using SC3.6 want a copy, let me know.

Thanks again Christof for the help and a great plugin!:slight_smile:

1 Like

Hello,

Is there any way to use the following plugins in SuperCollider via VSTPlugin v0.5.4?

-> a VSTPluginController
WARNING: 'WaveShell1-VST 14.0' is neither an existing plugin name nor a valid file path.
ERROR: couldn't open 'WaveShell1-VST 14.0'
-> a VSTPluginController
'/Library/Audio/Plug-Ins/VST/Kontakt.vst' is black-listed.
ERROR: couldn't open 'Kontakt'

They are all black-listed:

VSTPlugin.search;


searching in '/Users/prko/Library/Audio/Plug-Ins/VST'...
found 0 plugins
searching in '/Library/Audio/Plug-Ins/VST'...
'/Library/Audio/Plug-Ins/VST/Kontakt.vst' is black-listed.
'/Library/Audio/Plug-Ins/VST/ValhallaShimmer_x64.vst' is black-listed.
'/Library/Audio/Plug-Ins/VST/WaveShell1-VST 14.0.vst' is black-listed.
found 0 plugins
searching in '/Library/Audio/Plug-Ins/VST3'...
'/Library/Audio/Plug-Ins/VST3/Dexed.vst3' is black-listed.
'/Library/Audio/Plug-Ins/VST3/Kontakt.vst3' is black-listed.
'/Library/Audio/Plug-Ins/VST3/ValhallaShimmer.vst3' is black-listed.
'/Library/Audio/Plug-Ins/VST3/WaveShell1-VST3 14.0.vst3' is black-listed.
found 0 plugins

Thanks in advance for your help!

Hey, these plugins should work, don’t know what’s going wrong… Please open a ticket at Issues · Pure Data libraries / vstplugin · GitLab and let’s continue there. The first thing you can do is clear the plugin cache, make a new search and post the console output. Also provide your OS version and SC version.

1 Like

Thanks for your quick response.
I will do it later, but I could not find the cache file. Where could I find it?

Best,