Skip to content

Commit

Permalink
version zero
Browse files Browse the repository at this point in the history
  • Loading branch information
x42 committed Jun 4, 2018
0 parents commit b0e32a9
Show file tree
Hide file tree
Showing 257 changed files with 49,314 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
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
339 changes: 339 additions & 0 deletions COPYING

Large diffs are not rendered by default.

178 changes: 178 additions & 0 deletions Makefile
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
131 changes: 131 additions & 0 deletions README.md
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