Skip to content

Commit

Permalink
Some progress
Browse files Browse the repository at this point in the history
  • Loading branch information
abique committed May 9, 2013
1 parent fbd5e96 commit a4d8486
Show file tree
Hide file tree
Showing 13 changed files with 1,221 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
config.h
config.mk
maker/vst-bridge-maker
plugin/vst-bridge-plugin-tpl.so
host/vst-bridge-host-32.exe
host/vst-bridge-host-64.exe
host/vst-bridge-host-32.exe.so
host/vst-bridge-host-64.exe.so
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (C) 2011-2012 Alexandre Bique

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
all:
make -C maker
make -C plugin
make -C host

install:
make -C maker install
make -C plugin install
make -C host install

clean:
make -C maker clean
make -C plugin clean
make -C host clean
22 changes: 17 additions & 5 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,24 @@ This is a bridge to run windows VST plugins on Linux VST hosts.

= Architecture =

vst-bridge.so.tpl has room for the windows plugin path.
vst-bridge.so is a Linux VST plugin which has space reserved for the windows
plugin path.

vst-bridge-maker creates a dedicate vst-plugin.so by setting the path to the
windows vst in vst-bridge.so.tpl.
vst-bridge-create creates a dedicated vst-bridge-<plugin>.so for each windows
vst plugin by setting the path to the windows vst in vst-bridge-<plugin>.so

vst-bridge-host.exe hosts a windows vst and receives RPC.
vst-bridge-host.exe hosts a windows vst and communicates with
vst-bridge-<plugin>.so.

vst-bridge-<plugin>.so starts a new wine process vst-bridge-host.exe and
vst-bridge-<plugin>.so spawns a new wine process vst-bridge-host.exe and
passes the path to the <plugin>.

= Protocol =

The communication is done through socket(AF_UNIX, SOCK_SEQPACKET, 0).
The buffer oriented tasks, like process, ... may be done via shared memory.

- request : tag, cmd, len(data), data
- tag: 32 bits
- cmd: 32 bits
- len(data): 32 bits
103 changes: 103 additions & 0 deletions common/common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#ifndef COMMON_H
# define COMMON_H

# include <fcntl.h>

# include <stdint.h>
# include <stdbool.h>

# include "../config.h"

# define VST_BRIDGE_TPL_PLUGIN_PATH "VST-BRIDGE-TPL-PATH"
# define VST_BRIDGE_BUFFER_SIZE (1024 * 1024)

enum vst_bridge_cmd {
VST_BRIDGE_CMD_PING,
VST_BRIDGE_CMD_PLUGIN_MAIN,
VST_BRIDGE_CMD_AUDIO_MASTER_CALLBACK,
VST_BRIDGE_CMD_EFFECT_DISPATCHER,
VST_BRIDGE_CMD_PROCESS,
VST_BRIDGE_CMD_PROCESS_DOUBLE,
VST_BRIDGE_CMD_SET_PARAMETER,
VST_BRIDGE_CMD_GET_PARAMETER,
};

struct vst_bridge_effect_request {
int32_t opcode;
int32_t index;
int64_t value;
float opt;
uint8_t data[0];
} __attribute__((packed));

struct vst_bridge_audio_master_request {
int32_t opcode;
int32_t index;
int64_t value;
float opt;
uint8_t data[0];
} __attribute__((packed));

struct vst_bridge_frames {
uint32_t nframes;
float frames[0];
} __attribute__((packed));

struct vst_bridge_frames_double {
uint32_t nframes;
double frames[0];
} __attribute__((packed));

struct vst_bridge_effect_parameter {
uint32_t index;
float value;
} __attribute__((packed));

struct vst_bridge_plugin_data {
bool hasSetParameter;
bool hasGetParameter;
bool hasProcessReplacing;
bool hasProcessDoubleReplacing;
int32_t numPrograms;
int32_t numParams;
int32_t numInputs;
int32_t numOutputs;
int32_t flags;
int32_t initialDelay;
int32_t uniqueID;
int32_t version;
};

struct vst_bridge_midi_event {
int32_t type;
int32_t byteSize;
int32_t deltaFrames;
int32_t flags;
uint8_t data[0];
};

struct vst_bridge_midi_events {
uint32_t nb;
struct vst_bridge_midi_event events[0];
};

struct vst_bridge_request {
uint32_t tag;
uint32_t cmd;
union {
uint8_t data[16 * 1024];
struct vst_bridge_effect_request erq;
struct vst_bridge_audio_master_request amrq;
struct vst_bridge_frames frames;
struct vst_bridge_frames_double framesd;
struct vst_bridge_effect_parameter param;
struct vst_bridge_plugin_data plugin_data;
};
} __attribute__((packed));

union vst_bridge_buffer {
struct vst_bridge_request rq;
uint8_t buffer[VST_BRIDGE_BUFFER_SIZE];
};

#endif /* !COMMON_H */
95 changes: 95 additions & 0 deletions configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#! /bin/sh

DEBUG=1
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
CFLAGS="$CFLAGS -W -Wall -Wstrict-prototypes -pipe"
CFLAGS="$CFLAGS -Wfloat-equal -Wundef -Wshadow -Wpointer-arith"
CFLAGS="$CFLAGS -Wmissing-declarations -Wnested-externs"
CFLAGS="$CFLAGS -Wmissing-prototypes -fPIC"
CXXFLAGS="$CXXFLAGS -W -Wall -pipe -Wundef -Wshadow -Wpointer-arith -Wabi -std=c++11 -fPIC"
LDFLAGS="$LDFLAGS"

if [[ -z "$CC" ]]; then
CC=gcc
fi

if [[ -z "$CXX" ]]; then
CXX=g++
fi

if [[ -z "$WINCC" ]]; then
WINCC=i486-mingw32-gcc
fi

if [[ -z "$WINCXX" ]]; then
WINCXX=i486-mingw32-g++
fi

if [[ -z "$PREFIX" ]]; then
PREFIX=/usr/local
fi

function usage()
{
echo -n "usage: $0
--release disable debug
--debug enables debug
--prefix=<dir> the installation prefix path
"
exit
}

until [[ $# -eq 0 ]] ;
do
case "$1" in
--release)
DEBUG=0
;;
--debug)
DEBUG=1
;;
--prefix=*)
PREFIX="${1/--prefix=/}"
;;
-h|--help|help)
usage
;;
*)
echo wrong argument "$1"
usage
;;
esac
shift
done

if [[ $DEBUG -eq 0 ]]; then
CFLAGS="$CFLAGS -DNDEBUG -O2"
CXXFLAGS="$CXXFLAGS -DNDEBUG -O2"
else
CFLAGS="$CFLAGS -g"
CXXFLAGS="$CXXFLAGS -g"
fi

CFLAGS="${CPPFLAGS} ${CFLAGS}"
CXXFLAGS="${CPPFLAGS} ${CXXFLAGS}"

cat >config.h <<EOF
#ifndef CONFIG_H
# define CONFIG_H
# define INSTALL_PREFIX "${PREFIX}"
#endif /* !CONFIG_H */
EOF

cat >config.mk <<EOF
CPPFLAGS = $CPPFLAGS
CFLAGS = $CFLAGS
CXXFLAGS = $CXXFLAGS
CC = $CC
CXX = $CXX
WINCC = $WINCC
WINCXX = $WINCXX
PREFIX = $PREFIX
EOF
18 changes: 18 additions & 0 deletions host/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
include ../config.mk

SRC = host.cc

all: vst-bridge-host-32.exe vst-bridge-host-64.exe

vst-bridge-host-32.exe: $(SRC) ../common/common.h ../config.h
$(WINCXX) -m32 $(CPPFLAGS) $(CFLAGS) $(SRC) -lpthread -o $@

vst-bridge-host-64.exe: $(SRC) ../common/common.h ../config.h
$(WINCXX) -m64 $(CPPFLAGS) $(CFLAGS) $(SRC) -lpthread -o $@

clean:
rm -f vst-bridge-host-*.exe*

install: all
install -m 755 -d $(DESTDIR)$(PREFIX)/lib/vst-bridge
install -m 755 vst-bridge-host-*.exe* $(DESTDIR)$(PREFIX)/lib/vst-bridge/
Loading

0 comments on commit a4d8486

Please sign in to comment.