Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Commit

Permalink
Merge from branch "falktx"
Browse files Browse the repository at this point in the history
  • Loading branch information
cannam committed Jun 19, 2013
2 parents 3b3bbd8 + 4cbb6ed commit cc076e3
Show file tree
Hide file tree
Showing 18 changed files with 1,844 additions and 391 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.a
*.o
*.exe
*.so

.directory

dssi-vst_gui
vsthost
160 changes: 94 additions & 66 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,78 +1,106 @@
#!/usr/bin/make -f
# Makefile for dssi-vst #
# ------------------------------- #
# Created by falkTX
#

DSSIDIR = /usr/local/lib/dssi
LADSPADIR = /usr/local/lib/ladspa
BINDIR = /usr/local/bin

# To compile with the VeSTige compatibility header:
CXXFLAGS = -Ivestige -Wall -fPIC

# To compile with the official VST SDK v2.4r2:
#CXXFLAGS = -I./vstsdk2.4/pluginterfaces/vst2.x -Wall -fPIC

LDFLAGS =

TARGETS = dssi-vst-server.exe.so \
dssi-vst-scanner.exe.so \
dssi-vst.so \
dssi-vst_gui \
vsthost

HEADERS = remoteplugin.h \
remotepluginclient.h \
remotepluginserver.h \
remotevstclient.h \
rdwrops.h \
paths.h

OBJECTS = remotevstclient.o \
remotepluginclient.o \
remotepluginserver.o \
rdwrops.o \
paths.o

OBJECTS_W32 = remotepluginclient.w32.o \
remotepluginserver.w32.o \
rdwrops.w32.o \
paths.w32.o

all: $(TARGETS)

install: all
mkdir -p $(DSSIDIR)/dssi-vst
mkdir -p $(LADSPADIR)
mkdir -p $(BINDIR)
install dssi-vst.so $(DSSIDIR)
install dssi-vst.so $(LADSPADIR)
install dssi-vst-server.exe.so dssi-vst-server dssi-vst-scanner.exe.so dssi-vst-scanner dssi-vst_gui $(DSSIDIR)/dssi-vst
install vsthost $(BINDIR)
CXX ?= g++
WINECXX ?= wineg++ -m32

clean:
rm -f $(OBJECTS) $(OBJECTS_W32) libremoteplugin.a libremoteplugin.w32.a
PREFIX ?= /usr/local

BIN_DIR = $(DESTDIR)$(PREFIX)/bin
DSSI_DIR = $(DESTDIR)$(PREFIX)/lib/dssi
LADSPA_DIR = $(DESTDIR)$(PREFIX)/lib/ladspa

BUILD_FLAGS = -O2 -ffast-math -fvisibility=hidden -fPIC -mtune=generic -msse -Wall -Ivestige $(CXX_FLAGS)
BUILD_FLAGS += $(shell pkg-config --cflags alsa liblo zlib)
LINK_FLAGS = $(shell pkg-config --libs zlib) $(LDFLAGS)

LINK_PLUGIN = -shared $(shell pkg-config --libs alsa jack) $(LINK_FLAGS)
LINK_HOST = $(shell pkg-config --libs alsa jack) $(LINK_FLAGS)
LINK_GUI = $(shell pkg-config --libs liblo) $(LINK_FLAGS)
LINK_WINE = -m32 -L/usr/lib32/wine -L/usr/lib/i386-linux-gnu/wine -lpthread -lrt $(LINK_FLAGS)

TARGETS = dssi-vst.so dssi-vst_gui vsthost dssi-vst-scanner.exe dssi-vst-server.exe

# --------------------------------------------------------------

all: $(TARGETS)

dssi-vst.so: dssi-vst.o remotevstclient.o libremoteplugin.unix.a
$(CXX) $^ $(LINK_PLUGIN) -o $@

dssi-vst_gui: dssi-vst_gui.o rdwrops.o
$(CXX) $^ $(LINK_GUI) -o $@

dssi-vst-scanner.exe: dssi-vst-scanner.wine.o libremoteplugin.wine.a
$(WINECXX) $^ $(LINK_WINE) -o $@

dssi-vst-server.exe: dssi-vst-server.wine.o libremoteplugin.wine.a
$(WINECXX) $^ $(LINK_WINE) -ljack -o $@

distclean: clean
rm -f $(TARGETS) dssi-vst-scanner dssi-vst-server *~ *.bak
vsthost: remotevstclient.o vsthost.o libremoteplugin.unix.a
$(CXX) $^ $(LINK_HOST) -o $@

%.exe.so: %.cpp libremoteplugin.w32.a $(HEADERS)
wineg++ -m32 $(CXXFLAGS) $< -o $* $(LDFLAGS) -L. -lremoteplugin.w32 -lpthread -lrt
# --------------------------------------------------------------

libremoteplugin.a: remotepluginclient.o remotepluginserver.o rdwrops.o paths.o
ar r $@ $^
paths.unix.o: paths.cpp
$(CXX) $^ $(BUILD_FLAGS) -c -o $@

libremoteplugin.w32.a: remotepluginclient.w32.o remotepluginserver.w32.o rdwrops.w32.o paths.w32.o
ar r $@ $^
remotepluginclient.unix.o: remotepluginclient.cpp
$(CXX) $^ $(BUILD_FLAGS) -c -o $@

%.w32.o: %.cpp $(HEADERS)
wineg++ -m32 $(CXXFLAGS) $< -c -o $@
remotepluginserver.unix.o: remotepluginserver.cpp
$(CXX) $^ $(BUILD_FLAGS) -c -o $@

%.o: %.cpp $(HEADERS)
g++ $(CXXFLAGS) $< -c
rdwrops.unix.o: rdwrops.cpp
$(CXX) $^ $(BUILD_FLAGS) -c -o $@

dssi-vst.so: dssi-vst.cpp libremoteplugin.a remotevstclient.o $(HEADERS)
g++ -shared -Wl,-Bsymbolic -g3 $(CXXFLAGS) -o dssi-vst.so dssi-vst.cpp remotevstclient.o $(LDFLAGS) -L. -lremoteplugin -lasound
libremoteplugin.unix.a: paths.unix.o remotepluginclient.unix.o remotepluginserver.unix.o rdwrops.unix.o
ar rs $@ $^

vsthost: vsthost.cpp libremoteplugin.a remotevstclient.o $(HEADERS)
g++ $(CXXFLAGS) vsthost.cpp remotevstclient.o -o vsthost $(LDFLAGS) -L. -lremoteplugin -ljack -lasound -lpthread
# --------------------------------------------------------------

dssi-vst_gui: dssi-vst_gui.cpp rdwrops.h
g++ $(CXXFLAGS) dssi-vst_gui.cpp rdwrops.o -o dssi-vst_gui $(LDFLAGS) -llo
paths.wine.o: paths.cpp
$(WINECXX) $^ $(BUILD_FLAGS) -c -o $@

remotepluginclient.wine.o: remotepluginclient.cpp
$(WINECXX) $^ $(BUILD_FLAGS) -c -o $@

remotepluginserver.wine.o: remotepluginserver.cpp
$(WINECXX) $^ $(BUILD_FLAGS) -c -o $@

rdwrops.wine.o: rdwrops.cpp
$(WINECXX) $^ $(BUILD_FLAGS) -c -o $@

dssi-vst-scanner.wine.o: dssi-vst-scanner.cpp
$(WINECXX) $^ $(BUILD_FLAGS) -O0 -c -o $@

dssi-vst-server.wine.o: dssi-vst-server.cpp
$(WINECXX) $^ $(BUILD_FLAGS) -O0 -c -o $@

libremoteplugin.wine.a: paths.wine.o remotepluginclient.wine.o remotepluginserver.wine.o rdwrops.wine.o
ar rs $@ $^

# --------------------------------------------------------------

.cpp.o:
$(CXX) $< $(BUILD_FLAGS) -c -o $@

# --------------------------------------------------------------

clean:
rm -f *.a *.o *.exe *.so $(TARGETS)

install:
install -d $(BIN_DIR)
install -d $(DSSI_DIR)
install -d $(DSSI_DIR)/dssi-vst
install -d $(LADSPA_DIR)
install -m 755 vsthost $(BIN_DIR)
install -m 755 dssi-vst.so $(DSSI_DIR)
install -m 755 dssi-vst.so $(LADSPA_DIR)
install -m 755 dssi-vst_gui $(DSSI_DIR)/dssi-vst
install -m 755 dssi-vst-scanner.exe dssi-vst-scanner.exe.so $(DSSI_DIR)/dssi-vst
install -m 755 dssi-vst-server.exe dssi-vst-server.exe.so $(DSSI_DIR)/dssi-vst
60 changes: 45 additions & 15 deletions dssi-vst-scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

#define VST_FORCE_DEPRECATED 0
#include "aeffectx.h"

#include "remotepluginserver.h"
Expand All @@ -40,33 +41,54 @@
using namespace std;


#if VST_2_4_EXTENSIONS
#if 1 // vestige header
#define kVstVersion 2400
struct VstTimeInfo_R {
double samplePos, sampleRate, nanoSeconds, ppqPos, tempo, barStartPos, cycleStartPos, cycleEndPos;
int32_t timeSigNumerator, timeSigDenominator, smpteOffset, smpteFrameRate, samplesToNextClock, flags;
};
intptr_t
hostCallback(AEffect *plugin, int32_t opcode, int32_t index,
intptr_t value, void *ptr, float opt)
#elif VST_2_4_EXTENSIONS
typedef VstTimeInfo VstTimeInfo_R;
VstIntPtr VSTCALLBACK
hostCallback(AEffect *plugin, VstInt32 opcode, VstInt32 index,
VstIntPtr value, void *ptr, float opt)
#else
typedef VstTimeInfo VstTimeInfo_R;
long VSTCALLBACK
hostCallback(AEffect *plugin, long opcode, long index,
long value, void *ptr, float opt)
#endif
{
static VstTimeInfo timeInfo;
static VstTimeInfo_R timeInfo;

switch (opcode) {

case audioMasterAutomate:
if (plugin)
plugin->setParameter(plugin, index, opt);
break;

case audioMasterVersion:
return 2300;
return kVstVersion;

case audioMasterIdle:
if (plugin)
plugin->dispatcher(plugin, effEditIdle, 0, 0, 0, 0.0f);
break;

case audioMasterGetVendorString:
strcpy((char *)ptr, "Chris Cannam");
break;

case audioMasterGetProductString:
strcpy((char *)ptr, "DSSI VST Wrapper Plugin Scanner");
strcpy((char *)ptr, "DSSI-VST Scanner");
break;

case audioMasterGetVendorVersion:
return long(RemotePluginVersion * 100);
return intptr_t(RemotePluginVersion * 100);

case audioMasterGetLanguage:
return kVstLangEnglish;
Expand All @@ -76,29 +98,30 @@ hostCallback(AEffect *plugin, long opcode, long index,
!strcmp((char*)ptr, "sendVstMidiEvent") ||
!strcmp((char*)ptr, "sendVstTimeInfo") ||
!strcmp((char*)ptr, "sizeWindow") ||
!strcmp((char*)ptr, "supplyIdle")) {
!strcmp((char*)ptr, "supplyIdle") ||
!strcmp((char*)ptr, "receiveVstEvents") ||
!strcmp((char*)ptr, "receiveVstMidiEvent")) {
return 1;
}
break;

case audioMasterGetTime:
memset(&timeInfo, 0, sizeof(VstTimeInfo_R));
timeInfo.samplePos = 0;
timeInfo.sampleRate = 48000;
timeInfo.flags = 0; // don't mark anything valid except default samplePos/Rate
return (long)&timeInfo;
return (intptr_t)&timeInfo;

case DEPRECATED_VST_SYMBOL(audioMasterTempoAt):
// can't support this, return 120bpm
return 120 * 10000;

case audioMasterGetSampleRate:
plugin->dispatcher(plugin, effSetSampleRate,
0, 0, NULL, 48000.0);
return 48000; // fake value
break;

case audioMasterGetBlockSize:
plugin->dispatcher(plugin, effSetBlockSize,
0, 1024, NULL, 0);
return 1024; // fake value
break;

case DEPRECATED_VST_SYMBOL(audioMasterWillReplaceOrAccumulate):
Expand All @@ -119,9 +142,9 @@ hostCallback(AEffect *plugin, long opcode, long index,
return 1;

default:
;
break;
}

return 0;
};

Expand Down Expand Up @@ -332,6 +355,9 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdline, int cmdshow)

memset(buffer, 0, 65);
plugin->dispatcher(plugin, effGetVendorString, 0, 0, buffer, 0);
if (buffer[0] == '\0') {
snprintf(buffer, 64, "Unknown");
}
write(fd, buffer, 64);

synth = false;
Expand All @@ -354,6 +380,9 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdline, int cmdshow)
for (i = 0; i < params; ++i) {
memset(buffer, 0, 65);
plugin->dispatcher(plugin, effGetParamName, i, 0, buffer, 0);
if (buffer[0] == '\0') {
snprintf(buffer, 64, "Unnamed %i", i);
}
write(fd, buffer, 64);
float f = plugin->getParameter(plugin, i);
write(fd, &f, sizeof(float));
Expand All @@ -369,6 +398,9 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdline, int cmdshow)
// pass in <index> as well, just in case
plugin->dispatcher(plugin, effSetProgram, 0, i, NULL, 0);
plugin->dispatcher(plugin, effGetProgramName, i, 0, buffer, 0);
if (buffer[0] == '\0') {
snprintf(buffer, 64, "Unnamed %i", i);
}
write(fd, buffer, 64);
}

Expand Down Expand Up @@ -411,5 +443,3 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdline, int cmdshow)

return 0;
}


Loading

0 comments on commit cc076e3

Please sign in to comment.