forked from x42/lv2vst
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
version zero
- Loading branch information
0 parents
commit b0e32a9
Showing
257 changed files
with
49,314 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| *.swp | ||
| cscope.* | ||
| tags | ||
| *.so | ||
| *.dll | ||
| *.dylib | ||
| *.dSYM/ | ||
| *.o | ||
| /lv2.vst/ | ||
| /bundles | ||
| /whitelist |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
| PREFIX ?= /usr/local | ||
| LIBDIR ?= lib | ||
| VSTDIR ?= $(PREFIX)/$(LIBDIR)/lxvst | ||
| CXXFLAGS ?= -Wall | ||
| LDFLAGS ?= | ||
| STRIP ?= strip | ||
|
|
||
| ############################################################################### | ||
|
|
||
| VSTNAME=lv2vst | ||
|
|
||
| ############################################################################### | ||
|
|
||
| ifeq ($(DEBUG),) | ||
| override CXXFLAGS += -msse -msse2 -ffast-math -fomit-frame-pointer -O3 -fno-finite-math-only -DNDEBUG | ||
| else | ||
| override CXXFLAGS += -g -O0 | ||
| endif | ||
|
|
||
| ############################################################################### | ||
|
|
||
| UNAME=$(shell uname) | ||
| ifeq ($(UNAME),Darwin) | ||
| STRIPFLAGS=-x | ||
| LIB_EXT=.dylib | ||
| VSTLDFLAGS=-dynamiclib | ||
| LOADLIBES=-lm -ldl | ||
| override CXXFLAGS += -Wno-deprecated-declarations | ||
| override CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden -fdata-sections -ffunction-sections -fPIC -pthread | ||
| override LDFLAGS += -headerpad_max_install_names -Bsymbolic | ||
| ifeq ($(DEBUG),) | ||
| override LDFLAGS += -fvisibility=hidden -fdata-sections -ffunction-sections -Wl,-dead_strip | ||
| endif | ||
| else | ||
| STRIPFLAGS=-s | ||
| VSTLDFLAGS=-Wl,-Bstatic -Wl,-Bdynamic -Wl,--as-needed -shared | ||
| override CXXFLAGS += -fvisibility=hidden -fdata-sections -ffunction-sections -mfpmath=sse | ||
| ifeq ($(DEBUG),) | ||
| override LDFLAGS += -Wl,--gc-sections -Wl,-O1 -Wl,--as-needed -Wl,--strip-all | ||
| endif | ||
| ifneq ($(XWIN),) | ||
| CC=$(XWIN)-gcc | ||
| CXX=$(XWIN)-g++ | ||
| STRIP=$(XWIN)-strip | ||
| LIB_EXT=.dll | ||
| LOADLIBES=-lm -lws2_32 | ||
| PTHREAD_DEP=pthread.o | ||
| PTHREAD_FLAGS=-D__CLEANUP_C -DPTW32_BUILD_INLINED -DPTW32_STATIC_LIB -DHAVE_PTW32_CONFIG_H -Ilib/pthreads-w32/ | ||
| override CXXFLAGS += -mstackrealign $(PTHREAD_FLAGS) | ||
| override LDFLAGS += -static-libgcc -static-libstdc++ | ||
| else | ||
| LIB_EXT=.so | ||
| LOADLIBES=-lm -ldl | ||
| override CXXFLAGS += -fPIC -pthread | ||
| override LDFLAGS += -static-libgcc -static-libstdc++ | ||
| endif | ||
| endif | ||
|
|
||
| ############################################################################### | ||
|
|
||
| PLUGIN_SRC= \ | ||
| src/instantiate.cc \ | ||
| src/loadlib.c \ | ||
| src/lv2ttl.cc \ | ||
| src/lv2vst.cc \ | ||
| src/lv2vstui.cc \ | ||
| src/state.cc \ | ||
| src/vstmain.cc \ | ||
| src/worker.cc | ||
|
|
||
| PLUGIN_DEP= \ | ||
| src/loadlib.h \ | ||
| src/lv2desc.h \ | ||
| src/lv2vst.h \ | ||
| src/lv2ttl.h \ | ||
| src/ringbuffer.h \ | ||
| src/shell.h \ | ||
| src/uri_map.h \ | ||
| src/vst.h \ | ||
| src/worker.h | ||
|
|
||
| LV2SRC= \ | ||
| lib/lilv/collections.c \ | ||
| lib/lilv/instance.c \ | ||
| lib/lilv/lib.c \ | ||
| lib/lilv/node.c \ | ||
| lib/lilv/plugin.c \ | ||
| lib/lilv/pluginclass.c \ | ||
| lib/lilv/port.c \ | ||
| lib/lilv/query.c \ | ||
| lib/lilv/scalepoint.c \ | ||
| lib/lilv/state.c \ | ||
| lib/lilv/ui.c \ | ||
| lib/lilv/util.c \ | ||
| lib/lilv/world.c \ | ||
| lib/lilv/zix/tree.c \ | ||
| lib/serd/env.c \ | ||
| lib/serd/node.c \ | ||
| lib/serd/reader.c \ | ||
| lib/serd/string.c \ | ||
| lib/serd/uri.c \ | ||
| lib/serd/writer.c \ | ||
| lib/sord/sord.c \ | ||
| lib/sord/syntax.c \ | ||
| lib/sord/zix/btree.c \ | ||
| lib/sord/zix/digest.c \ | ||
| lib/sord/zix/hash.c \ | ||
| lib/sratom/sratom.c | ||
|
|
||
| INCLUDES= \ | ||
| include/vestige.h \ | ||
| include/lilv_config.h \ | ||
| include/lilv/lilv.h \ | ||
| include/serd_config.h \ | ||
| include/serd/serd.h \ | ||
| include/sord_config.h \ | ||
| include/sord/sord.h \ | ||
| include/sratom/sratom.h \ | ||
| include/lv2/lv2plug.in | ||
|
|
||
| ############################################################################### | ||
|
|
||
| ifneq ($(BUNDLES),) | ||
| override CXXFLAGS+=-DBUNDLES="\"$(BUNDLES)\"" | ||
| endif | ||
| ifneq ($(WHITELIST),) | ||
| override CXXFLAGS+=-DWHITELIST="\"$(WHITELIST)\"" | ||
| endif | ||
|
|
||
| ############################################################################### | ||
| all: $(VSTNAME)$(LIB_EXT) | ||
|
|
||
| $(VSTNAME)$(LIB_EXT): $(PLUGIN_SRC) $(PLUGIN_DEP) $(LV2SRC) $(INCLUDES) $(PTHREAD_DEP) Makefile | ||
| $(CXX) $(CPPFLAGS) -I. -Isrc $(CXXFLAGS) \ | ||
| -Iinclude/ -Ilib/sord/ -Ilib/lilv/ \ | ||
| -o $(VSTNAME)$(LIB_EXT) \ | ||
| $(PLUGIN_SRC) \ | ||
| $(LV2SRC) \ | ||
| $(VSTLDFLAGS) $(LDFLAGS) $(PTHREAD_DEP) $(LOADLIBES) | ||
| ifeq ($(DEBUG),) | ||
| $(STRIP) $(STRIPFLAGS) $(VSTNAME)$(LIB_EXT) | ||
| endif | ||
|
|
||
| pthread.o: lib/pthreads-w32/pthread.c Makefile | ||
| $(CC) $(PTHREAD_FLAGS) \ | ||
| -fvisibility=hidden -mstackrealign -Wall -O3 \ | ||
| -c -o pthread.o \ | ||
| lib/pthreads-w32/pthread.c | ||
|
|
||
| $(VSTNAME).x86_64.dylib: $(PLUGIN_SRC) $(PLUGIN_DEP) $(LV2SRC) $(INCLUDES) $(PTHREAD_DEP) Makefile | ||
| $(MAKE) CXXFLAGS="-arch x86_64" $(VSTNAME).dylib | ||
| mv $(VSTNAME).dylib $(VSTNAME).x86_64.dylib | ||
|
|
||
| $(VSTNAME).i386.dylib: $(PLUGIN_SRC) $(PLUGIN_DEP) $(LV2SRC) $(INCLUDES) $(PTHREAD_DEP) Makefile | ||
| $(MAKE) CXXFLAGS="-arch i386" $(VSTNAME).dylib | ||
| mv $(VSTNAME).dylib $(VSTNAME).i386.dylib | ||
|
|
||
| osxbundle: lv2vst.x86_64.dylib lv2vst.i386.dylib | ||
| mkdir -p lv2.vst/Contents/MacOS | ||
| echo "BNDL????" > lv2.vst/Contents/PkgInfo | ||
| sed "s/@EXEC@/$(VSTNAME)/;s/@ICON@//;s/@VERSION@/0.1.0/" \ | ||
| misc/plist > lv2.vst/Contents/Info.plist | ||
| lipo -create -o lv2.vst/Contents/MacOS/$(VSTNAME) \ | ||
| $(VSTNAME).x86_64.dylib $(VSTNAME).i386.dylib | ||
|
|
||
| clean: | ||
| rm -f $(VSTNAME)*$(LIB_EXT) pthread.o | ||
| rm -rf lv2.vst | ||
|
|
||
| install: all | ||
| install -d $(DESTDIR)$(VSTDIR) | ||
| install -m755 $(VSTNAME)$(LIB_EXT) $(DESTDIR)$(VSTDIR)/ | ||
|
|
||
| uninstall: | ||
| rm -f $(DESTDIR)$(VSTDIR)/$(VSTNAME)$(LIB_EXT) | ||
| -rmdir $(DESTDIR)$(VSTDIR) | ||
|
|
||
| .PHONY:clean install uninstall lv2ttl.h osxbundle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| LV2 - VST wrapper | ||
| ================= | ||
|
|
||
| Expose LV2 plugins as VST2 plugins to a VST plugin-host on Windows, OSX and Linux. | ||
|
|
||
|
|
||
| QuickStart | ||
| ---------- | ||
|
|
||
| On GNU/Linux: | ||
| ```bash | ||
| git clone https://github.com/x42/lv2vst | ||
| cd lv2vst | ||
| make | ||
| mkdir -p ~/.vst/lv2vst | ||
| cp lv2vst.so ~/.vst/lv2vst/lv2vst.so | ||
|
|
||
| # this assume you have x42-plugins, specifically x42-eq installed | ||
| # or use `lv2ls` to find some LV2 URI/URI-prefixes. | ||
| echo "http://gareus.org/oss/lv2/fil4#mono" > ~/.vst/lv2vst/.whitelist | ||
| echo "http://gareus.org/oss/lv2/fil4#stereo" >> ~/.vst/lv2vst/.whitelist | ||
| ``` | ||
|
|
||
| Then launch a LinuxVST plugin host... | ||
|
|
||
|
|
||
| Description | ||
| ----------- | ||
|
|
||
| lv2vst can be deployed in different variants: | ||
|
|
||
| * wrap dedicated LV2 bundle(s), compile-time specified. | ||
| * wrap any/all LV2 Plugins(s), runtime lookup | ||
|
|
||
|
|
||
| Specifically: | ||
|
|
||
| 1. If a .bundle file exists in the same dir as the VST, | ||
| only load lv2 bundle(s) specified in the file | ||
| (dirs relative to lv2vst.dll, one per line). | ||
| A list of bundles can alternatively be specified at compile-time and | ||
| hard-coded. | ||
|
|
||
| *otherwise* use system-wide LV2 world: | ||
|
|
||
| 2. Load .whitelist and .blacklist files if they exist | ||
| in the same dir as the VST (one URI per line). | ||
|
|
||
| If the whitelist file exists and contains a single complete URI | ||
| (one line), no VST-shell is used and a single plugin is exposed. | ||
|
|
||
| Otherwise index all plugins (alike `lv2ls`), expose only plugins | ||
| which URI matches a prefix in the whitelist. | ||
| If no whitelist files is present (or if it's empty), consider all | ||
| system-wide LV2 plugins. | ||
|
|
||
| Next the .blacklist file is tested, if a Plugin-URI matches a prefix | ||
| specified in the blacklist, it is skipped. | ||
|
|
||
| The CRC32 of the LV2 URI is used as VST-ID. | ||
|
|
||
| LV2VST does not bridge CPU architectures. The LV2 plugins and LV2VST | ||
| architectures and ABIs need to match. | ||
|
|
||
|
|
||
| Supported LV2 Features | ||
| ---------------------- | ||
|
|
||
| * LV2:ui, native UI only: X11UI on Linux, CocoaUI on OSX and WindowsUI on Windows. | ||
| * LV2 Atom ports (currently at most only 1 atom in, 1 atom output) | ||
| * MIDI I/O. | ||
| * plugin to GUI communication | ||
| * LV2 Time/Position | ||
| * LV2 URI map | ||
| * LV2 Worker thread extension | ||
| * LV2 State extension | ||
| * Latency reporting (port property) | ||
|
|
||
|
|
||
| Build and Install | ||
| ----------------- | ||
|
|
||
| Compiling lv2vst requires gnu-make and the GNU c/c++-compiler. | ||
| Windows (.dll) versions are to be cross-compiled on GNU/Linux using mingw. | ||
|
|
||
| ```bash | ||
| make | ||
| ``` | ||
|
|
||
| ```bash | ||
| make XWIN=x86_64-w64-mingw32 clean all | ||
| ``` | ||
|
|
||
| ```bash | ||
| make XWIN=i686-w64-mingw32 clean all | ||
| ``` | ||
|
|
||
| Copy the resulting lv2vst.so lv2vst.dll into a folder where the VST host finds it. | ||
| For macOS/OSX, a .vst bundle folder needs to be created, with the plugin in | ||
| Contents/MacOS/, see `make osxbundle`. | ||
|
|
||
|
|
||
| Caveats | ||
| ------- | ||
|
|
||
| Various LV2 plugins are known to cause crashes. | ||
|
|
||
| LV2VST first indexes all plugins to be collected into a single VST-shell. | ||
| This step is generally safe (using only lv2 ttl meta-data). The LV2 description | ||
| is validated and VST-IDs (CRC32 of the LV2-URI) are generated. | ||
|
|
||
| When the host scans the actual plugins, lv2vst instantiates the mapped LV2. | ||
| This is to ensure that the actual plugin will load later. | ||
| A single VST-shell.so will load (and unload/destroy) various LV2 plugins | ||
| (and their dependent libs, if any) in the same memory-space. | ||
|
|
||
| This is known to cause problems with some sub-standard LV2 plugins, e.g. | ||
| some use static init, fini methods, others use custom threads which are not | ||
| terminated (or the plugin does not wait for threads to terminate: crash on unload). | ||
| Yet others use static globals or expose all their symbols in the global namespace | ||
| (possibly conflicting names) and/or mix libaries which do so. | ||
|
|
||
| Most of these plugins will also cause crashes in other LV2 hosts. Except that LV2 | ||
| hosts don't generally instantiate a plugin unless it is used. | ||
|
|
||
| A dedicated bundle or whitelist is generally preferable. | ||
|
|
||
| lv2vst can be used multiple-times in dedicated folders, each with specific | ||
| whitelist to expose plugin-collections (`lv2ls | grep URI-prefix > .../.whitelist`). | ||
|
|
||
| YMMV |
Oops, something went wrong.