VCVRack / VCV-Prototype

Other
130 stars 23 forks source link

Supercollider Engine #24

Closed mossheim closed 4 years ago

mossheim commented 4 years ago

this PR adds a SuperCollider script engine. closes #8.

i have tested this on my machine only (macOS 10.14.6).

couple of notes:

i am having the engine construct a string literal to be interpreted by sclang -- a further optimization would be to set up the stack so that it matches the VM state directly prior to calling ~vcv_process. but, i'm not sure how easy that would be, and i'm already satisfied with the latency i'm getting. on my machine (Macbook Pro, macOS 10.14.6, 2.5 GHz Intel i7 processor) gain.scd according to my timing code runs with an average latency of 260us, with a worst case of 1.5ms (my guess, GC jitter aligning with unfortunate thread scheduling). IMO, not bad for a first pass.

this is to my knowledge the first time sclang has been integrated in another application this way, so the integration is naturally not very smooth and i hope that's all right. i would certainly like to make it less painful in the future! anything you can suggest there, just let me know.

mossheim commented 4 years ago

ah, forgot to mention -- against your suggestion, i am still linking the library from within the SC build folder. i really do not want to run make install because that would necessitate building extra executables and libraries (scsynth in particular), and i already need a bunch of other static libraries that get built in there anyway.

also, to explain the makefile hackery a bit -- what i'm doing is applying a patch to the SC build system that defines a special target. building that target creates a file which lists the library dependencies of libsclang. i run that target and then cat the resulting file as part of the LDFLAGS. this seemed like the most robust way of doing things, since there are about 10-20 dependencies depending on your OS and build flags, and some of them are system libraries that can be found in various locations.

speaking of which, the system dependencies here are at least:

are any of those new?

mossheim commented 4 years ago

finally, I have tested this on macOS but no other platforms yet. if there are other platforms you'd like me to test on, just let me know. i have [kinda dusty] environments set up for Windows and Linux.

jamshark70 commented 4 years ago

@brianlheim it might be a couple of weeks before I could try it, but I've also tinkered with Rack in Linux and I'd be very happy to kick the tires of this setup in Linux :D