├── TestVst3 ├── testvst3gui │ ├── testvst3gui-terminal.sh │ ├── testvst3-batch │ ├── Makefile │ └── testvst3gui.cpp ├── TestVst3-debian-rz.zip ├── testvst3-batch ├── License ├── Makefile ├── lin-patchwin-old ├── lin-patchwin-2019_build_81 ├── docvst2.h ├── lin-patchwin-build-24_2019-11-29 ├── README.md ├── lin-patchwin ├── vst2wrapper.h ├── vestige.h ├── testvst3.cpp └── basewrapper.h ├── paths.h ├── convert ├── Makefile └── linvstconvertgtk.cpp ├── Makefile-convert ├── remotevstclient.h ├── Realtime-Audio-Config └── Readme.md ├── Wine-Bottles └── README.md ├── rdwrops.h ├── paths.cpp ├── remoteplugin.h ├── lin-patchwin-old ├── lin-patchwin-2019_build_81 ├── docvst2.h ├── vst3-sdks ├── vstsdk3613_08_04_2019_build_81 │ └── lin-patchwin ├── vst-sdk_3.6.14_build-24_2019-11-29 │ └── lin-patchwin ├── vst-sdk_3.7.0_build-116_2020-07-31 │ └── lin-patchwin └── vst-sdk_3.7.1_build-50_2020-11-17 │ └── lin-patchwin ├── lin-patchwin-build-24_2019-11-29 ├── Makefile ├── dragwin └── Makefile ├── Tested-VST3-Plugins └── README.md ├── lin-patchwin ├── remotepluginclient.h ├── remotepluginserver.h ├── remotevstclient.cpp ├── README.md ├── vst2wrapper.h ├── vestige.h ├── basewrapper.h └── linvst.cpp /TestVst3/testvst3gui/testvst3gui-terminal.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | chmod +x ./testvst3-batch 3 | ./testvst3gui 4 | -------------------------------------------------------------------------------- /TestVst3/TestVst3-debian-rz.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osxmidi/LinVst3/HEAD/TestVst3/TestVst3-debian-rz.zip -------------------------------------------------------------------------------- /paths.h: -------------------------------------------------------------------------------- 1 | /* 2 | dssi-vst: a DSSI plugin wrapper for VST effects and instruments 3 | Copyright 2004-2007 Chris Cannam 4 | */ 5 | 6 | #ifndef _PATHS_H_ 7 | #define _PATHS_H_ 8 | 9 | #include 10 | #include 11 | 12 | class Paths { 13 | public: 14 | std::vector getPath(std::string envVar, std::string deflt, 15 | std::string defltHomeRelPath); 16 | }; 17 | 18 | int shm_mkstemp(char *fileBase); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /TestVst3/testvst3-batch: -------------------------------------------------------------------------------- 1 | files=("$1"*.vst3) 2 | idx=0 3 | for file in "${files[@]}" 4 | do 5 | ./testvst3.exe "${file}" 6 | let idx++ 7 | done 8 | files2=("$1"*/*.vst3) 9 | idx2=0 10 | for file2 in "${files2[@]}" 11 | do 12 | ./testvst3.exe "${file2}" 13 | let idx2++ 14 | done 15 | files3=("$1"*/*/*.vst3) 16 | idx3=0 17 | for file3 in "${files3[@]}" 18 | do 19 | ./testvst3.exe "${file3}" 20 | let idx3++ 21 | done 22 | files4=("$1"*/*/*/*.vst3) 23 | idx4=0 24 | for file4 in "${files4[@]}" 25 | do 26 | ./testvst3.exe "${file4}" 27 | let idx4++ 28 | done 29 | files5=("$1"*/*/*/*/*.vst3) 30 | idx5=0 31 | for file5 in "${files5[@]}" 32 | do 33 | ./testvst3.exe "${file5}" 34 | let idx5++ 35 | done 36 | -------------------------------------------------------------------------------- /TestVst3/testvst3gui/testvst3-batch: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | files=("$1"*.vst3) 3 | idx=0 4 | for file in "${files[@]}" 5 | do 6 | ./testvst3.exe "${file}" 7 | let idx++ 8 | done 9 | files2=("$1"*/*.vst3) 10 | idx2=0 11 | for file2 in "${files2[@]}" 12 | do 13 | ./testvst3.exe "${file2}" 14 | let idx2++ 15 | done 16 | files3=("$1"*/*/*.vst3) 17 | idx3=0 18 | for file3 in "${files3[@]}" 19 | do 20 | ./testvst3.exe "${file3}" 21 | let idx3++ 22 | done 23 | files4=("$1"*/*/*/*.vst3) 24 | idx4=0 25 | for file4 in "${files4[@]}" 26 | do 27 | ./testvst3.exe "${file4}" 28 | let idx4++ 29 | done 30 | files5=("$1"*/*/*/*/*.vst3) 31 | idx5=0 32 | for file5 in "${files5[@]}" 33 | do 34 | ./testvst3.exe "${file5}" 35 | let idx5++ 36 | done 37 | -------------------------------------------------------------------------------- /TestVst3/testvst3gui/Makefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # Makefile for LinVst # 3 | 4 | CXX = g++ 5 | 6 | CXX_FLAGS = 7 | 8 | PREFIX = /usr 9 | 10 | BIN_DIR = $(DESTDIR)$(PREFIX)/bin 11 | 12 | BUILD_FLAGS = `pkg-config --cflags gtk+-3.0` $(CXX_FLAGS) 13 | 14 | LINK_FLAGS = $(LDFLAGS) 15 | 16 | LINK_APP = -no-pie `pkg-config --libs gtk+-3.0` $(LINK_FLAGS) 17 | 18 | TARGETS = testvst3gui 19 | 20 | # -------------------------------------------------------------- 21 | 22 | all: $(TARGETS) 23 | 24 | testvst3gui: testvst3gui.o 25 | $(CXX) $^ $(LINK_APP) -o $@ 26 | 27 | testvst3gui.o: testvst3gui.cpp 28 | $(CXX) $(BUILD_FLAGS) -c $^ -o $@ 29 | 30 | clean: 31 | rm -fR *.o $(TARGETS) 32 | 33 | install: 34 | 35 | -------------------------------------------------------------------------------- /convert/Makefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # Makefile for LinVst # 3 | 4 | CXX = g++ 5 | 6 | CXX_FLAGS = 7 | 8 | PREFIX = /usr 9 | 10 | BIN_DIR = $(DESTDIR)$(PREFIX)/bin 11 | 12 | BUILD_FLAGS = `pkg-config --cflags gtk+-3.0` $(CXX_FLAGS) 13 | 14 | LINK_FLAGS = $(LDFLAGS) 15 | 16 | LINK_APP = -no-pie `pkg-config --libs gtk+-3.0` $(LINK_FLAGS) 17 | 18 | TARGETS = linvst3convert 19 | 20 | # -------------------------------------------------------------- 21 | 22 | all: $(TARGETS) 23 | 24 | linvst3convert: linvstconvertgtk.o 25 | $(CXX) $^ $(LINK_APP) -o $@ 26 | 27 | linvstconvertgtk.o: linvstconvertgtk.cpp 28 | $(CXX) $(BUILD_FLAGS) -c $^ -o $@ 29 | 30 | clean: 31 | rm -fR *.o $(TARGETS) 32 | 33 | install: 34 | install -m 755 linvst3convert $(BIN_DIR) 35 | -------------------------------------------------------------------------------- /Makefile-convert: -------------------------------------------------------------------------------- 1 | # Makefile for linvst3convert 2 | # linvst3convert is made using the convert directory 3 | # linvst3convert needs the gtk3 dev libraries installed 4 | # to make use make -f Makefile-convert 5 | # to install to /usr/bin use sudo make -f Makefile-convert install 6 | # to clean use sudo make -f Makefile-convert clean 7 | 8 | CXX = g++ 9 | 10 | CXX_FLAGS = 11 | 12 | PREFIX = /usr 13 | 14 | BIN_DIR = $(DESTDIR)$(PREFIX)/bin 15 | 16 | BUILD_FLAGS = `pkg-config --cflags gtk+-3.0` $(CXX_FLAGS) 17 | 18 | LINK_FLAGS = $(LDFLAGS) 19 | 20 | LINK_APP = -no-pie `pkg-config --libs gtk+-3.0` $(LINK_FLAGS) 21 | 22 | SRC_DIR=convert 23 | 24 | vpath linvstconvertgtk.cpp $(SRC_DIR) 25 | 26 | TARGETS = linvst3convert 27 | 28 | # -------------------------------------------------------------- 29 | 30 | all: $(TARGETS) 31 | 32 | linvst3convert: linvstconvertgtk.o 33 | $(CXX) $^ $(LINK_APP) -o $@ 34 | 35 | linvstconvertgtk.o: linvstconvertgtk.cpp 36 | $(CXX) $(BUILD_FLAGS) -c $^ -o $@ 37 | 38 | clean: 39 | rm -fR *.o $(TARGETS) 40 | 41 | install: 42 | install -m 755 linvst3convert $(BIN_DIR) 43 | -------------------------------------------------------------------------------- /remotevstclient.h: -------------------------------------------------------------------------------- 1 | /* dssi-vst: a DSSI plugin wrapper for VST effects and instruments 2 | Copyright 2004-2007 Chris Cannam 3 | 4 | This file is part of linvst. 5 | 6 | linvst is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #ifndef REMOTE_VST_CLIENT_H 21 | #define REMOTE_VST_CLIENT_H 22 | 23 | #include "remotepluginclient.h" 24 | 25 | class RemoteVSTClient : public RemotePluginClient { 26 | public: 27 | // may throw a string exception 28 | RemoteVSTClient(audioMasterCallback theMaster); 29 | virtual ~RemoteVSTClient(); 30 | }; 31 | #endif 32 | -------------------------------------------------------------------------------- /Realtime-Audio-Config/Readme.md: -------------------------------------------------------------------------------- 1 | Some distros such as Manjaro/Mint/Ubuntu don't seem to currently setup audio for realtime 2 | 3 | If they are not set then cpu spiking can occur with plugins. 4 | 5 | For Reaper, also set RT priority to 40 in Audio device settings if using Alsa. 6 | 7 | To set audio realtime priorities edit the below files. 8 | 9 | ``` 10 | 11 | sudo edit /etc/security/limits.conf 12 | 13 | add 14 | 15 | @audio - rtprio 95 16 | @audio - memlock unlimited 17 | 18 | ``` 19 | 20 | ``` 21 | 22 | run from Terminal 23 | 24 | sudo usermod -a -G audio your-user-name 25 | 26 | ``` 27 | 28 | ``` 29 | 30 | sudo edit /etc/security/limits.d/audio.conf 31 | 32 | add 33 | 34 | @audio - rtprio 95 35 | @audio - memlock unlimited 36 | #@audio - nice -19 37 | 38 | ``` 39 | 40 | Also, installing the rtirq-init (rtirq for Arch/EndeavourOS/Manjaro) and irqbalance packages might be useful. 41 | 42 | rtirq is enabled when threadirqs is added to grub (applies to generic, lowlatency, liquorix and zen kernels) 43 | 44 | sudo edit /etc/default/grub 45 | 46 | GRUB_CMDLINE_LINUX="threadirqs" 47 | 48 | then update grub by using sudo update-grub or for arch based systems use sudo grub-mkconfig -o /boot/grub/grub.cfg or sudo pacman -Syu 49 | 50 | adding "xhci_hcd" to RTIRQ_NAME_LIST in the rtirq.conf file might be needed 51 | 52 | sudo edit /etc/rtirq.conf 53 | or sudo edit /etc/default/rtirq 54 | 55 | #RTIRQ_NAME_LIST="snd usb i8042" 56 | 57 | RTIRQ_NAME_LIST="xhci_hcd snd usb i8042" 58 | 59 | After reboot, check rtirq status 60 | 61 | sudo /usr/bin/rtirq status 62 | or sudo /etc/init.d/rtirq status 63 | -------------------------------------------------------------------------------- /Wine-Bottles/README.md: -------------------------------------------------------------------------------- 1 | Install approx guide 2 | 3 | 4 | create bottle named vstbottle (or whatever) 5 | 6 | 7 | (To check) ls ~/.var/app/com.usebottles.bottles/data/bottles/bottles/vstbottle (the ~/ at the start of the path means your /home/username/) 8 | 9 | 10 | run executable to install a vst3 plugin 11 | 12 | ie the vst3 plugin was installed into "Program Files"/"Common Files"/VST3 (might be installed to other locations in "Program Files" depending on the plugin ie could be installed into the Steinberg foder instead of VST3 or whatever) 13 | 14 | Use File Manager to see where the vst3 was installed in the bottle. 15 | 16 | (To check) ~/.var/app/com.usebottles.bottles/data/bottles/bottles/vstbottle/drive_c/"Program Files"/"Common Files"/VST3 17 | 18 | 19 | use linvst3convert and choose the destination to be where the vst3 was installed 20 | 21 | ~/var/app/com.usebottles.bottles/data/bottles/bottles/vstbottle/drive_c/"Program Files"/"Common Files"/VST3 22 | 23 | 24 | add the Daw VST search path to include ~/var/app/com.usebottles.bottles/data/bottles/bottles/vstbottle/drive_c/"Program Files"/"Common Files"/VST3 25 | 26 | 27 | The WINELOADER variable needs to be set as it points to the location where wine is (wine is usually in /usr/bin but with bottles it's not). 28 | 29 | USE (depending where wine is in a bottle) 30 | 31 | export WINELOADER=~/.var/app/com.usebottles.bottles/data/bottles/runners/soda-9.0-1/bin/wine (in a terminal) 32 | 33 | to set the WINELOADER 34 | 35 | Run Daw from the terminal (or configure WINELOADER to be set on boot) 36 | 37 | LinVst3 automatically sets the WINEPREFIX to the wine location of the vst3 when the Daw loads the vst3. 38 | 39 | check if the WINELOADER path is set 40 | 41 | env | grep WINELOADER 42 | 43 | check wine version 44 | 45 | $WINELOADER --version 46 | -------------------------------------------------------------------------------- /TestVst3/License: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // LICENSE 3 | // (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved 4 | //----------------------------------------------------------------------------- 5 | // Redistribution and use in source and binary forms, with or without modification, 6 | // are permitted provided that the following conditions are met: 7 | // 8 | // * Redistributions of source code must retain the above copyright notice, 9 | // this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright notice, 11 | // this list of conditions and the following disclaimer in the documentation 12 | // and/or other materials provided with the distribution. 13 | // * Neither the name of the Steinberg Media Technologies nor the names of its 14 | // contributors may be used to endorse or promote products derived from this 15 | // software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 21 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 22 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 24 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | // OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 26 | // OF THE POSSIBILITY OF SUCH DAMAGE. 27 | //---------------------------------------------------------------------------- 28 | -------------------------------------------------------------------------------- /rdwrops.h: -------------------------------------------------------------------------------- 1 | /* 2 | dssi-vst: a DSSI plugin wrapper for VST effects and instruments 3 | Copyright 2004-2007 Chris Cannam 4 | */ 5 | 6 | #ifndef _RD_WR_OPS_H_ 7 | 8 | #include "remoteplugin.h" 9 | 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | struct alignas(64) amessage { 16 | int flags; 17 | int pcount; 18 | int parcount; 19 | int incount; 20 | int outcount; 21 | int delay; 22 | }; 23 | 24 | struct alignas(64) vinfo { 25 | char a[64 + 8 + (sizeof(int32_t) * 2) + 48]; 26 | // char a[96]; 27 | }; 28 | 29 | struct alignas(64) winmessage { 30 | int handle; 31 | int width; 32 | int height; 33 | int winerror; 34 | }; 35 | 36 | //#ifdef VST32 37 | //struct alignas(64) ShmControl 38 | //#else 39 | struct alignas(64) ShmControl 40 | //#endif 41 | { 42 | std::atomic_int runServer; 43 | std::atomic_int runClient; 44 | std::atomic_int nwaitersserver; 45 | std::atomic_int nwaitersclient; 46 | // int runServer; 47 | // int runClient; 48 | RemotePluginOpcode ropcode; 49 | int retint; 50 | float retfloat; 51 | char retstr[512]; 52 | int opcode; 53 | int value; 54 | int value2; 55 | int value3; 56 | int value4; 57 | float floatvalue; 58 | bool retbool; 59 | char timeget[sizeof(VstTimeInfo)]; 60 | char timeset[sizeof(VstTimeInfo)]; 61 | char amptr[sizeof(amessage)]; 62 | char vret[sizeof(vinfo)]; 63 | char wret[sizeof(winmessage)]; 64 | #ifndef VESTIGE 65 | char vpin[sizeof(VstPinProperties)]; 66 | #endif 67 | #ifdef MIDIEFF 68 | char midikey[sizeof(MidiKeyName)]; 69 | char midiprogram[sizeof(MidiProgramName)]; 70 | char midiprogramcat[sizeof(MidiProgramCategory)]; 71 | char vstspeaker[sizeof(VstSpeakerArrangement)]; 72 | char vstspeaker2[sizeof(VstSpeakerArrangement)]; 73 | #endif 74 | #ifdef CANDOEFF 75 | char sendstr[512]; 76 | #endif 77 | int createthread; 78 | int parfin; 79 | int timeinit; 80 | }; 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /TestVst3/Makefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # Makefile for LinVst # 3 | 4 | #target: prerequisites 5 | # ./lin-patchwin 6 | 7 | 8 | #.PHONY do_script: 9 | 10 | 11 | 12 | #prerequisites: do_script 13 | 14 | 15 | 16 | CXX = g++ 17 | WINECXX = wineg++ -Wl,--subsystem,windows 18 | 19 | CXX_FLAGS = 20 | 21 | PREFIX = /usr 22 | 23 | BUILD_FLAGS_WIN = -std=c++14 -fPIC -m64 -O2 -DVESTIGE -I/opt/wine-staging/include/wine/windows -I/opt/wine-stable/include/wine/windows -I/opt/wine-devel/include/wine/windows -I/usr/include/wine-development/windows -I/usr/include/wine-development/wine/windows -I/usr/include/wine/wine/windows -I../ -DRELEASE=1 -D__forceinline=inline -DNOMINMAX=1 -DUNICODE_OFF -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DSMTG_RENAME_ASSERT=1 -fpermissive 24 | 25 | LINK_FLAGS = $(LDFLAGS) 26 | 27 | LINK_WINE = ../build/lib/Release/libsdk_hosting.a ../build/lib/Release/libbase.a ../build/lib/Release/libpluginterfaces.a ../build/lib/Release/libsdk.a -L/opt/wine-stable/lib64/wine -L/opt/wine-devel/lib64/wine -L/opt/wine-staging/lib64/wine -L/opt/wine-stable/lib64/wine/x86_64-unix -L/opt/wine-devel/lib64/wine/x86_64-unix -L/opt/wine-staging/lib64/wine/x86_64-unix -L/usr/lib/x86_64-linux-gnu/wine-development -lpthread -lX11 -lrt -lshell32 -lole32 $(LINK_FLAGS) 28 | 29 | TARGETS = do_script do_script2 testvst3.exe 30 | 31 | # -------------------------------------------------------------- 32 | 33 | all: $(TARGETS) 34 | 35 | do_script: 36 | $(shell chmod +x ./lin-patchwin) 37 | 38 | do_script2: 39 | ./lin-patchwin 40 | 41 | testvst3.exe: testvst3.wine.o memorystream.wine.o basewrapper.wine.o 42 | $(WINECXX) $^ $(LINK_WINE) -o $@ 43 | 44 | # -------------------------------------------------------------- 45 | 46 | testvst3.wine.o: testvst3.cpp 47 | $(WINECXX) $(BUILD_FLAGS_WIN) -c $^ -o $@ 48 | 49 | memorystream.wine.o: ../public.sdk/source/common/memorystream.cpp 50 | $(WINECXX) $(BUILD_FLAGS_WIN) -c $^ -o $@ 51 | 52 | basewrapper.wine.o: basewrapper.cpp 53 | $(WINECXX) $(BUILD_FLAGS_WIN) -c $^ -o $@ 54 | 55 | 56 | -------------------------------------------------------------------------------- /paths.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | vst: a DSSI plugin wrapper for VST effects and instruments 3 | Copyright 2004-2007 Chris Cannam 4 | */ 5 | 6 | #include "paths.h" 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | std::vector Paths::getPath(std::string envVar, std::string deflt, 18 | std::string defltHomeRelPath) { 19 | std::vector pathList; 20 | std::string path; 21 | 22 | char *cpath = getenv(envVar.c_str()); 23 | if (cpath) 24 | path = cpath; 25 | 26 | if (path == "") { 27 | path = deflt; 28 | char *home = getenv("HOME"); 29 | if (home && (defltHomeRelPath != "")) { 30 | path = std::string(home) + defltHomeRelPath + ":" + path; 31 | } 32 | std::cerr << envVar << " not set, defaulting to " << path << std::endl; 33 | } 34 | 35 | std::string::size_type index = 0, newindex = 0; 36 | 37 | while ((newindex = path.find(':', index)) < path.size()) { 38 | pathList.push_back(path.substr(index, newindex - index)); 39 | index = newindex + 1; 40 | } 41 | 42 | pathList.push_back(path.substr(index)); 43 | 44 | return pathList; 45 | } 46 | 47 | // Behaves like mkstemp, but for shared memory. 48 | int shm_mkstemp(char *fileBase) { 49 | /* 50 | const char charSet[] = "abcdefghijklmnopqrstuvwxyz" 51 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 52 | "0123456789"; 53 | int size = strlen(fileBase); 54 | if (size < 6) { 55 | errno = EINVAL; 56 | return -1; 57 | } 58 | 59 | if (strcmp(fileBase + size - 6, "XXXXXX") != 0) { 60 | errno = EINVAL; 61 | return -1; 62 | } 63 | 64 | while (1) { 65 | for (int c = size - 6; c < size; c++) { 66 | // Note the -1 to avoid the trailing '\0' in charSet. 67 | fileBase[c] = charSet[rand() % (sizeof(charSet) - 1)]; 68 | } 69 | 70 | int fd = shm_open(fileBase, O_RDWR | O_CREAT | O_EXCL, 0660); 71 | if (fd >= 0) { 72 | return fd; 73 | } else if (errno != EEXIST) { 74 | return -1; 75 | } 76 | } 77 | */ 78 | } 79 | -------------------------------------------------------------------------------- /TestVst3/testvst3gui/testvst3gui.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | gchar *folderpath; 9 | 10 | int folderhit = 0; 11 | 12 | int doconvert(char *folder) 13 | { 14 | std::string cfolder = folder; 15 | 16 | std::string command = "./testvst3-batch "; 17 | 18 | std::string extra = "/"; 19 | 20 | command = command + cfolder + extra; 21 | 22 | system(command.c_str()); 23 | 24 | return 0; 25 | } 26 | 27 | void quitcallback () 28 | { 29 | 30 | if(folderpath) 31 | g_free(folderpath); 32 | 33 | gtk_main_quit (); 34 | 35 | } 36 | 37 | void foldercallback (GtkFileChooser *folderselect) 38 | { 39 | 40 | folderpath = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (folderselect)); 41 | 42 | folderhit = 1; 43 | 44 | } 45 | 46 | void buttoncallback(GtkFileChooser *button) 47 | { 48 | 49 | if(folderhit == 1) 50 | { 51 | if(doconvert(folderpath) == 1) 52 | { 53 | gtk_button_set_label(GTK_BUTTON (button), "Not Found"); 54 | folderhit = 0; 55 | return; 56 | } 57 | 58 | gtk_button_set_label(GTK_BUTTON (button), "Done"); 59 | 60 | folderhit = 0; 61 | } 62 | 63 | } 64 | 65 | int main (int argc, char *argv[]) 66 | { 67 | GtkWidget *window, *folderselect, *spacertext2, *vbox, *button; 68 | GtkFileFilter *extfilter; 69 | 70 | gtk_init (&argc, &argv); 71 | 72 | window = gtk_window_new (GTK_WINDOW_TOPLEVEL); 73 | gtk_window_set_title (GTK_WINDOW (window), "TestVst"); 74 | gtk_container_set_border_width (GTK_CONTAINER (window), 8); 75 | 76 | spacertext2 = gtk_label_new ("Choose vst3 dll folder"); 77 | 78 | folderselect = gtk_file_chooser_button_new ("Choose vst3 dll Folder", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); 79 | 80 | button = gtk_button_new (); 81 | gtk_button_set_label(GTK_BUTTON (button), "Start"); 82 | 83 | vbox = gtk_vbox_new (FALSE, 8); 84 | 85 | gtk_box_pack_start(GTK_BOX (vbox), spacertext2, FALSE, FALSE, 0); 86 | gtk_box_pack_start(GTK_BOX (vbox), folderselect, FALSE, FALSE, 0); 87 | gtk_box_pack_start(GTK_BOX (vbox), button, FALSE, FALSE, 0); 88 | 89 | g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (quitcallback), NULL); 90 | g_signal_connect (G_OBJECT (folderselect), "selection_changed", G_CALLBACK (foldercallback), NULL); 91 | g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (buttoncallback), NULL); 92 | 93 | gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(folderselect), TRUE); 94 | 95 | gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (folderselect), g_get_home_dir()); 96 | 97 | gtk_container_add (GTK_CONTAINER (window), vbox); 98 | gtk_widget_show_all (window); 99 | 100 | gtk_main (); 101 | return 0; 102 | } 103 | 104 | -------------------------------------------------------------------------------- /remoteplugin.h: -------------------------------------------------------------------------------- 1 | /* dssi-vst: a DSSI plugin wrapper for VST effects and instruments 2 | Copyright 2004-2007 Chris Cannam 3 | */ 4 | 5 | #ifndef REMOTE_PLUGIN_H 6 | #define REMOTE_PLUGIN_H 7 | 8 | #define VSTSIZE 2048 9 | 10 | #ifdef CHUNKBUF 11 | #define CHUNKSIZEMAX 1024 * 512 12 | #define CHUNKSIZE 1024 * 512 13 | #else 14 | #define CHUNKSIZEMAX 1024 * 1024 * 2 15 | #endif 16 | 17 | #define PROCESSSIZE (1024 * 768 * 2) 18 | #define VSTEVENTS_PROCESS (1024 * 128) 19 | #define VSTEVENTS_SEND (1024 * 128) 20 | 21 | struct alignas(64) ParamState { 22 | float value; 23 | float valueupdate; 24 | char changed; 25 | }; 26 | 27 | #define PARCACHE (sizeof(ParamState) * 10000) 28 | 29 | const float RemotePluginVersion = 0.986; 30 | 31 | enum RemotePluginDebugLevel { 32 | RemotePluginDebugNone, 33 | RemotePluginDebugSetup, 34 | RemotePluginDebugEvents, 35 | RemotePluginDebugData 36 | }; 37 | 38 | enum RemotePluginOpcode { 39 | RemotePluginGetVersion = 0, 40 | RemotePluginUniqueID, 41 | RemotePluginGetName, 42 | RemotePluginGetMaker, 43 | RemotePluginGetFlags, 44 | RemotePluginGetinitialDelay, 45 | RemotePluginProcessEvents, 46 | RemotePluginGetChunk, 47 | RemotePluginSetChunk, 48 | RemotePluginCanBeAutomated, 49 | RemotePluginGetProgram, 50 | RemotePluginEffectOpen, 51 | // RemotePluginGetUniqueID, 52 | // RemotePluginGetInitialDelay, 53 | 54 | RemotePluginSetBufferSize = 100, 55 | RemotePluginSetSampleRate, 56 | RemotePluginReset, 57 | RemotePluginTerminate, 58 | 59 | RemotePluginGetInputCount = 200, 60 | RemotePluginGetOutputCount, 61 | 62 | RemotePluginGetParameterCount = 300, 63 | RemotePluginGetParameterName, 64 | RemotePluginGetParameterDisplay, 65 | RemotePluginGetParameterLabel, 66 | #ifdef WAVES 67 | RemotePluginGetShellName, 68 | #endif 69 | RemotePluginSetParameter, 70 | RemotePluginGetParameter, 71 | RemotePluginGetParameterDefault, 72 | RemotePluginGetParameters, 73 | 74 | RemotePluginGetProgramCount = 350, 75 | RemotePluginGetProgramNameIndexed, 76 | RemotePluginGetProgramName, 77 | RemotePluginSetCurrentProgram, 78 | 79 | RemotePluginProcess = 500, 80 | RemotePluginIsReady, 81 | 82 | RemotePluginSetDebugLevel = 600, 83 | RemotePluginWarn, 84 | 85 | RemotePluginShowGUI = 700, 86 | RemotePluginHideGUI, 87 | 88 | #ifdef EMBED 89 | RemotePluginOpenGUI, 90 | #endif 91 | 92 | RemotePluginGetEffInt = 800, 93 | RemotePluginGetEffString, 94 | RemotePluginDoVoid, 95 | RemotePluginDoVoid2, 96 | #ifdef DOUBLEP 97 | RemotePluginProcessDouble, 98 | RemoteSetPrecision, 99 | #endif 100 | RemoteInProp, 101 | RemoteOutProp, 102 | #ifdef MIDIEFF 103 | RemoteMidiKey, 104 | RemoteMidiProgName, 105 | RemoteMidiCurProg, 106 | RemoteMidiProgCat, 107 | RemoteMidiProgCh, 108 | RemoteSetSpeaker, 109 | RemoteGetSpeaker, 110 | #endif 111 | #ifdef CANDOEFF 112 | RemotePluginEffCanDo, 113 | #endif 114 | #ifdef CHUNKBUF 115 | RemotePluginGetBuf, 116 | RemotePluginSetBuf, 117 | #endif 118 | RemotePluginNoOpcode = 9999 119 | }; 120 | 121 | #endif 122 | -------------------------------------------------------------------------------- /lin-patchwin-old: -------------------------------------------------------------------------------- 1 | sed -i 's@#define sprintf16 swprintf2@#define sprintf16 swprintf@g' ../base/source/fstring.cpp 2 | sed -i 's@sprintf16 ((wchar_t \*)@sprintf16 (@g' ../base/source/fstring.cpp 3 | sed -i 's@sprintf16 (@sprintf16 ((wchar_t \*)@g' ../base/source/fstring.cpp 4 | sed -i 's@strrchr16 ((wchar_t \*)@strrchr16 (@g' ../base/source/fstring.cpp 5 | sed -i 's@strrchr16 (@strrchr16 ((wchar_t \*)@g' ../base/source/fstring.cpp 6 | sed -i 's@#define stricmp16 wcsicmp@#include \n #include \n #include \n #include \n int swprintf2 (wchar_t\* wcs, const wchar_t\* format, ... ) \n { \n va_list args; \n va_start (args, format); \n int ret = vswprintf(wcs, 2048, format, args); \n va_end (args); \n return ret; \n } \n #define stricmp16 wcscasecmp@g' ../base/source/fstring.cpp 7 | sed -i 's@#define strnicmp16 wcsnicmp@#define strnicmp16 wcsncasecmp@g' ../base/source/fstring.cpp 8 | sed -i 's@#define sprintf16 swprintf@#define sprintf16 swprintf2@g' ../base/source/fstring.cpp 9 | sed -i 's@#define stricmp _stricmp@@g' ../base/source/fstring.cpp 10 | sed -i 's@#define strnicmp _strnicmp@@g' ../base/source/fstring.cpp 11 | sed -i 's@#define snprintf _snprintf@@g' ../base/source/fstring.cpp 12 | sed -i 's@#define vsnprintf _vsnprintf@@g' ../base/source/fstring.cpp 13 | sed -i 's@#define snwprintf _snwprintf@#define snwprintf swprintf@g' ../base/source/fstring.cpp 14 | sed -i 's@#define vsnwprintf _vsnwprintf@#define vsnwprintf vswprintf@g' ../base/source/fstring.cpp 15 | sed -i 's@return GetTickCount64 ();@struct timespec now; \n if (clock_gettime(CLOCK_MONOTONIC, \&now)) \n return 0; \n return now.tv_sec \* 1000.0 + now.tv_nsec / 1000000.0;@g' ../base/source/timer.cpp 16 | sed -i 's@#include @#include \n #include @g' ../base/source/timer.cpp 17 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/funknown.cpp 18 | sed -i '/GUID guid;/,/}/c\ \n' ../pluginterfaces/base/funknown.cpp 19 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/ustring.cpp 20 | sed -i 's@tstrlen ((char16_t)@tstrlen (@g' ../public.sdk/source/vst/vstparameters.cpp 21 | sed -i 's@tstrlen((char16_t)@tstrlen(@g' ../public.sdk/source/vst/vstparameters.cpp 22 | sed -i 's@tstrlen (@tstrlen ((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 23 | sed -i 's@tstrlen(@tstrlen((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 24 | sed -i 's@include_directories(${ROOT} ${SDK_ROOT})@include_directories(${ROOT} ${SDK_ROOT} "/usr/include/wine-development/windows" "/usr/include/wine-development/wine/windows" "/usr/include/wine/wine/windows") \n add_definitions(-DRELEASE=1) \n add_definitions(-D_stricmp=strcasecmp) \n add_definitions(-D_strnicmp=strncasecmp) \n add_definitions(-Dstricmp=strcasecmp) \n add_definitions(-Dstrnicmp=strncasecmp) \n add_definitions(-D__forceinline=inline) \n add_definitions(-DWIN32_LEAN_AND_MEAN) \n add_definitions(-DUNICODE_OFF) \n add_definitions(-DNOMINMAX=1) \n add_definitions(-fpermissive) \n add_definitions(-m64) \n add_definitions(-fPIC)@g' ../CMakeLists.txt 25 | mkdir ../build 26 | cd ../build 27 | cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/wineg++ -DCMAKE_CC_COMPILER=/usr/bin/winegcc -DCMAKE_BUILD_TYPE=Release 28 | cd ./base 29 | make 30 | cd ../public.sdk 31 | make 32 | 33 | -------------------------------------------------------------------------------- /TestVst3/lin-patchwin-old: -------------------------------------------------------------------------------- 1 | sed -i 's@#define sprintf16 swprintf2@#define sprintf16 swprintf@g' ../base/source/fstring.cpp 2 | sed -i 's@sprintf16 ((wchar_t \*)@sprintf16 (@g' ../base/source/fstring.cpp 3 | sed -i 's@sprintf16 (@sprintf16 ((wchar_t \*)@g' ../base/source/fstring.cpp 4 | sed -i 's@strrchr16 ((wchar_t \*)@strrchr16 (@g' ../base/source/fstring.cpp 5 | sed -i 's@strrchr16 (@strrchr16 ((wchar_t \*)@g' ../base/source/fstring.cpp 6 | sed -i 's@#define stricmp16 wcsicmp@#include \n #include \n #include \n #include \n int swprintf2 (wchar_t\* wcs, const wchar_t\* format, ... ) \n { \n va_list args; \n va_start (args, format); \n int ret = vswprintf(wcs, 2048, format, args); \n va_end (args); \n return ret; \n } \n #define stricmp16 wcscasecmp@g' ../base/source/fstring.cpp 7 | sed -i 's@#define strnicmp16 wcsnicmp@#define strnicmp16 wcsncasecmp@g' ../base/source/fstring.cpp 8 | sed -i 's@#define sprintf16 swprintf@#define sprintf16 swprintf2@g' ../base/source/fstring.cpp 9 | sed -i 's@#define stricmp _stricmp@@g' ../base/source/fstring.cpp 10 | sed -i 's@#define strnicmp _strnicmp@@g' ../base/source/fstring.cpp 11 | sed -i 's@#define snprintf _snprintf@@g' ../base/source/fstring.cpp 12 | sed -i 's@#define vsnprintf _vsnprintf@@g' ../base/source/fstring.cpp 13 | sed -i 's@#define snwprintf _snwprintf@#define snwprintf swprintf@g' ../base/source/fstring.cpp 14 | sed -i 's@#define vsnwprintf _vsnwprintf@#define vsnwprintf vswprintf@g' ../base/source/fstring.cpp 15 | sed -i 's@return GetTickCount64 ();@struct timespec now; \n if (clock_gettime(CLOCK_MONOTONIC, \&now)) \n return 0; \n return now.tv_sec \* 1000.0 + now.tv_nsec / 1000000.0;@g' ../base/source/timer.cpp 16 | sed -i 's@#include @#include \n #include @g' ../base/source/timer.cpp 17 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/funknown.cpp 18 | sed -i '/GUID guid;/,/}/c\ \n' ../pluginterfaces/base/funknown.cpp 19 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/ustring.cpp 20 | sed -i 's@tstrlen ((char16_t)@tstrlen (@g' ../public.sdk/source/vst/vstparameters.cpp 21 | sed -i 's@tstrlen((char16_t)@tstrlen(@g' ../public.sdk/source/vst/vstparameters.cpp 22 | sed -i 's@tstrlen (@tstrlen ((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 23 | sed -i 's@tstrlen(@tstrlen((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 24 | sed -i 's@include_directories(${ROOT} ${SDK_ROOT})@include_directories(${ROOT} ${SDK_ROOT} "/usr/include/wine-development/windows" "/usr/include/wine-development/wine/windows" "/usr/include/wine/wine/windows") \n add_definitions(-DRELEASE=1) \n add_definitions(-D_stricmp=strcasecmp) \n add_definitions(-D_strnicmp=strncasecmp) \n add_definitions(-Dstricmp=strcasecmp) \n add_definitions(-Dstrnicmp=strncasecmp) \n add_definitions(-D__forceinline=inline) \n add_definitions(-DWIN32_LEAN_AND_MEAN) \n add_definitions(-DUNICODE_OFF) \n add_definitions(-DNOMINMAX=1) \n add_definitions(-fpermissive) \n add_definitions(-m64) \n add_definitions(-fPIC)@g' ../CMakeLists.txt 25 | mkdir ../build 26 | cd ../build 27 | cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/wineg++ -DCMAKE_CC_COMPILER=/usr/bin/winegcc -DCMAKE_BUILD_TYPE=Release 28 | cd ./base 29 | make 30 | cd ../public.sdk 31 | make 32 | 33 | -------------------------------------------------------------------------------- /lin-patchwin-2019_build_81: -------------------------------------------------------------------------------- 1 | sed -i 's@#define sprintf16 swprintf2@#define sprintf16 swprintf@g' ../base/source/fstring.cpp 2 | sed -i 's@sprintf16 ((wchar_t \*)@sprintf16 (@g' ../base/source/fstring.cpp 3 | sed -i 's@sprintf16 (@sprintf16 ((wchar_t \*)@g' ../base/source/fstring.cpp 4 | sed -i 's@strrchr16 ((wchar_t \*)@strrchr16 (@g' ../base/source/fstring.cpp 5 | sed -i 's@strrchr16 (@strrchr16 ((wchar_t \*)@g' ../base/source/fstring.cpp 6 | sed -i 's@#define stricmp16 wcsicmp@#include \n #include \n #include \n #include \n int swprintf2 (wchar_t\* wcs, const wchar_t\* format, ... ) \n { \n va_list args; \n va_start (args, format); \n int ret = vswprintf(wcs, 2048, format, args); \n va_end (args); \n return ret; \n } \n #define stricmp16 wcscasecmp@g' ../base/source/fstring.cpp 7 | sed -i 's@#define strnicmp16 wcsnicmp@#define strnicmp16 wcsncasecmp@g' ../base/source/fstring.cpp 8 | sed -i 's@#define sprintf16 swprintf@#define sprintf16 swprintf2@g' ../base/source/fstring.cpp 9 | sed -i 's@#define stricmp _stricmp@@g' ../base/source/fstring.cpp 10 | sed -i 's@#define strnicmp _strnicmp@@g' ../base/source/fstring.cpp 11 | sed -i 's@#define snprintf _snprintf@@g' ../base/source/fstring.cpp 12 | sed -i 's@#define vsnprintf _vsnprintf@@g' ../base/source/fstring.cpp 13 | sed -i 's@#define snwprintf _snwprintf@#define snwprintf swprintf@g' ../base/source/fstring.cpp 14 | sed -i 's@#define vsnwprintf _vsnwprintf@#define vsnwprintf vswprintf@g' ../base/source/fstring.cpp 15 | sed -i 's@return GetTickCount64 ();@struct timespec now; \n if (clock_gettime(CLOCK_MONOTONIC, \&now)) \n return 0; \n return now.tv_sec \* 1000.0 + now.tv_nsec / 1000000.0;@g' ../base/source/timer.cpp 16 | sed -i 's@#include @#include \n #include @g' ../base/source/timer.cpp 17 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/funknown.cpp 18 | sed -i '/GUID guid;/,/}/c\ \n' ../pluginterfaces/base/funknown.cpp 19 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/ustring.cpp 20 | sed -i 's@tstrlen ((char16_t)@tstrlen (@g' ../public.sdk/source/vst/vstparameters.cpp 21 | sed -i 's@tstrlen((char16_t)@tstrlen(@g' ../public.sdk/source/vst/vstparameters.cpp 22 | sed -i 's@tstrlen (@tstrlen ((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 23 | sed -i 's@tstrlen(@tstrlen((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 24 | sed -i 's@include_directories(${ROOT} ${SDK_ROOT})@include_directories(${ROOT} ${SDK_ROOT} "/usr/include/wine-development/windows" "/usr/include/wine-development/wine/windows" "/usr/include/wine/wine/windows") \n add_definitions(-DRELEASE=1) \n add_definitions(-D_stricmp=strcasecmp) \n add_definitions(-D_strnicmp=strncasecmp) \n add_definitions(-Dstricmp=strcasecmp) \n add_definitions(-Dstrnicmp=strncasecmp) \n add_definitions(-D__forceinline=inline) \n add_definitions(-DWIN32_LEAN_AND_MEAN) \n add_definitions(-DUNICODE_OFF) \n add_definitions(-DNOMINMAX=1) \n add_definitions(-fpermissive) \n add_definitions(-m64) \n add_definitions(-fPIC)@g' ../CMakeLists.txt 25 | mkdir ../build 26 | cd ../build 27 | cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/wineg++ -DCMAKE_CC_COMPILER=/usr/bin/winegcc -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_WORKS=1 28 | cd ./base 29 | make 30 | cd ../public.sdk 31 | make 32 | 33 | -------------------------------------------------------------------------------- /TestVst3/lin-patchwin-2019_build_81: -------------------------------------------------------------------------------- 1 | sed -i 's@#define sprintf16 swprintf2@#define sprintf16 swprintf@g' ../base/source/fstring.cpp 2 | sed -i 's@sprintf16 ((wchar_t \*)@sprintf16 (@g' ../base/source/fstring.cpp 3 | sed -i 's@sprintf16 (@sprintf16 ((wchar_t \*)@g' ../base/source/fstring.cpp 4 | sed -i 's@strrchr16 ((wchar_t \*)@strrchr16 (@g' ../base/source/fstring.cpp 5 | sed -i 's@strrchr16 (@strrchr16 ((wchar_t \*)@g' ../base/source/fstring.cpp 6 | sed -i 's@#define stricmp16 wcsicmp@#include \n #include \n #include \n #include \n int swprintf2 (wchar_t\* wcs, const wchar_t\* format, ... ) \n { \n va_list args; \n va_start (args, format); \n int ret = vswprintf(wcs, 2048, format, args); \n va_end (args); \n return ret; \n } \n #define stricmp16 wcscasecmp@g' ../base/source/fstring.cpp 7 | sed -i 's@#define strnicmp16 wcsnicmp@#define strnicmp16 wcsncasecmp@g' ../base/source/fstring.cpp 8 | sed -i 's@#define sprintf16 swprintf@#define sprintf16 swprintf2@g' ../base/source/fstring.cpp 9 | sed -i 's@#define stricmp _stricmp@@g' ../base/source/fstring.cpp 10 | sed -i 's@#define strnicmp _strnicmp@@g' ../base/source/fstring.cpp 11 | sed -i 's@#define snprintf _snprintf@@g' ../base/source/fstring.cpp 12 | sed -i 's@#define vsnprintf _vsnprintf@@g' ../base/source/fstring.cpp 13 | sed -i 's@#define snwprintf _snwprintf@#define snwprintf swprintf@g' ../base/source/fstring.cpp 14 | sed -i 's@#define vsnwprintf _vsnwprintf@#define vsnwprintf vswprintf@g' ../base/source/fstring.cpp 15 | sed -i 's@return GetTickCount64 ();@struct timespec now; \n if (clock_gettime(CLOCK_MONOTONIC, \&now)) \n return 0; \n return now.tv_sec \* 1000.0 + now.tv_nsec / 1000000.0;@g' ../base/source/timer.cpp 16 | sed -i 's@#include @#include \n #include @g' ../base/source/timer.cpp 17 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/funknown.cpp 18 | sed -i '/GUID guid;/,/}/c\ \n' ../pluginterfaces/base/funknown.cpp 19 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/ustring.cpp 20 | sed -i 's@tstrlen ((char16_t)@tstrlen (@g' ../public.sdk/source/vst/vstparameters.cpp 21 | sed -i 's@tstrlen((char16_t)@tstrlen(@g' ../public.sdk/source/vst/vstparameters.cpp 22 | sed -i 's@tstrlen (@tstrlen ((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 23 | sed -i 's@tstrlen(@tstrlen((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 24 | sed -i 's@include_directories(${ROOT} ${SDK_ROOT})@include_directories(${ROOT} ${SDK_ROOT} "/usr/include/wine-development/windows" "/usr/include/wine-development/wine/windows" "/usr/include/wine/wine/windows") \n add_definitions(-DRELEASE=1) \n add_definitions(-D_stricmp=strcasecmp) \n add_definitions(-D_strnicmp=strncasecmp) \n add_definitions(-Dstricmp=strcasecmp) \n add_definitions(-Dstrnicmp=strncasecmp) \n add_definitions(-D__forceinline=inline) \n add_definitions(-DWIN32_LEAN_AND_MEAN) \n add_definitions(-DUNICODE_OFF) \n add_definitions(-DNOMINMAX=1) \n add_definitions(-fpermissive) \n add_definitions(-m64) \n add_definitions(-fPIC)@g' ../CMakeLists.txt 25 | mkdir ../build 26 | cd ../build 27 | cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/wineg++ -DCMAKE_CC_COMPILER=/usr/bin/winegcc -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_WORKS=1 28 | cd ./base 29 | make 30 | cd ../public.sdk 31 | make 32 | 33 | -------------------------------------------------------------------------------- /docvst2.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------ 2 | // Project : VST SDK 3 | // 4 | // Category : Helpers 5 | // Filename : public.sdk/source/vst/vst2wrapper/docvst2.h 6 | // Created by : Steinberg, 01/2009 7 | // Description : VST 3 -> VST 2 Wrapper 8 | // 9 | //----------------------------------------------------------------------------- 10 | // LICENSE 11 | // (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved 12 | //----------------------------------------------------------------------------- 13 | // Redistribution and use in source and binary forms, with or without 14 | // modification, are permitted provided that the following conditions are met: 15 | // 16 | // * Redistributions of source code must retain the above copyright notice, 17 | // this list of conditions and the following disclaimer. 18 | // * Redistributions in binary form must reproduce the above copyright notice, 19 | // this list of conditions and the following disclaimer in the documentation 20 | // and/or other materials provided with the distribution. 21 | // * Neither the name of the Steinberg Media Technologies nor the names of its 22 | // contributors may be used to endorse or promote products derived from this 23 | // software without specific prior written permission. 24 | // 25 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | // POSSIBILITY OF SUCH DAMAGE. 36 | //----------------------------------------------------------------------------- 37 | 38 | /** 39 | ************************************** 40 | \page vst2xwrapper VST 3 - VST 2.x Wrapper 41 | ************************************** 42 | 43 | Helper Class wrapping a VST 3 Plug-in to a VST 2.4 Plug-in 44 | 45 | *************************** 46 | \section VST2Introduction Introduction 47 | *************************** 48 | The VST 3 SDK comes with a helper class which wraps one VST 3 Audio Processor 49 | and Edit Controller to a VST 2.x Plug-in. \n\n 50 | *************************** 51 | \section VST2howdoesitwork How does it work? 52 | *************************** 53 | You just need to add public.sdk/source/vst/vst2wrapper/vst2wrapper.sdk.cpp to 54 | your project and add the following code somewhere in your sources: \code 55 | 56 | #include "public.sdk/source/vst/vst2wrapper/vst2wrapper.h" 57 | 58 | //------------------------------------------------------------------------ 59 | ::AudioEffect* createEffectInstance (audioMasterCallback audioMaster) 60 | { 61 | return Steinberg::Vst::Vst2Wrapper::create (GetPluginFactory (), 62 | kAudioProcessorCID, kVst2UniqueID, audioMaster); 63 | } 64 | 65 | \endcode 66 | */ 67 | -------------------------------------------------------------------------------- /vst3-sdks/vstsdk3613_08_04_2019_build_81/lin-patchwin: -------------------------------------------------------------------------------- 1 | sed -i 's@#define sprintf16 swprintf2@#define sprintf16 swprintf@g' ../base/source/fstring.cpp 2 | sed -i 's@sprintf16 ((wchar_t \*)@sprintf16 (@g' ../base/source/fstring.cpp 3 | sed -i 's@sprintf16 (@sprintf16 ((wchar_t \*)@g' ../base/source/fstring.cpp 4 | sed -i 's@strrchr16 ((wchar_t \*)@strrchr16 (@g' ../base/source/fstring.cpp 5 | sed -i 's@strrchr16 (@strrchr16 ((wchar_t \*)@g' ../base/source/fstring.cpp 6 | sed -i 's@#define stricmp16 wcsicmp@#include \n #include \n #include \n #include \n int swprintf2 (wchar_t\* wcs, const wchar_t\* format, ... ) \n { \n va_list args; \n va_start (args, format); \n int ret = vswprintf(wcs, 2048, format, args); \n va_end (args); \n return ret; \n } \n #define stricmp16 wcscasecmp@g' ../base/source/fstring.cpp 7 | sed -i 's@#define strnicmp16 wcsnicmp@#define strnicmp16 wcsncasecmp@g' ../base/source/fstring.cpp 8 | sed -i 's@#define sprintf16 swprintf@#define sprintf16 swprintf2@g' ../base/source/fstring.cpp 9 | sed -i 's@#define stricmp _stricmp@@g' ../base/source/fstring.cpp 10 | sed -i 's@#define strnicmp _strnicmp@@g' ../base/source/fstring.cpp 11 | sed -i 's@#define snprintf _snprintf@@g' ../base/source/fstring.cpp 12 | sed -i 's@#define vsnprintf _vsnprintf@@g' ../base/source/fstring.cpp 13 | sed -i 's@#define snwprintf _snwprintf@#define snwprintf swprintf@g' ../base/source/fstring.cpp 14 | sed -i 's@#define vsnwprintf _vsnwprintf@#define vsnwprintf vswprintf@g' ../base/source/fstring.cpp 15 | sed -i 's@return GetTickCount64 ();@struct timespec now; \n if (clock_gettime(CLOCK_MONOTONIC, \&now)) \n return 0; \n return now.tv_sec \* 1000.0 + now.tv_nsec / 1000000.0;@g' ../base/source/timer.cpp 16 | sed -i 's@#include @#include \n #include @g' ../base/source/timer.cpp 17 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/funknown.cpp 18 | sed -i '/GUID guid;/,/}/c\ \n' ../pluginterfaces/base/funknown.cpp 19 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/ustring.cpp 20 | sed -i 's@tstrlen ((char16_t)@tstrlen (@g' ../public.sdk/source/vst/vstparameters.cpp 21 | sed -i 's@tstrlen((char16_t)@tstrlen(@g' ../public.sdk/source/vst/vstparameters.cpp 22 | sed -i 's@tstrlen (@tstrlen ((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 23 | sed -i 's@tstrlen(@tstrlen((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 24 | sed -i 's@include_directories(${ROOT} ${SDK_ROOT})@include_directories(${ROOT} ${SDK_ROOT} "/usr/include/wine-development/windows" "/usr/include/wine-development/wine/windows" "/usr/include/wine/wine/windows") \n add_definitions(-DRELEASE=1) \n add_definitions(-D_stricmp=strcasecmp) \n add_definitions(-D_strnicmp=strncasecmp) \n add_definitions(-Dstricmp=strcasecmp) \n add_definitions(-Dstrnicmp=strncasecmp) \n add_definitions(-D__forceinline=inline) \n add_definitions(-DWIN32_LEAN_AND_MEAN) \n add_definitions(-DUNICODE_OFF) \n add_definitions(-DNOMINMAX=1) \n add_definitions(-fpermissive) \n add_definitions(-m64) \n add_definitions(-fPIC)@g' ../CMakeLists.txt 25 | mkdir ../build 26 | cd ../build 27 | cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/wineg++ -DCMAKE_CC_COMPILER=/usr/bin/winegcc -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_WORKS=1 28 | cd ./base 29 | make 30 | cd ../public.sdk 31 | make 32 | 33 | -------------------------------------------------------------------------------- /TestVst3/docvst2.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------ 2 | // Project : VST SDK 3 | // 4 | // Category : Helpers 5 | // Filename : public.sdk/source/vst/vst2wrapper/docvst2.h 6 | // Created by : Steinberg, 01/2009 7 | // Description : VST 3 -> VST 2 Wrapper 8 | // 9 | //----------------------------------------------------------------------------- 10 | // LICENSE 11 | // (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved 12 | //----------------------------------------------------------------------------- 13 | // Redistribution and use in source and binary forms, with or without 14 | // modification, are permitted provided that the following conditions are met: 15 | // 16 | // * Redistributions of source code must retain the above copyright notice, 17 | // this list of conditions and the following disclaimer. 18 | // * Redistributions in binary form must reproduce the above copyright notice, 19 | // this list of conditions and the following disclaimer in the documentation 20 | // and/or other materials provided with the distribution. 21 | // * Neither the name of the Steinberg Media Technologies nor the names of its 22 | // contributors may be used to endorse or promote products derived from this 23 | // software without specific prior written permission. 24 | // 25 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | // POSSIBILITY OF SUCH DAMAGE. 36 | //----------------------------------------------------------------------------- 37 | 38 | /** 39 | ************************************** 40 | \page vst2xwrapper VST 3 - VST 2.x Wrapper 41 | ************************************** 42 | 43 | Helper Class wrapping a VST 3 Plug-in to a VST 2.4 Plug-in 44 | 45 | *************************** 46 | \section VST2Introduction Introduction 47 | *************************** 48 | The VST 3 SDK comes with a helper class which wraps one VST 3 Audio Processor 49 | and Edit Controller to a VST 2.x Plug-in. \n\n 50 | *************************** 51 | \section VST2howdoesitwork How does it work? 52 | *************************** 53 | You just need to add public.sdk/source/vst/vst2wrapper/vst2wrapper.sdk.cpp to 54 | your project and add the following code somewhere in your sources: \code 55 | 56 | #include "public.sdk/source/vst/vst2wrapper/vst2wrapper.h" 57 | 58 | //------------------------------------------------------------------------ 59 | ::AudioEffect* createEffectInstance (audioMasterCallback audioMaster) 60 | { 61 | return Steinberg::Vst::Vst2Wrapper::create (GetPluginFactory (), 62 | kAudioProcessorCID, kVst2UniqueID, audioMaster); 63 | } 64 | 65 | \endcode 66 | */ 67 | -------------------------------------------------------------------------------- /lin-patchwin-build-24_2019-11-29: -------------------------------------------------------------------------------- 1 | sed -i 's@#define sprintf16 swprintf2@#define sprintf16 swprintf@g' ../base/source/fstring.cpp 2 | sed -i 's@sprintf16 ((wchar_t \*)@sprintf16 (@g' ../base/source/fstring.cpp 3 | sed -i 's@sprintf16 (@sprintf16 ((wchar_t \*)@g' ../base/source/fstring.cpp 4 | sed -i 's@strrchr16 ((wchar_t \*)@strrchr16 (@g' ../base/source/fstring.cpp 5 | sed -i 's@strrchr16 (@strrchr16 ((wchar_t \*)@g' ../base/source/fstring.cpp 6 | sed -i 's@#define stricmp16 wcsicmp@#include \n #include \n #include \n #include \n int swprintf2 (wchar_t\* wcs, const wchar_t\* format, ... ) \n { \n va_list args; \n va_start (args, format); \n int ret = vswprintf(wcs, 2048, format, args); \n va_end (args); \n return ret; \n } \n #define stricmp16 wcscasecmp@g' ../base/source/fstring.cpp 7 | sed -i 's@#define strnicmp16 wcsnicmp@#define strnicmp16 wcsncasecmp@g' ../base/source/fstring.cpp 8 | sed -i 's@#define sprintf16 swprintf@#define sprintf16 swprintf2@g' ../base/source/fstring.cpp 9 | sed -i 's@#define stricmp _stricmp@@g' ../base/source/fstring.cpp 10 | sed -i 's@#define strnicmp _strnicmp@@g' ../base/source/fstring.cpp 11 | sed -i 's@#define snprintf _snprintf@@g' ../base/source/fstring.cpp 12 | sed -i 's@#define vsnprintf _vsnprintf@@g' ../base/source/fstring.cpp 13 | sed -i 's@#define snwprintf _snwprintf@#define snwprintf swprintf@g' ../base/source/fstring.cpp 14 | sed -i 's@#define vsnwprintf _vsnwprintf@#define vsnwprintf vswprintf@g' ../base/source/fstring.cpp 15 | sed -i 's@return GetTickCount64 ();@struct timespec now; \n if (clock_gettime(CLOCK_MONOTONIC, \&now)) \n return 0; \n return now.tv_sec \* 1000.0 + now.tv_nsec / 1000000.0;@g' ../base/source/timer.cpp 16 | sed -i 's@#include @#include \n #include @g' ../base/source/timer.cpp 17 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/funknown.cpp 18 | sed -i '/GUID guid;/,/}/c\ \n' ../pluginterfaces/base/funknown.cpp 19 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/ustring.cpp 20 | sed -i 's@tstrlen ((char16_t)@tstrlen (@g' ../public.sdk/source/vst/vstparameters.cpp 21 | sed -i 's@tstrlen((char16_t)@tstrlen(@g' ../public.sdk/source/vst/vstparameters.cpp 22 | sed -i 's@tstrlen (@tstrlen ((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 23 | sed -i 's@tstrlen(@tstrlen((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 24 | sed -i 's@#include @// #include @g' ../public.sdk/source/common/threadchecker_win32.cpp 25 | sed -i 's@include_directories(${ROOT} ${SDK_ROOT})@include_directories(${ROOT} ${SDK_ROOT} "/usr/include/wine-development/windows" "/usr/include/wine-development/wine/windows" "/usr/include/wine/wine/windows") \n add_definitions(-DRELEASE=1) \n add_definitions(-D_stricmp=strcasecmp) \n add_definitions(-D_strnicmp=strncasecmp) \n add_definitions(-Dstricmp=strcasecmp) \n add_definitions(-Dstrnicmp=strncasecmp) \n add_definitions(-D__forceinline=inline) \n add_definitions(-DWIN32_LEAN_AND_MEAN) \n add_definitions(-DUNICODE_OFF) \n add_definitions(-DNOMINMAX=1) \n add_definitions(-fpermissive) \n add_definitions(-m64) \n add_definitions(-fPIC)@g' ../CMakeLists.txt 26 | mkdir ../build 27 | cd ../build 28 | cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/wineg++ -DCMAKE_CC_COMPILER=/usr/bin/winegcc -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_WORKS=1 29 | cd ./base 30 | make 31 | cd ../public.sdk 32 | make 33 | 34 | -------------------------------------------------------------------------------- /TestVst3/lin-patchwin-build-24_2019-11-29: -------------------------------------------------------------------------------- 1 | sed -i 's@#define sprintf16 swprintf2@#define sprintf16 swprintf@g' ../base/source/fstring.cpp 2 | sed -i 's@sprintf16 ((wchar_t \*)@sprintf16 (@g' ../base/source/fstring.cpp 3 | sed -i 's@sprintf16 (@sprintf16 ((wchar_t \*)@g' ../base/source/fstring.cpp 4 | sed -i 's@strrchr16 ((wchar_t \*)@strrchr16 (@g' ../base/source/fstring.cpp 5 | sed -i 's@strrchr16 (@strrchr16 ((wchar_t \*)@g' ../base/source/fstring.cpp 6 | sed -i 's@#define stricmp16 wcsicmp@#include \n #include \n #include \n #include \n int swprintf2 (wchar_t\* wcs, const wchar_t\* format, ... ) \n { \n va_list args; \n va_start (args, format); \n int ret = vswprintf(wcs, 2048, format, args); \n va_end (args); \n return ret; \n } \n #define stricmp16 wcscasecmp@g' ../base/source/fstring.cpp 7 | sed -i 's@#define strnicmp16 wcsnicmp@#define strnicmp16 wcsncasecmp@g' ../base/source/fstring.cpp 8 | sed -i 's@#define sprintf16 swprintf@#define sprintf16 swprintf2@g' ../base/source/fstring.cpp 9 | sed -i 's@#define stricmp _stricmp@@g' ../base/source/fstring.cpp 10 | sed -i 's@#define strnicmp _strnicmp@@g' ../base/source/fstring.cpp 11 | sed -i 's@#define snprintf _snprintf@@g' ../base/source/fstring.cpp 12 | sed -i 's@#define vsnprintf _vsnprintf@@g' ../base/source/fstring.cpp 13 | sed -i 's@#define snwprintf _snwprintf@#define snwprintf swprintf@g' ../base/source/fstring.cpp 14 | sed -i 's@#define vsnwprintf _vsnwprintf@#define vsnwprintf vswprintf@g' ../base/source/fstring.cpp 15 | sed -i 's@return GetTickCount64 ();@struct timespec now; \n if (clock_gettime(CLOCK_MONOTONIC, \&now)) \n return 0; \n return now.tv_sec \* 1000.0 + now.tv_nsec / 1000000.0;@g' ../base/source/timer.cpp 16 | sed -i 's@#include @#include \n #include @g' ../base/source/timer.cpp 17 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/funknown.cpp 18 | sed -i '/GUID guid;/,/}/c\ \n' ../pluginterfaces/base/funknown.cpp 19 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/ustring.cpp 20 | sed -i 's@tstrlen ((char16_t)@tstrlen (@g' ../public.sdk/source/vst/vstparameters.cpp 21 | sed -i 's@tstrlen((char16_t)@tstrlen(@g' ../public.sdk/source/vst/vstparameters.cpp 22 | sed -i 's@tstrlen (@tstrlen ((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 23 | sed -i 's@tstrlen(@tstrlen((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 24 | sed -i 's@#include @// #include @g' ../public.sdk/source/common/threadchecker_win32.cpp 25 | sed -i 's@include_directories(${ROOT} ${SDK_ROOT})@include_directories(${ROOT} ${SDK_ROOT} "/usr/include/wine-development/windows" "/usr/include/wine-development/wine/windows" "/usr/include/wine/wine/windows") \n add_definitions(-DRELEASE=1) \n add_definitions(-D_stricmp=strcasecmp) \n add_definitions(-D_strnicmp=strncasecmp) \n add_definitions(-Dstricmp=strcasecmp) \n add_definitions(-Dstrnicmp=strncasecmp) \n add_definitions(-D__forceinline=inline) \n add_definitions(-DWIN32_LEAN_AND_MEAN) \n add_definitions(-DUNICODE_OFF) \n add_definitions(-DNOMINMAX=1) \n add_definitions(-fpermissive) \n add_definitions(-m64) \n add_definitions(-fPIC)@g' ../CMakeLists.txt 26 | mkdir ../build 27 | cd ../build 28 | cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/wineg++ -DCMAKE_CC_COMPILER=/usr/bin/winegcc -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_WORKS=1 29 | cd ./base 30 | make 31 | cd ../public.sdk 32 | make 33 | 34 | -------------------------------------------------------------------------------- /vst3-sdks/vst-sdk_3.6.14_build-24_2019-11-29/lin-patchwin: -------------------------------------------------------------------------------- 1 | sed -i 's@#define sprintf16 swprintf2@#define sprintf16 swprintf@g' ../base/source/fstring.cpp 2 | sed -i 's@sprintf16 ((wchar_t \*)@sprintf16 (@g' ../base/source/fstring.cpp 3 | sed -i 's@sprintf16 (@sprintf16 ((wchar_t \*)@g' ../base/source/fstring.cpp 4 | sed -i 's@strrchr16 ((wchar_t \*)@strrchr16 (@g' ../base/source/fstring.cpp 5 | sed -i 's@strrchr16 (@strrchr16 ((wchar_t \*)@g' ../base/source/fstring.cpp 6 | sed -i 's@#define stricmp16 wcsicmp@#include \n #include \n #include \n #include \n int swprintf2 (wchar_t\* wcs, const wchar_t\* format, ... ) \n { \n va_list args; \n va_start (args, format); \n int ret = vswprintf(wcs, 2048, format, args); \n va_end (args); \n return ret; \n } \n #define stricmp16 wcscasecmp@g' ../base/source/fstring.cpp 7 | sed -i 's@#define strnicmp16 wcsnicmp@#define strnicmp16 wcsncasecmp@g' ../base/source/fstring.cpp 8 | sed -i 's@#define sprintf16 swprintf@#define sprintf16 swprintf2@g' ../base/source/fstring.cpp 9 | sed -i 's@#define stricmp _stricmp@@g' ../base/source/fstring.cpp 10 | sed -i 's@#define strnicmp _strnicmp@@g' ../base/source/fstring.cpp 11 | sed -i 's@#define snprintf _snprintf@@g' ../base/source/fstring.cpp 12 | sed -i 's@#define vsnprintf _vsnprintf@@g' ../base/source/fstring.cpp 13 | sed -i 's@#define snwprintf _snwprintf@#define snwprintf swprintf@g' ../base/source/fstring.cpp 14 | sed -i 's@#define vsnwprintf _vsnwprintf@#define vsnwprintf vswprintf@g' ../base/source/fstring.cpp 15 | sed -i 's@return GetTickCount64 ();@struct timespec now; \n if (clock_gettime(CLOCK_MONOTONIC, \&now)) \n return 0; \n return now.tv_sec \* 1000.0 + now.tv_nsec / 1000000.0;@g' ../base/source/timer.cpp 16 | sed -i 's@#include @#include \n #include @g' ../base/source/timer.cpp 17 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/funknown.cpp 18 | sed -i '/GUID guid;/,/}/c\ \n' ../pluginterfaces/base/funknown.cpp 19 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/ustring.cpp 20 | sed -i 's@tstrlen ((char16_t)@tstrlen (@g' ../public.sdk/source/vst/vstparameters.cpp 21 | sed -i 's@tstrlen((char16_t)@tstrlen(@g' ../public.sdk/source/vst/vstparameters.cpp 22 | sed -i 's@tstrlen (@tstrlen ((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 23 | sed -i 's@tstrlen(@tstrlen((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 24 | sed -i 's@#include @// #include @g' ../public.sdk/source/common/threadchecker_win32.cpp 25 | sed -i 's@include_directories(${ROOT} ${SDK_ROOT})@include_directories(${ROOT} ${SDK_ROOT} "/usr/include/wine-development/windows" "/usr/include/wine-development/wine/windows" "/usr/include/wine/wine/windows") \n add_definitions(-DRELEASE=1) \n add_definitions(-D_stricmp=strcasecmp) \n add_definitions(-D_strnicmp=strncasecmp) \n add_definitions(-Dstricmp=strcasecmp) \n add_definitions(-Dstrnicmp=strncasecmp) \n add_definitions(-D__forceinline=inline) \n add_definitions(-DWIN32_LEAN_AND_MEAN) \n add_definitions(-DUNICODE_OFF) \n add_definitions(-DNOMINMAX=1) \n add_definitions(-fpermissive) \n add_definitions(-m64) \n add_definitions(-fPIC)@g' ../CMakeLists.txt 26 | mkdir ../build 27 | cd ../build 28 | cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/wineg++ -DCMAKE_CC_COMPILER=/usr/bin/winegcc -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_WORKS=1 29 | cd ./base 30 | make 31 | cd ../public.sdk 32 | make 33 | 34 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # Makefile for LinVst # 3 | 4 | #target: prerequisites 5 | # ./lin-patchwin 6 | 7 | 8 | #.PHONY do_script: 9 | 10 | 11 | 12 | #prerequisites: do_script 13 | 14 | 15 | 16 | CXX = g++ 17 | WINECXX = wineg++ -Wl,--subsystem,windows 18 | 19 | CXX_FLAGS = 20 | 21 | PREFIX = /usr 22 | 23 | BIN_DIR = $(DESTDIR)$(PREFIX)/bin 24 | VST_DIR = ./vst 25 | 26 | BUILD_FLAGS = -std=c++14 -fPIC -m64 -O2 -DLVRT -DEMBED -DEMBEDDRAG -DTRACKTIONWM -DVESTIGE -DNEWTIME -DINOUTMEM -DCHUNKBUF -DEMBEDRESIZE -DPCACHE -DBIN_DIR='"$(BIN_DIR)"' $(CXX_FLAGS) 27 | 28 | BUILD_FLAGS_WIN = -std=c++14 -fPIC -m64 -O2 -DEMBED -DEMBEDDRAG -DWAVES2 -DTRACKTIONWM -DVESTIGE -DNEWTIME -DINOUTMEM -DCHUNKBUF -DEMBEDRESIZE -DPCACHE -DXOFFSET -I/opt/wine-staging/include/wine/windows -I/opt/wine-stable/include/wine/windows -I/opt/wine-devel/include/wine/windows -I/usr/include/wine-development/windows -I/usr/include/wine-development/wine/windows -I/usr/include/wine/wine/windows -I../ -DRELEASE=1 -D__forceinline=inline -DNOMINMAX=1 -DUNICODE_OFF -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DSMTG_RENAME_ASSERT=1 -fpermissive 29 | 30 | #-DUNICODE_OFF 31 | LINK_FLAGS = $(LDFLAGS) 32 | 33 | LINK_PLUGIN = -shared -lpthread -ldl -lX11 $(LINK_FLAGS) 34 | LINK_WINE = ../build/lib/Release/libsdk_hosting.a ../build/lib/Release/libbase.a ../build/lib/Release/libpluginterfaces.a ../build/lib/Release/libsdk.a -L/opt/wine-stable/lib64/wine -L/opt/wine-devel/lib64/wine -L/opt/wine-staging/lib64/wine -L/opt/wine-stable/lib64/wine/x86_64-unix -L/opt/wine-devel/lib64/wine/x86_64-unix -L/opt/wine-staging/lib64/wine/x86_64-unix -L/usr/lib/x86_64-linux-gnu/wine-development -lpthread -lX11 -lshell32 -lole32 $(LINK_FLAGS) 35 | 36 | TARGETS = do_script do_script2 linvst3.so lin-vst3-server.exe 37 | 38 | PATH := $(PATH):/opt/wine-stable/bin:/opt/wine-devel/bin:/opt/wine-staging/bin 39 | 40 | # -------------------------------------------------------------- 41 | 42 | all: $(TARGETS) 43 | 44 | do_script: 45 | $(shell chmod +x ./lin-patchwin) 46 | 47 | do_script2: 48 | ./lin-patchwin 49 | 50 | linvst3.so: linvst.unix.o remotevstclient.unix.o remotepluginclient.unix.o paths.unix.o 51 | $(CXX) $^ $(LINK_PLUGIN) -o $@ 52 | 53 | lin-vst3-server.exe: lin-vst-server.wine.o remotepluginserver.wine.o paths.wine.o memorystream.wine.o basewrapper.wine.o 54 | $(WINECXX) $^ $(LINK_WINE) -o $@ 55 | 56 | # -------------------------------------------------------------- 57 | 58 | linvst.unix.o: linvst.cpp 59 | $(CXX) $(BUILD_FLAGS) -c $^ -o $@ 60 | 61 | remotevstclient.unix.o: remotevstclient.cpp 62 | $(CXX) $(BUILD_FLAGS) -c $^ -o $@ 63 | 64 | remotepluginclient.unix.o: remotepluginclient.cpp 65 | $(CXX) $(BUILD_FLAGS) -c $^ -o $@ 66 | 67 | paths.unix.o: paths.cpp 68 | $(CXX) $(BUILD_FLAGS) -c $^ -o $@ 69 | 70 | 71 | # -------------------------------------------------------------- 72 | 73 | lin-vst-server.wine.o: lin-vst-server.cpp 74 | $(WINECXX) $(BUILD_FLAGS_WIN) -c $^ -o $@ 75 | 76 | remotepluginserver.wine.o: remotepluginserver.cpp 77 | $(WINECXX) $(BUILD_FLAGS_WIN) -c $^ -o $@ 78 | 79 | paths.wine.o: paths.cpp 80 | $(WINECXX) $(BUILD_FLAGS_WIN) -c $^ -o $@ 81 | 82 | memorystream.wine.o: ../public.sdk/source/common/memorystream.cpp 83 | $(WINECXX) $(BUILD_FLAGS_WIN) -c $^ -o $@ 84 | 85 | basewrapper.wine.o: basewrapper.cpp 86 | $(WINECXX) $(BUILD_FLAGS_WIN) -c $^ -o $@ 87 | 88 | clean: 89 | rm -fR *.o *.exe *.so vst $(TARGETS) 90 | 91 | install: 92 | install -d $(BIN_DIR) 93 | install -d $(VST_DIR) 94 | install -m 755 linvst3.so $(VST_DIR) 95 | install -m 755 lin-vst3-server.exe lin-vst3-server.exe.so $(BIN_DIR) 96 | -------------------------------------------------------------------------------- /dragwin/Makefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # Makefile for LinVst # 3 | 4 | #target: prerequisites 5 | # ./lin-patchwin 6 | 7 | 8 | #.PHONY do_script: 9 | 10 | 11 | 12 | #prerequisites: do_script 13 | 14 | 15 | 16 | CXX = g++ 17 | WINECXX = wineg++ -Wl,--subsystem,windows 18 | 19 | CXX_FLAGS = 20 | 21 | PREFIX = /usr 22 | 23 | BIN_DIR = $(DESTDIR)$(PREFIX)/bin 24 | VST_DIR = ./vst 25 | 26 | BUILD_FLAGS = -std=c++14 -fPIC -m64 -O2 -DLVRT -DEMBED -DEMBEDDRAG -DTRACKTIONWM -DVESTIGE -DNEWTIME -DINOUTMEM -DCHUNKBUF -DEMBEDRESIZE -DPCACHE -DBIN_DIR='"$(BIN_DIR)"' $(CXX_FLAGS) 27 | 28 | BUILD_FLAGS_WIN = -std=c++14 -fPIC -m64 -O2 -DEMBED -DEMBEDDRAG -DWAVES2 -DTRACKTIONWM -DVESTIGE -DNEWTIME -DINOUTMEM -DCHUNKBUF -DEMBEDRESIZE -DPCACHE -DDRAGWIN -DXOFFSET -I/opt/wine-staging/include/wine/windows -I/opt/wine-stable/include/wine/windows -I/opt/wine-devel/include/wine/windows -I/usr/include/wine-development/windows -I/usr/include/wine-development/wine/windows -I/usr/include/wine/wine/windows -I../ -DRELEASE=1 -D__forceinline=inline -DNOMINMAX=1 -DUNICODE_OFF -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DSMTG_RENAME_ASSERT=1 -fpermissive 29 | 30 | #-DUNICODE_OFF 31 | LINK_FLAGS = $(LDFLAGS) 32 | 33 | LINK_PLUGIN = -shared -lpthread -ldl -lX11 $(LINK_FLAGS) 34 | LINK_WINE = ../build/lib/Release/libsdk_hosting.a ../build/lib/Release/libbase.a ../build/lib/Release/libpluginterfaces.a ../build/lib/Release/libsdk.a -L/opt/wine-stable/lib64/wine -L/opt/wine-devel/lib64/wine -L/opt/wine-staging/lib64/wine -L/opt/wine-stable/lib64/wine/x86_64-unix -L/opt/wine-devel/lib64/wine/x86_64-unix -L/opt/wine-staging/lib64/wine/x86_64-unix -L/usr/lib/x86_64-linux-gnu/wine-development -lpthread -lX11 -lshell32 -lole32 $(LINK_FLAGS) 35 | 36 | TARGETS = do_script do_script2 linvst3.so lin-vst3-server.exe 37 | 38 | PATH := $(PATH):/opt/wine-stable/bin:/opt/wine-devel/bin:/opt/wine-staging/bin 39 | 40 | # -------------------------------------------------------------- 41 | 42 | all: $(TARGETS) 43 | 44 | do_script: 45 | $(shell chmod +x ./lin-patchwin) 46 | 47 | do_script2: 48 | ./lin-patchwin 49 | 50 | linvst3.so: linvst.unix.o remotevstclient.unix.o remotepluginclient.unix.o paths.unix.o 51 | $(CXX) $^ $(LINK_PLUGIN) -o $@ 52 | 53 | lin-vst3-server.exe: lin-vst-server.wine.o remotepluginserver.wine.o paths.wine.o memorystream.wine.o basewrapper.wine.o 54 | $(WINECXX) $^ $(LINK_WINE) -o $@ 55 | 56 | # -------------------------------------------------------------- 57 | 58 | linvst.unix.o: linvst.cpp 59 | $(CXX) $(BUILD_FLAGS) -c $^ -o $@ 60 | 61 | remotevstclient.unix.o: remotevstclient.cpp 62 | $(CXX) $(BUILD_FLAGS) -c $^ -o $@ 63 | 64 | remotepluginclient.unix.o: remotepluginclient.cpp 65 | $(CXX) $(BUILD_FLAGS) -c $^ -o $@ 66 | 67 | paths.unix.o: paths.cpp 68 | $(CXX) $(BUILD_FLAGS) -c $^ -o $@ 69 | 70 | 71 | # -------------------------------------------------------------- 72 | 73 | lin-vst-server.wine.o: lin-vst-server.cpp 74 | $(WINECXX) $(BUILD_FLAGS_WIN) -c $^ -o $@ 75 | 76 | remotepluginserver.wine.o: remotepluginserver.cpp 77 | $(WINECXX) $(BUILD_FLAGS_WIN) -c $^ -o $@ 78 | 79 | paths.wine.o: paths.cpp 80 | $(WINECXX) $(BUILD_FLAGS_WIN) -c $^ -o $@ 81 | 82 | memorystream.wine.o: ../public.sdk/source/common/memorystream.cpp 83 | $(WINECXX) $(BUILD_FLAGS_WIN) -c $^ -o $@ 84 | 85 | basewrapper.wine.o: basewrapper.cpp 86 | $(WINECXX) $(BUILD_FLAGS_WIN) -c $^ -o $@ 87 | 88 | clean: 89 | rm -fR *.o *.exe *.so vst $(TARGETS) 90 | 91 | install: 92 | install -d $(BIN_DIR) 93 | install -d $(VST_DIR) 94 | install -m 755 linvst3.so $(VST_DIR) 95 | install -m 755 lin-vst3-server.exe lin-vst3-server.exe.so $(BIN_DIR) 96 | -------------------------------------------------------------------------------- /vst3-sdks/vst-sdk_3.7.0_build-116_2020-07-31/lin-patchwin: -------------------------------------------------------------------------------- 1 | sed -i 's@#define sprintf16 swprintf2@#define sprintf16 swprintf@g' ../base/source/fstring.cpp 2 | sed -i 's@sprintf16 ((wchar_t \*)@sprintf16 (@g' ../base/source/fstring.cpp 3 | sed -i 's@sprintf16 (@sprintf16 ((wchar_t \*)@g' ../base/source/fstring.cpp 4 | sed -i 's@strrchr16 ((wchar_t \*)@strrchr16 (@g' ../base/source/fstring.cpp 5 | sed -i 's@strrchr16 (@strrchr16 ((wchar_t \*)@g' ../base/source/fstring.cpp 6 | sed -i 's@#define stricmp16 wcsicmp@#include \n #include \n #include \n #include \n int swprintf2 (wchar_t\* wcs, const wchar_t\* format, ... ) \n { \n va_list args; \n va_start (args, format); \n int ret = vswprintf(wcs, 2048, format, args); \n va_end (args); \n return ret; \n } \n #define stricmp16 wcscasecmp@g' ../base/source/fstring.cpp 7 | sed -i 's@#define strnicmp16 wcsnicmp@#define strnicmp16 wcsncasecmp@g' ../base/source/fstring.cpp 8 | sed -i 's@#define sprintf16 swprintf@#define sprintf16 swprintf2@g' ../base/source/fstring.cpp 9 | sed -i 's@#define stricmp _stricmp@@g' ../base/source/fstring.cpp 10 | sed -i 's@#define strnicmp _strnicmp@@g' ../base/source/fstring.cpp 11 | sed -i 's@#define snprintf _snprintf@@g' ../base/source/fstring.cpp 12 | sed -i 's@#define vsnprintf _vsnprintf@@g' ../base/source/fstring.cpp 13 | sed -i 's@#define snwprintf _snwprintf@#define snwprintf swprintf@g' ../base/source/fstring.cpp 14 | sed -i 's@#define vsnwprintf _vsnwprintf@#define vsnwprintf vswprintf@g' ../base/source/fstring.cpp 15 | sed -i 's@return GetTickCount64 ();@struct timespec now; \n if (clock_gettime(CLOCK_MONOTONIC, \&now)) \n return 0; \n return now.tv_sec \* 1000.0 + now.tv_nsec / 1000000.0;@g' ../base/source/timer.cpp 16 | sed -i 's@#include @#include \n #include @g' ../base/source/timer.cpp 17 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/funknown.cpp 18 | sed -i '/GUID guid;/,/}/c\ \n' ../pluginterfaces/base/funknown.cpp 19 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/ustring.cpp 20 | sed -i 's@SMTG_OS_WINDOWS@SMTG_OS_WINDOWS2@g' ../public.sdk/source/common/openurl.cpp 21 | sed -i 's@SMTG_OS_LINUX@SMTG_OS_WINDOWS@g' ../public.sdk/source/common/openurl.cpp 22 | sed -i 's@tstrlen ((char16_t)@tstrlen (@g' ../public.sdk/source/vst/vstparameters.cpp 23 | sed -i 's@tstrlen((char16_t)@tstrlen(@g' ../public.sdk/source/vst/vstparameters.cpp 24 | sed -i 's@tstrlen (@tstrlen ((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 25 | sed -i 's@tstrlen(@tstrlen((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 26 | sed -i 's@#include @// #include @g' ../public.sdk/source/common/threadchecker_win32.cpp 27 | sed -i 's@include_directories(${ROOT} ${SDK_ROOT})@include_directories(${ROOT} ${SDK_ROOT} "/usr/include/wine-development/windows" "/usr/include/wine-development/wine/windows" "/usr/include/wine/wine/windows") \n add_definitions(-DRELEASE=1) \n add_definitions(-D_stricmp=strcasecmp) \n add_definitions(-D_strnicmp=strncasecmp) \n add_definitions(-Dstricmp=strcasecmp) \n add_definitions(-Dstrnicmp=strncasecmp) \n add_definitions(-D__forceinline=inline) \n add_definitions(-DWIN32_LEAN_AND_MEAN) \n add_definitions(-DUNICODE_OFF) \n add_definitions(-DNOMINMAX=1) \n add_definitions(-fpermissive) \n add_definitions(-m64) \n add_definitions(-fPIC)@g' ../CMakeLists.txt 28 | mkdir ../build 29 | cd ../build 30 | cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/wineg++ -DCMAKE_CC_COMPILER=/usr/bin/winegcc -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_WORKS=1 31 | cd ./base 32 | make 33 | cd ../public.sdk 34 | make 35 | 36 | -------------------------------------------------------------------------------- /vst3-sdks/vst-sdk_3.7.1_build-50_2020-11-17/lin-patchwin: -------------------------------------------------------------------------------- 1 | find ../ -type f -name "*.cpp" -exec sed -i 's@Windows.h@windows.h@g' {} + 2 | find ../ -type f -name "*.h" -exec sed -i 's@Windows.h@windows.h@g' {} + 3 | find ../ -type f -name "*.c" -exec sed -i 's@Windows.h@windows.h@g' {} + 4 | find ../ -type f -name "*.hpp" -exec sed -i 's@Windows.h@windows.h@g' {} + 5 | sed -i 's@__MINGW32__@__WINE__@g' ../public.sdk/source/common/systemclipboard_win32.cpp 6 | sed -i 's@#define SMTG_EXPORT_SYMBOL __declspec (dllexport)@#define SMTG_EXPORT_SYMBOL __attribute__ ((visibility ("default")))@g' ../pluginterfaces/base/fplatform.h 7 | sed -i 's@#define sprintf16 swprintf2@#define sprintf16 swprintf@g' ../base/source/fstring.cpp 8 | sed -i 's@sprintf16 ((wchar_t \*)@sprintf16 (@g' ../base/source/fstring.cpp 9 | sed -i 's@sprintf16 (@sprintf16 ((wchar_t \*)@g' ../base/source/fstring.cpp 10 | sed -i 's@strrchr16 ((wchar_t \*)@strrchr16 (@g' ../base/source/fstring.cpp 11 | sed -i 's@strrchr16 (@strrchr16 ((wchar_t \*)@g' ../base/source/fstring.cpp 12 | sed -i 's@#define stricmp16 wcsicmp@#include \n #include \n #include \n #include \n int swprintf2 (wchar_t\* wcs, const wchar_t\* format, ... ) \n { \n va_list args; \n va_start (args, format); \n int ret = vswprintf(wcs, 2048, format, args); \n va_end (args); \n return ret; \n } \n #define stricmp16 wcscasecmp@g' ../base/source/fstring.cpp 13 | sed -i 's@#define strnicmp16 wcsnicmp@#define strnicmp16 wcsncasecmp@g' ../base/source/fstring.cpp 14 | sed -i 's@#define sprintf16 swprintf@#define sprintf16 swprintf2@g' ../base/source/fstring.cpp 15 | sed -i 's@#define stricmp _stricmp@@g' ../base/source/fstring.cpp 16 | sed -i 's@#define strnicmp _strnicmp@@g' ../base/source/fstring.cpp 17 | sed -i 's@#define snprintf _snprintf@@g' ../base/source/fstring.cpp 18 | sed -i 's@#define vsnprintf _vsnprintf@@g' ../base/source/fstring.cpp 19 | sed -i 's@#define snwprintf _snwprintf@#define snwprintf swprintf@g' ../base/source/fstring.cpp 20 | sed -i 's@#define vsnwprintf _vsnwprintf@#define vsnwprintf vswprintf@g' ../base/source/fstring.cpp 21 | sed -i 's@return GetTickCount64 ();@struct timespec now; \n if (clock_gettime(CLOCK_MONOTONIC, \&now)) \n return 0; \n return now.tv_sec \* 1000.0 + now.tv_nsec / 1000000.0;@g' ../base/source/timer.cpp 22 | sed -i 's@#include @#include \n #include @g' ../base/source/timer.cpp 23 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/funknown.cpp 24 | sed -i '/GUID guid;/,/}/c\ \n' ../pluginterfaces/base/funknown.cpp 25 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/ustring.cpp 26 | sed -i 's@SMTG_OS_WINDOWS@SMTG_OS_WINDOWS2@g' ../public.sdk/source/common/openurl.cpp 27 | sed -i 's@SMTG_OS_LINUX@SMTG_OS_WINDOWS@g' ../public.sdk/source/common/openurl.cpp 28 | sed -i 's@tstrlen ((char16_t)@tstrlen (@g' ../public.sdk/source/vst/vstparameters.cpp 29 | sed -i 's@tstrlen((char16_t)@tstrlen(@g' ../public.sdk/source/vst/vstparameters.cpp 30 | sed -i 's@tstrlen (@tstrlen ((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 31 | sed -i 's@tstrlen(@tstrlen((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 32 | sed -i 's@#include @// #include @g' ../public.sdk/source/common/threadchecker_win32.cpp 33 | sed -i 's@include_directories(${ROOT} ${SDK_ROOT})@include_directories(${ROOT} ${SDK_ROOT} "/usr/include/wine-development/windows" "/usr/include/wine-development/wine/windows" "/usr/include/wine/wine/windows") \n add_definitions(-DRELEASE=1) \n add_definitions(-D_stricmp=strcasecmp) \n add_definitions(-D_strnicmp=strncasecmp) \n add_definitions(-Dstricmp=strcasecmp) \n add_definitions(-Dstrnicmp=strncasecmp) \n add_definitions(-D__forceinline=inline) \n add_definitions(-DWIN32_LEAN_AND_MEAN) \n add_definitions(-DUNICODE_OFF) \n add_definitions(-DNOMINMAX=1) \n add_definitions(-fpermissive) \n add_definitions(-m64) \n add_definitions(-fPIC)@g' ../CMakeLists.txt 34 | mkdir ../build 35 | cd ../build 36 | cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/wineg++ -DCMAKE_CC_COMPILER=/usr/bin/winegcc -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_WORKS=1 37 | cd ./base 38 | make 39 | cd ../public.sdk 40 | make 41 | 42 | -------------------------------------------------------------------------------- /TestVst3/README.md: -------------------------------------------------------------------------------- 1 | # TestVst3 2 | 3 | TestVst3 can roughly test how a vst3 dll plugin might run under Wine. 4 | 5 | It tries to open the vst3 dll and display the vst window for roughly 8 seconds and then closes. 6 | 7 | Usage is ./testvst3.exe "path to vst3file.vst3" 8 | 9 | paths and vst3 filenames that contain spaces need to be enclosed in quotes. 10 | 11 | for example (cd into the testvst3 folder using the terminal) 12 | 13 | ./testvst3.exe "/home/your-user-name/.wine/drive_c/Program Files/Common Files/VST3/delay.vst3" 14 | 15 | Use testvst3.exe from a folder that is not in a daw search path. 16 | 17 | If testvst3.exe.so is in any daw search path then it can cause problems if the daw tries to load it. 18 | 19 | ----- 20 | 21 | Batch Testing 22 | 23 | ------- 24 | 25 | Gui Batch Testing. 26 | 27 | testvst3gui can be used to select a vst3 folder for testing. 28 | 29 | Unzip the testvst3 zip file, and then (using the terminal) cd into the unzipped testvst3 folder. 30 | 31 | then enter 32 | 33 | chmod +x testvst3-batch 34 | 35 | Click on (start) testvst3gui and then select a folder and then press the Start button and it will cycle through the vst3's in the folder. 36 | 37 | To cancel the vst3 cycling before all vst3's are tested, open a Terminal and enter 38 | kill -9 $(pgrep -f testvst3-batch) 39 | 40 | Starting testvst3gui using a Terminal will show what vst3 is currently loading, so a problematic vst can be identified. 41 | 42 | ------- 43 | 44 | Command Line Batch Testing. 45 | 46 | Unzip the testvst3 zip file, and then (using the terminal) cd into the unzipped testvst3 folder. 47 | 48 | then enter 49 | 50 | chmod +x testvst3-batch 51 | 52 | Usage is ./testvst3-batch "path to the vst3 folder containing the vst3 dll files" 53 | 54 | paths that contain spaces need to be enclosed in quotes. 55 | 56 | pathnames must end with a / 57 | 58 | for example 59 | 60 | ./testvst3-batch "/home/your-user-name/.wine/drive_c/Program Files/Common Files/VST3/" 61 | 62 | After that, testvst3.exe will attempt to run the plugins one after another, any plugin dialogs that popup should be dismissed as soon as possible. 63 | 64 | If a Wine plugin problem is encountered, then that plugin can be identified by the terminal output from testvst3.exe. 65 | 66 | Use testvst3.exe from a folder that is not in a daw search path. 67 | 68 | Use testvst3.exe from a folder that is not in a daw search path. 69 | 70 | If testvst3.exe.so is in any daw search path then it can cause problems if the daw tries to load it. 71 | 72 | To cancel the vst3 cycling before all vst3's are tested, open a Terminal and enter 73 | kill -9 $(pgrep -f testvst3-batch) 74 | 75 | ------ 76 | 77 | To make 78 | 79 | This TestVst3 source folder needs to be placed within the VST3 SDK main folder (the VST3_SDK folder or the VST3 folder that contains the base, public.sdk, pluginterfaces etc folders) ie the TestVst3 source folder needs to be placed alongside the base, public.sdk, pluginterfaces etc folders of the VST3 SDK. 80 | 81 | Then change into the TestVst3 folder and run make. 82 | 83 | ------ 84 | 85 | Cmake needs to be preinstalled. 86 | 87 | sudo apt-get install cmake 88 | 89 | Libraries that need to be pre installed, 90 | 91 | sudo apt-get install libfreetype6-dev libxcb-util0-dev libxcb-cursor-dev libxcb-keysyms1-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev libgtkmm-3.0-dev libsqlite3-dev 92 | 93 | Wine libwine development files. 94 | 95 | ------ 96 | 97 | For Ubuntu/Debian, sudo apt-get install libwine-development-dev (For Debian, Wine might need to be reinstalled after installing libwine-development-dev) 98 | 99 | wine-devel packages for other distros (sudo apt-get install wine-devel). 100 | 101 | libX11 development (sudo apt-get install libx11-dev) 102 | 103 | ------ 104 | 105 | For Fedora 106 | 107 | sudo yum -y install wine-devel wine-devel.i686 libX11-devel libX11-devel.i686 108 | sudo yum -y install libstdc++.i686 libX11.i686 109 | 110 | ------ 111 | 112 | For Manjaro/Arch 113 | 114 | sudo pacman -Sy wine-staging libx11 gcc-multilib 115 | 116 | sudo pacman -Sy cmake freetype2 sqlite libxcb xcb-util gtkmm3 xcb-util-cursor 117 | 118 | ------ 119 | 120 | (Optional libraries, Maybe needed for some systems), 121 | 122 | libx11-xcb-dev 123 | libxcb-util-dev 124 | libxcb-cursor-dev 125 | libxcb-xkb-dev 126 | libxkbcommon-dev 127 | libxkbcommon-x11-dev 128 | libfontconfig1-dev 129 | libcairo2-dev 130 | libgtkmm-3.0-dev 131 | libsqlite3-dev 132 | libxcb-keysyms1-dev 133 | 134 | ------- 135 | -------------------------------------------------------------------------------- /TestVst3/lin-patchwin: -------------------------------------------------------------------------------- 1 | find ../ -type f -name "*.cpp" -exec sed -i 's@Windows.h@windows.h@g' {} + 2 | find ../ -type f -name "*.h" -exec sed -i 's@Windows.h@windows.h@g' {} + 3 | find ../ -type f -name "*.c" -exec sed -i 's@Windows.h@windows.h@g' {} + 4 | find ../ -type f -name "*.hpp" -exec sed -i 's@Windows.h@windows.h@g' {} + 5 | sed -i 's@__MINGW32__@__WINE__@g' ../public.sdk/source/common/systemclipboard_win32.cpp 6 | sed -i 's@#define SMTG_EXPORT_SYMBOL __declspec (dllexport)@#define SMTG_EXPORT_SYMBOL __attribute__ ((visibility ("default")))@g' ../pluginterfaces/base/fplatform.h 7 | sed -i 's@#define sprintf16 swprintf2@#define sprintf16 swprintf@g' ../base/source/fstring.cpp 8 | sed -i 's@sprintf16 ((wchar_t \*)@sprintf16 (@g' ../base/source/fstring.cpp 9 | sed -i 's@sprintf16 (@sprintf16 ((wchar_t \*)@g' ../base/source/fstring.cpp 10 | sed -i 's@strrchr16 ((wchar_t \*)@strrchr16 (@g' ../base/source/fstring.cpp 11 | sed -i 's@strrchr16 (@strrchr16 ((wchar_t \*)@g' ../base/source/fstring.cpp 12 | sed -i 's@#define stricmp16 wcsicmp@#include \n #include \n #include \n #include \n int swprintf2 (wchar_t\* wcs, const wchar_t\* format, ... ) \n { \n va_list args; \n va_start (args, format); \n int ret = vswprintf(wcs, 2048, format, args); \n va_end (args); \n return ret; \n } \n #define stricmp16 wcscasecmp@g' ../base/source/fstring.cpp 13 | sed -i 's@#define strnicmp16 wcsnicmp@#define strnicmp16 wcsncasecmp@g' ../base/source/fstring.cpp 14 | sed -i 's@#define sprintf16 swprintf@#define sprintf16 swprintf2@g' ../base/source/fstring.cpp 15 | sed -i 's@#define stricmp _stricmp@@g' ../base/source/fstring.cpp 16 | sed -i 's@#define strnicmp _strnicmp@@g' ../base/source/fstring.cpp 17 | sed -i 's@#define snprintf _snprintf@@g' ../base/source/fstring.cpp 18 | sed -i 's@#define vsnprintf _vsnprintf@@g' ../base/source/fstring.cpp 19 | sed -i 's@#define snwprintf _snwprintf@#define snwprintf swprintf@g' ../base/source/fstring.cpp 20 | sed -i 's@#define vsnwprintf _vsnwprintf@#define vsnwprintf vswprintf@g' ../base/source/fstring.cpp 21 | sed -i 's@return GetTickCount64 ();@struct timespec now; \n if (clock_gettime(CLOCK_MONOTONIC, \&now)) \n return 0; \n return now.tv_sec \* 1000.0 + now.tv_nsec / 1000000.0;@g' ../base/source/timer.cpp 22 | sed -i 's@#include @#include \n #include @g' ../base/source/timer.cpp 23 | sed -i 's@#pragma once@#pragma once \n #include @g' ../pluginterfaces/vst/vsttypes.h 24 | sed -i 's@#if defined(_M_ARM64) || defined(_M_ARM)@#if defined(__WINE__)@g' ../pluginterfaces/base/funknown.cpp 25 | sed -i 's@#warning implement me!@ @g' ../pluginterfaces/base/funknown.cpp 26 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/funknown.cpp 27 | sed -i '/GUID guid;/,/}/c\ \n' ../pluginterfaces/base/funknown.cpp 28 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/ustring.cpp 29 | sed -i 's@SMTG_OS_WINDOWS@SMTG_OS_WINDOWS2@g' ../public.sdk/source/common/openurl.cpp 30 | sed -i 's@SMTG_OS_LINUX@SMTG_OS_WINDOWS@g' ../public.sdk/source/common/openurl.cpp 31 | sed -i 's@tstrlen ((char16_t)@tstrlen (@g' ../public.sdk/source/vst/vstparameters.cpp 32 | sed -i 's@tstrlen((char16_t)@tstrlen(@g' ../public.sdk/source/vst/vstparameters.cpp 33 | sed -i 's@tstrlen (@tstrlen ((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 34 | sed -i 's@tstrlen(@tstrlen((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 35 | sed -i 's@#include @// #include @g' ../public.sdk/source/common/threadchecker_win32.cpp 36 | sed -i 's@include_directories(${ROOT} ${SDK_ROOT})@include_directories(${ROOT} ${SDK_ROOT} "/opt/wine-staging/include/wine/windows" "/opt/wine-stable/include/wine/windows" "/opt/wine-devel/include/wine/windows" "/usr/include/wine-development/windows" "/usr/include/wine-development/wine/windows" "/usr/include/wine/wine/windows") \n add_definitions(-DRELEASE=1) \n add_definitions(-D_stricmp=strcasecmp) \n add_definitions(-D_strnicmp=strncasecmp) \n add_definitions(-Dstricmp=strcasecmp) \n add_definitions(-Dstrnicmp=strncasecmp) \n add_definitions(-D__forceinline=inline) \n add_definitions(-DWIN32_LEAN_AND_MEAN) \n add_definitions(-DUNICODE_OFF) \n add_definitions(-DNOMINMAX=1) \n add_definitions(-fpermissive) \n add_definitions(-m64)@g' ../CMakeLists.txt 37 | mkdir ../build 38 | cd ../build 39 | cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/wineg++ -DCMAKE_CC_COMPILER=/usr/bin/winegcc -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_WORKS=1 40 | cd ./base 41 | make 42 | cd ../public.sdk 43 | make 44 | 45 | -------------------------------------------------------------------------------- /Tested-VST3-Plugins/README.md: -------------------------------------------------------------------------------- 1 | ## Tested Vst3 Plugins 2 | 3 | **Audio/Midi clips** 4 | LinVst has a Drag-and-Drop version (see the dragwin folder for the Makefile). 5 | The Audacity Windows version can be used to drag audio/midi clips from the vst window to Audacity (after maybe previewing/arranging them in the vst such as EZdrummer) and then there is the option of editing them in Audacity before saving and dragging them to the Linux Daw. 6 | Drag the clip from the plugin window to Audacity, then select the track in Audacity and export it, then drag it to the Daw. 7 | 8 | --------- 9 | 10 | Native Access installation steps are at https://github.com/osxmidi/LinVst/tree/master/Tested-VST-Plugins 11 | 12 | **Kontakt**, see the above link for updated install tips regarding Native Access etc. 13 | 14 | LinVst3 can run the Kontakt 7 etc vst3 version, tested using Wine-tkg https://github.com/osxmidi/LinVst/tree/master/Wine-tkg and a DirectX 11 capable card. 15 | 16 | **EZDrummer3** 17 | 18 | EZDrummer3 drag/drop works with the LinVst3 drag/drop version. 19 | EZDrummer3 seems to now use JUCE8 which can result in plugin problems because of Wine's Direct2D. 20 | 21 | **ModoDrum** 22 | Midi Grooves are in ~/.wine/drive_c/Program Files/IK Multimedia/MODO DRUM 23 | Dragging grooves to Daw tracks works with the LinVst3 drag and drop version if the Daw supports it. 24 | 25 | **Valhalla** 26 | 27 | **Amplitube 5** 28 | 29 | **Line 6 Helix Native** (maybe needed, msvcr120.dll and gdiplus.dll overrides or winetricks vcrun2013 gdiplus wininet) (copy and paste username and password into the registration window) 30 | 31 | **Melda** 32 | Installer might need corefonts (winetricks corefonts) 33 | Melda MXXX Multi Effects** (turn GPU acceleration off) 34 | 35 | Melda drag/drop works with the LinVst3 drag/drop version. 36 | 37 | **Neural Amp Modeler (NAM)** 38 | 39 | **Blue Cat** 40 | 41 | **Voxengo** 42 | 43 | **FabFilter** 44 | 45 | **Wave Arts** 46 | 47 | **Mercuriall Spark Amp Sim** 48 | 49 | **Amped Roots** 50 | 51 | ------- 52 | 53 | **Hyperthreading** 54 | 55 | For Reaper, in Options/Preferences/Buffering uncheck Auto-detect the number of needed audio processing threads and set 56 | Audio reading/processing threads to the amount of physical cores of the cpu (not virtual cores such as hyperthreading cores). 57 | 58 | This can help with stutters and rough audio response. 59 | 60 | Other Daws might have similar settings. 61 | 62 | **Waveform** 63 | 64 | For Waveform, disable sandbox option for plugins. 65 | 66 | **Bitwig** 67 | 68 | For Bitwig, in Settings->Plug-ins choose "Individually" plugin setting and check all of the LinVst plugins. 69 | For Bitwig 2.4.3, In Settings->Plug-ins choose Independent plug-in host process for "Each plug-in" setting and check all of the LinVst plugins. 70 | 71 | **Renoise** 72 | 73 | Choose the sandbox option for plugins. 74 | 75 | Sometimes a synth vst might not declare itself as a synth and Renoise might not enable it. 76 | 77 | A workaround is to install sqlitebrowser 78 | 79 | sudo add-apt-repository ppa:linuxgndu/sqlitebrowser-testing 80 | 81 | sudo apt-get update && sudo apt-get install sqlitebrowser 82 | 83 | Add the synth vst's path to VST_PATH and start Renoise to scan it. 84 | 85 | Then exit renoise and edit the database file /home/user/.renoise/V3.1.0/ CachedVSTs_x64.db (enable hidden folders with right click in the file browser). 86 | 87 | Go to the "Browse Data" tab in SQLite browser and choose the CachedPlugins table and then locate the entry for the synth vst and enable the "IsSynth" flag from "0" (false) to "1" (true) and save. 88 | 89 | ----------- 90 | 91 | **d2d1** 92 | 93 | If a plugin needs a dll override it might be found by running TestVst from the terminal and looking for any unimplemented function in xxxx.dll errors in the output (the xxxx.dll is the dll that needs to be replaced with a dll override). 94 | 95 | d2d1 based plugins 96 | 97 | d2d1.dll can cause errors because Wine's current d2d1 support is not complete and using a d2d1.dll override might produce a black (blank) display. 98 | 99 | Wine supports Direct2D 1.2 and some plugins and JUCE8 made plugins use Direct2D 1.3. 100 | 101 | Some plugins might need d2d1 to be disabled in the winecfg Libraries tab (add a d2d1 entry and then edit it and select disable), but some plugins won't run if d2d1 is disabled. 102 | 103 | A scan of the plugin dll file can be done to find out if the plugin depends on d2d1 104 | 105 | "strings vstname.dll | grep -i d2d1" 106 | 107 | -------- 108 | -------------------------------------------------------------------------------- /lin-patchwin: -------------------------------------------------------------------------------- 1 | find ../ -type f -name "*.cpp" -exec sed -i 's@Windows.h@windows.h@g' {} + 2 | find ../ -type f -name "*.h" -exec sed -i 's@Windows.h@windows.h@g' {} + 3 | find ../ -type f -name "*.c" -exec sed -i 's@Windows.h@windows.h@g' {} + 4 | find ../ -type f -name "*.hpp" -exec sed -i 's@Windows.h@windows.h@g' {} + 5 | sed -i 's@__MINGW32__@__WINE__@g' ../public.sdk/source/common/systemclipboard_win32.cpp 6 | sed -i 's@#define SMTG_EXPORT_SYMBOL __declspec (dllexport)@#define SMTG_EXPORT_SYMBOL __attribute__ ((visibility ("default")))@g' ../pluginterfaces/base/fplatform.h 7 | sed -i 's@#define sprintf16 swprintf2@#define sprintf16 swprintf@g' ../base/source/fstring.cpp 8 | sed -i 's@sprintf16 ((wchar_t \*)@sprintf16 (@g' ../base/source/fstring.cpp 9 | sed -i 's@sprintf16 (@sprintf16 ((wchar_t \*)@g' ../base/source/fstring.cpp 10 | sed -i 's@strrchr16 ((wchar_t \*)@strrchr16 (@g' ../base/source/fstring.cpp 11 | sed -i 's@strrchr16 (@strrchr16 ((wchar_t \*)@g' ../base/source/fstring.cpp 12 | sed -i 's@#define stricmp16 wcsicmp@#include \n #include \n #include \n #include \n int swprintf2 (wchar_t\* wcs, const wchar_t\* format, ... ) \n { \n va_list args; \n va_start (args, format); \n int ret = vswprintf(wcs, 2048, format, args); \n va_end (args); \n return ret; \n } \n #define stricmp16 wcscasecmp@g' ../base/source/fstring.cpp 13 | sed -i 's@#define strnicmp16 wcsnicmp@#define strnicmp16 wcsncasecmp@g' ../base/source/fstring.cpp 14 | sed -i 's@#define sprintf16 swprintf@#define sprintf16 swprintf2@g' ../base/source/fstring.cpp 15 | sed -i 's@#define stricmp _stricmp@@g' ../base/source/fstring.cpp 16 | sed -i 's@#define strnicmp _strnicmp@@g' ../base/source/fstring.cpp 17 | sed -i 's@#define snprintf _snprintf@@g' ../base/source/fstring.cpp 18 | sed -i 's@#define vsnprintf _vsnprintf@@g' ../base/source/fstring.cpp 19 | sed -i 's@#define snwprintf _snwprintf@#define snwprintf swprintf@g' ../base/source/fstring.cpp 20 | sed -i 's@#define vsnwprintf _vsnwprintf@#define vsnwprintf vswprintf@g' ../base/source/fstring.cpp 21 | sed -i 's@return GetTickCount64 ();@struct timespec now; \n if (clock_gettime(CLOCK_MONOTONIC, \&now)) \n return 0; \n return now.tv_sec \* 1000.0 + now.tv_nsec / 1000000.0;@g' ../base/source/timer.cpp 22 | sed -i 's@#include @#include \n #include @g' ../base/source/timer.cpp 23 | sed -i 's@#pragma once@#pragma once \n #include @g' ../pluginterfaces/vst/vsttypes.h 24 | sed -i 's@#if defined(_M_ARM64) || defined(_M_ARM)@#if defined(__WINE__)@g' ../pluginterfaces/base/funknown.cpp 25 | sed -i 's@#warning implement me!@ @g' ../pluginterfaces/base/funknown.cpp 26 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/funknown.cpp 27 | sed -i '/GUID guid;/,/}/c\ \n' ../pluginterfaces/base/funknown.cpp 28 | sed -i 's@#include @#include \n #include @g' ../pluginterfaces/base/ustring.cpp 29 | sed -i 's@SMTG_OS_WINDOWS@SMTG_OS_WINDOWS2@g' ../public.sdk/source/common/openurl.cpp 30 | sed -i 's@SMTG_OS_LINUX@SMTG_OS_WINDOWS@g' ../public.sdk/source/common/openurl.cpp 31 | sed -i 's@tstrlen ((char16_t)@tstrlen (@g' ../public.sdk/source/vst/vstparameters.cpp 32 | sed -i 's@tstrlen((char16_t)@tstrlen(@g' ../public.sdk/source/vst/vstparameters.cpp 33 | sed -i 's@tstrlen (@tstrlen ((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 34 | sed -i 's@tstrlen(@tstrlen((char16_t)@g' ../public.sdk/source/vst/vstparameters.cpp 35 | sed -i 's@#include @// #include @g' ../public.sdk/source/common/threadchecker_win32.cpp 36 | sed -i 's@include_directories(${ROOT} ${SDK_ROOT})@include_directories(${ROOT} ${SDK_ROOT} "/opt/wine-staging/include/wine/windows" "/opt/wine-stable/include/wine/windows" "/opt/wine-devel/include/wine/windows" "/usr/include/wine-development/windows" "/usr/include/wine-development/wine/windows" "/usr/include/wine/wine/windows") \n add_definitions(-DRELEASE=1) \n add_definitions(-D_stricmp=strcasecmp) \n add_definitions(-D_strnicmp=strncasecmp) \n add_definitions(-Dstricmp=strcasecmp) \n add_definitions(-Dstrnicmp=strncasecmp) \n add_definitions(-D__forceinline=inline) \n add_definitions(-DWIN32_LEAN_AND_MEAN) \n add_definitions(-DUNICODE_OFF) \n add_definitions(-DNOMINMAX=1) \n add_definitions(-fpermissive) \n add_definitions(-m64)@g' ../CMakeLists.txt 37 | mkdir ../build 38 | cd ../build 39 | cmake .. -D CMAKE_AR=/usr/bin/ar -DCMAKE_CXX_COMPILER=/usr/bin/wineg++ -DCMAKE_CC_COMPILER=/usr/bin/winegcc -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_WORKS=1 -DCMAKE_POLICY_VERSION_MINIMUM=3.5 40 | cd ./base 41 | make 42 | cd ../public.sdk 43 | make 44 | 45 | -------------------------------------------------------------------------------- /remotepluginclient.h: -------------------------------------------------------------------------------- 1 | /* dssi-vst: a DSSI plugin wrapper for VST effects and instruments 2 | Copyright 2004-2007 Chris Cannam 3 | 4 | This file is part of linvst. 5 | 6 | linvst is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #ifndef REMOTE_PLUGIN_CLIENT_H 21 | #define REMOTE_PLUGIN_CLIENT_H 22 | 23 | #define __cdecl 24 | 25 | #include 26 | 27 | #ifdef VESTIGE 28 | typedef int16_t VstInt16; 29 | typedef int32_t VstInt32; 30 | typedef int64_t VstInt64; 31 | typedef intptr_t VstIntPtr; 32 | #define VESTIGECALLBACK __cdecl 33 | #include "vestige.h" 34 | #else 35 | #include "pluginterfaces/vst2.x/aeffectx.h" 36 | #endif 37 | 38 | #include "rdwrops.h" 39 | #include "remoteplugin.h" 40 | #include 41 | #include 42 | #include 43 | 44 | #ifdef EMBED 45 | #include 46 | #endif 47 | 48 | #include 49 | 50 | // Any of the methods in this file, including constructors, should be 51 | // considered capable of throwing RemotePluginClosedException. Do not 52 | // call anything here without catching it. 53 | 54 | class RemotePluginClient { 55 | public: 56 | RemotePluginClient(audioMasterCallback theMaster); 57 | virtual ~RemotePluginClient(); 58 | 59 | std::string getFileIdentifiers(); 60 | 61 | float getVersion(); 62 | int getUID(); 63 | 64 | std::string getName(); 65 | std::string getMaker(); 66 | 67 | void setBufferSize(int); 68 | void setSampleRate(int); 69 | 70 | void reset(); 71 | void terminate(); 72 | 73 | int getInputCount(); 74 | int getOutputCount(); 75 | int getFlags(); 76 | int getinitialDelay(); 77 | 78 | int getParameterCount(); 79 | std::string getParameterName(int); 80 | std::string getParameterLabel(int); 81 | std::string getParameterDisplay(int); 82 | 83 | void setParameter(int, float); 84 | float getParameter(int); 85 | float getParameterDefault(int); 86 | void getParameters(int, int, float *); 87 | 88 | int getProgramCount(); 89 | int getProgramNameIndexed(int, char *ptr); 90 | std::string getProgramName(); 91 | void setCurrentProgram(int); 92 | 93 | int processVstEvents(VstEvents *); 94 | #ifdef DOUBLEP 95 | void processdouble(double **inputs, double **outputs, int sampleFrames); 96 | bool setPrecision(int value); 97 | #endif 98 | 99 | #ifndef VESTIGE 100 | bool getEffInProp(int index, void *ptr); 101 | bool getEffOutProp(int index, void *ptr); 102 | #endif 103 | 104 | #ifdef MIDIEFF 105 | // bool getEffInProp(int index, void *ptr); 106 | // bool getEffOutProp(int index, void *ptr); 107 | bool getEffMidiKey(int index, void *ptr); 108 | bool getEffMidiProgName(int index, void *ptr); 109 | bool getEffMidiCurProg(int index, void *ptr); 110 | bool getEffMidiProgCat(int index, void *ptr); 111 | bool getEffMidiProgCh(int index); 112 | bool setEffSpeaker(VstIntPtr value, void *ptr); 113 | bool getEffSpeaker(VstIntPtr value, void *ptr); 114 | #endif 115 | #ifdef CANDOEFF 116 | bool getEffCanDo(char *ptr); 117 | #endif 118 | int getChunk(void **ptr, int bank_prog); 119 | int setChunk(void *ptr, int sz, int bank_prog); 120 | int canBeAutomated(int param); 121 | int getProgram(); 122 | int EffectOpen(); 123 | 124 | // void effMainsChanged(int s); 125 | // int getUniqueID(); 126 | 127 | // Either inputs or outputs may be NULL if (and only if) there are none 128 | void process(float **inputs, float **outputs, int sampleFrames); 129 | 130 | void waitForServer(ShmControl *m_shmControlptr); 131 | 132 | void waitForServer2exit(); 133 | void waitForServer3exit(); 134 | void waitForServer4exit(); 135 | void waitForServer5exit(); 136 | void waitForServer6exit(); 137 | 138 | void waitForClientexit(); 139 | 140 | void setDebugLevel(RemotePluginDebugLevel); 141 | bool warn(std::string); 142 | 143 | void showGUI(); 144 | void hideGUI(); 145 | 146 | #ifdef EMBED 147 | void openGUI(); 148 | ERect *rp; 149 | #endif 150 | 151 | int getEffInt(int opcode, int value); 152 | std::string getEffString(int opcode, int index); 153 | void effVoidOp(int opcode); 154 | int effVoidOp2(int opcode, int index, int value, float opt); 155 | 156 | int m_bufferSize; 157 | int m_numInputs; 158 | int m_numOutputs; 159 | int m_finishaudio; 160 | int m_runok; 161 | int m_syncok; 162 | int m_386run; 163 | AEffect *theEffect; 164 | AEffect theEffect2; 165 | audioMasterCallback m_audioMaster; 166 | 167 | int m_threadbreak; 168 | int m_threadbreakexit; 169 | 170 | int editopen; 171 | #ifdef EMBED 172 | #ifdef XECLOSE 173 | int xeclose; 174 | #endif 175 | /* 176 | int m_threadbreakembed; 177 | int m_threadbreakexitembed; 178 | */ 179 | #endif 180 | VstEvents vstev[VSTSIZE]; 181 | ERect retRect = {0, 0, 200, 500}; 182 | int reaperid; 183 | int m_updateio; 184 | int m_updatein; 185 | int m_updateout; 186 | int m_delay; 187 | #ifdef CHUNKBUF 188 | char *chunk_ptr; 189 | #endif 190 | 191 | #ifdef EMBED 192 | Window child; 193 | Window parent; 194 | Display *display; 195 | int handle; 196 | int width; 197 | int height; 198 | struct alignas(64) winmessage { 199 | int handle; 200 | int width; 201 | int height; 202 | int winerror; 203 | } winm2; 204 | winmessage *winm; 205 | int displayerr; 206 | #ifdef EMBEDRESIZE 207 | int resizedone; 208 | #endif 209 | /* 210 | pthread_t m_EMBEDThread; 211 | static void *callEMBEDThread(void *arg) { return 212 | ((RemotePluginClient*)arg)->EMBEDThread(); } void *EMBEDThread(); 213 | */ 214 | #ifdef EMBEDDRAG 215 | Window x11_win; 216 | Window pparent; 217 | Window root; 218 | Window *children; 219 | unsigned int numchildren; 220 | int parentok; 221 | #endif 222 | int eventrun; 223 | int eventstop; 224 | #endif 225 | 226 | char *m_shm3; 227 | char *m_shm4; 228 | char *m_shm5; 229 | #ifdef PCACHE 230 | char *m_shm6; 231 | 232 | struct alignas(64) ParamState { 233 | float value; 234 | float valueupdate; 235 | char changed; 236 | }; 237 | #endif 238 | 239 | int m_inexcept; 240 | 241 | VstTimeInfo *timeInfo; 242 | 243 | #ifdef EMBED 244 | #ifdef TRACKTIONWM 245 | int waveformid; 246 | int waveformid2; 247 | int hosttracktion; 248 | #endif 249 | #endif 250 | 251 | struct alignas(64) vinfo { 252 | char a[64 + 8 + (sizeof(int32_t) * 2) + 48]; 253 | // char a[96]; 254 | }; 255 | 256 | ShmControl *m_shmControlptr; 257 | 258 | protected: 259 | void cleanup(); 260 | void syncStartup(); 261 | 262 | private: 263 | int m_shmFd; 264 | int m_shmControlFd; 265 | char *m_shmControlFileName; 266 | ShmControl *m_shmControl; 267 | ShmControl *m_shmControl2; 268 | ShmControl *m_shmControl3; 269 | ShmControl *m_shmControl4; 270 | ShmControl *m_shmControl5; 271 | ShmControl *m_shmControl6; 272 | int m_AMRequestFd; 273 | int m_AMResponseFd; 274 | char *m_AMRequestFileName; 275 | char *m_AMResponseFileName; 276 | char *m_shmFileName; 277 | char *m_shm; 278 | size_t m_shmSize; 279 | char *m_shm2; 280 | 281 | int sizeShm(); 282 | 283 | pthread_t m_AMThread; 284 | static void *callAMThread(void *arg) { 285 | return ((RemotePluginClient *)arg)->AMThread(); 286 | } 287 | void *AMThread(); 288 | int m_threadinit; 289 | 290 | void RemotePluginClosedException(); 291 | 292 | bool fwait(ShmControl *m_shmControlptr, std::atomic_int *fcount, int ms); 293 | bool fpost(ShmControl *m_shmControlptr, std::atomic_int *fcount); 294 | 295 | bool fwait2(ShmControl *m_shmControlptr, std::atomic_int *fcount, int ms); 296 | bool fpost2(ShmControl *m_shmControlptr, std::atomic_int *fcount); 297 | }; 298 | #endif 299 | -------------------------------------------------------------------------------- /remotepluginserver.h: -------------------------------------------------------------------------------- 1 | /* dssi-vst: a DSSI plugin wrapper for VST effects and instruments 2 | Copyright 2004-2007 Chris Cannam 3 | */ 4 | 5 | #ifndef REMOTE_PLUGIN_SERVER_H 6 | #define REMOTE_PLUGIN_SERVER_H 7 | 8 | #ifdef __WINE__ 9 | #else 10 | #define __cdecl 11 | #endif 12 | 13 | #define WIN32_LEAN_AND_MEAN 14 | 15 | #include 16 | #include 17 | #include 18 | #ifdef DRAGWIN 19 | #include 20 | #include 21 | #endif 22 | #undef min 23 | #undef max 24 | 25 | #ifdef VESTIGE 26 | typedef int16_t VstInt16; 27 | typedef int32_t VstInt32; 28 | typedef int64_t VstInt64; 29 | typedef intptr_t VstIntPtr; 30 | #define VESTIGECALLBACK __cdecl 31 | #include "vestige.h" 32 | #else 33 | #include "pluginterfaces/vst2.x/aeffectx.h" 34 | #endif 35 | 36 | #include "rdwrops.h" 37 | #include "remoteplugin.h" 38 | #include 39 | 40 | #include 41 | 42 | class RemotePluginServer { 43 | public: 44 | virtual ~RemotePluginServer(); 45 | 46 | virtual float getVersion() { return RemotePluginVersion; } 47 | virtual std::string getName() = 0; 48 | virtual std::string getMaker() = 0; 49 | 50 | virtual void setBufferSize(int) = 0; 51 | virtual void setSampleRate(int) = 0; 52 | 53 | virtual void reset() = 0; 54 | virtual void terminate() = 0; 55 | 56 | virtual int getInputCount() = 0; 57 | virtual int getOutputCount() = 0; 58 | virtual int getFlags() = 0; 59 | virtual int getinitialDelay() = 0; 60 | 61 | virtual int processVstEvents() = 0; 62 | 63 | virtual void getChunk(ShmControl *m_shmControlptr) = 0; 64 | virtual void setChunk(ShmControl *m_shmControlptr) = 0; 65 | virtual void canBeAutomated(ShmControl *m_shmControlptr) = 0; 66 | virtual void getProgram(ShmControl *m_shmControlptr) = 0; 67 | virtual void EffectOpen(ShmControl *m_shmControlptr) = 0; 68 | 69 | // virtual int getUniqueID() = 0; 70 | // virtual int getVersion() = 0; 71 | // virtual void eff_mainsChanged(int v) = 0; 72 | 73 | virtual int getUID() { return 0; } 74 | virtual int getParameterCount() { return 0; } 75 | virtual std::string getParameterName(int) { return ""; } 76 | virtual std::string getParameterLabel(int) { return ""; } 77 | virtual std::string getParameterDisplay(int) { return ""; } 78 | virtual void setParameter(int, float) { return; } 79 | virtual float getParameter(int) { return 0.0f; } 80 | virtual float getParameterDefault(int) { return 0.0f; } 81 | virtual void getParameters(int p0, int pn, float *v) { 82 | for (int i = p0; i <= pn; ++i) 83 | v[i - p0] = 0.0f; 84 | } 85 | virtual int getProgramCount() { return 0; } 86 | virtual int getProgramNameIndexed(int, char *name) { return 0; } 87 | virtual std::string getProgramName() { return ""; } 88 | virtual void setCurrentProgram(int) { return; } 89 | 90 | virtual int getEffInt(int opcode, int value) { return 0; } 91 | virtual std::string getEffString(int opcode, int index) { return ""; } 92 | virtual void effDoVoid(int opcode) { return; } 93 | virtual int effDoVoid2(int opcode, int index, int value, float opt) { 94 | return 0; 95 | } 96 | 97 | virtual void process(float **inputs, float **outputs, int sampleFrames) = 0; 98 | #ifdef DOUBLEP 99 | virtual void processdouble(double **inputs, double **outputs, 100 | int sampleFrames) = 0; 101 | virtual bool setPrecision(int value) { return false; } 102 | #ifndef INOUTMEM 103 | double **m_inputsdouble; 104 | double **m_outputsdouble; 105 | #else 106 | double *m_inputsdouble[1024]; 107 | double *m_outputsdouble[1024]; 108 | #endif 109 | #endif 110 | 111 | #ifndef VESTIGE 112 | virtual bool getInProp(int index) { return false; } 113 | virtual bool getOutProp(int index) { return false; } 114 | #endif 115 | 116 | #ifdef MIDIEFF 117 | virtual bool getMidiKey(int index, ShmControl *m_shmControlptr) { 118 | return false; 119 | } 120 | virtual bool getMidiProgName(int index, ShmControl *m_shmControlptr) { 121 | return false; 122 | } 123 | virtual bool getMidiCurProg(int index, ShmControl *m_shmControlptr) { 124 | return false; 125 | } 126 | virtual bool getMidiProgCat(int index, ShmControl *m_shmControlptr) { 127 | return false; 128 | } 129 | virtual bool getMidiProgCh(int index, ShmControl *m_shmControlptr) { 130 | return false; 131 | } 132 | virtual bool setSpeaker(ShmControl *m_shmControlptr) { return false; } 133 | virtual bool getSpeaker(ShmControl *m_shmControlptr) { return false; } 134 | #endif 135 | #ifdef CANDOEFF 136 | virtual bool getEffCanDo(std::string) = 0; 137 | #endif 138 | 139 | virtual void setDebugLevel(RemotePluginDebugLevel) { return; } 140 | virtual bool warn(std::string) = 0; 141 | 142 | virtual void showGUI(ShmControl *m_shmControlptr) {} 143 | virtual void hideGUI() {} 144 | virtual void hideGUI2() {} 145 | #ifdef EMBED 146 | virtual void openGUI() {} 147 | #endif 148 | virtual void guiUpdate() {} 149 | virtual void finisherror() {} 150 | 151 | void dispatch(int timeout = -1); // may throw RemotePluginClosedException 152 | void dispatchControl(int timeout = -1); // may throw RemotePluginClosedException 153 | void dispatchProcess(int timeout = -1); // may throw RemotePluginClosedException 154 | void dispatchGetSet(int timeout = -1); // may throw RemotePluginClosedException 155 | void dispatchPar(int timeout = -1); // may throw RemotePluginClosedException 156 | void dispatchControl2(int timeout = -1); // may throw RemotePluginClosedException 157 | 158 | int sizeShm(); 159 | char *m_shm; 160 | char *m_shm2; 161 | char *m_shm3; 162 | char *m_shm4; 163 | char *m_shm5; 164 | #ifdef PCACHE 165 | char *m_shm6; 166 | 167 | struct alignas(64) ParamState { 168 | float value; 169 | float valueupdate; 170 | char changed; 171 | }; 172 | #endif 173 | 174 | int m_shmControlFd; 175 | 176 | int m_threadsfinish; 177 | 178 | void waitForClient2exit(); 179 | void waitForClient3exit(); 180 | void waitForClient4exit(); 181 | void waitForClient5exit(); 182 | void waitForClient6exit(); 183 | 184 | protected: 185 | RemotePluginServer(std::string fileIdentifiers); 186 | void cleanup(); 187 | 188 | private: 189 | void dispatchControlEvents(ShmControl *m_shmControlptr); 190 | void dispatchProcessEvents(); 191 | void dispatchGetSetEvents(); 192 | void dispatchParEvents(); 193 | 194 | int m_flags; 195 | int m_shmFd; 196 | size_t m_shmSize; 197 | char *m_shmFileName; 198 | 199 | #ifndef INOUTMEM 200 | float **m_inputs; 201 | float **m_outputs; 202 | #else 203 | float *m_inputs[1024]; 204 | float *m_outputs[1024]; 205 | #endif 206 | 207 | RemotePluginDebugLevel m_debugLevel; 208 | 209 | public: 210 | #ifdef CHUNKBUF 211 | void *chunkptr; 212 | char *chunkptr2; 213 | #endif 214 | int m_bufferSize; 215 | int m_numInputs; 216 | int m_numOutputs; 217 | 218 | ShmControl *m_shmControl; 219 | ShmControl *m_shmControl2; 220 | ShmControl *m_shmControl3; 221 | ShmControl *m_shmControl4; 222 | ShmControl *m_shmControl5; 223 | ShmControl *m_shmControl6; 224 | 225 | void waitForServer(ShmControl *m_shmControlptr); 226 | void waitForServerexit(); 227 | void waitForServerexcept(); 228 | 229 | void RemotePluginClosedException(); 230 | 231 | int m_inexcept; 232 | 233 | int m_386run; 234 | 235 | #ifdef EMBED 236 | #ifdef TRACKTIONWM 237 | int hosttracktion; 238 | #endif 239 | #endif 240 | 241 | int starterror; 242 | 243 | int initdone; 244 | 245 | bool fwait(ShmControl *m_shmControlptr, std::atomic_int *fcount, int ms); 246 | bool fpost(ShmControl *m_shmControlptr, std::atomic_int *fcount); 247 | 248 | bool fwait2(ShmControl *m_shmControlptr, std::atomic_int *fcount, int ms); 249 | bool fpost2(ShmControl *m_shmControlptr, std::atomic_int *fcount); 250 | 251 | VstTimeInfo *timeinfo; 252 | VstTimeInfo timeinfo2; 253 | 254 | int bufferSize; 255 | int sampleRate; 256 | 257 | struct alignas(64) vinfo { 258 | char a[64 + 8 + (sizeof(int32_t) * 2) + 48]; 259 | // char a[96]; 260 | }; 261 | 262 | struct alignas(64) winmessage { 263 | int handle; 264 | int width; 265 | int height; 266 | int winerror; 267 | } winm2; 268 | winmessage *winm; 269 | 270 | HANDLE ThreadHandle[4]; 271 | 272 | ShmControl *m_shmControlptr; 273 | 274 | int m_updateio; 275 | int m_updatein; 276 | int m_updateout; 277 | int m_delay; 278 | }; 279 | #endif 280 | -------------------------------------------------------------------------------- /remotevstclient.cpp: -------------------------------------------------------------------------------- 1 | /* dssi-vst: a DSSI plugin wrapper for VST effects and instruments 2 | Copyright 2004-2007 Chris Cannam 3 | 4 | This file is part of linvst. 5 | 6 | linvst is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "remotevstclient.h" 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include "paths.h" 38 | 39 | #include 40 | 41 | #include 42 | #include 43 | #include 44 | 45 | #include 46 | #include 47 | #include 48 | 49 | void errwin(std::string dllname) { 50 | static Window window = 0; 51 | static Window ignored = 0; 52 | static Display *display = 0; 53 | static int screen = 0; 54 | static Atom winstate; 55 | static Atom winmodal; 56 | 57 | std::string filename; 58 | std::string filename2; 59 | 60 | size_t found2 = dllname.find_last_of("/"); 61 | filename = dllname.substr(found2 + 1, strlen(dllname.c_str()) - (found2 + 1)); 62 | filename2 = "VST dll file not found or timeout: " + filename; 63 | 64 | XInitThreads(); 65 | display = XOpenDisplay(NULL); 66 | if (!display) 67 | return; 68 | screen = DefaultScreen(display); 69 | window = XCreateSimpleWindow(display, RootWindow(display, screen), 10, 10, 70 | 480, 20, 0, BlackPixel(display, screen), 71 | WhitePixel(display, screen)); 72 | if (!window) 73 | return; 74 | winstate = XInternAtom(display, "_NET_WM_STATE", True); 75 | winmodal = XInternAtom(display, "_NET_WM_STATE_ABOVE", True); 76 | XChangeProperty(display, window, winstate, XA_ATOM, 32, PropModeReplace, 77 | (unsigned char *)&winmodal, 1); 78 | XStoreName(display, window, filename2.c_str()); 79 | XMapWindow(display, window); 80 | XSync(display, false); 81 | XFlush(display); 82 | sleep(10); 83 | XSync(display, false); 84 | XFlush(display); 85 | XDestroyWindow(display, window); 86 | XCloseDisplay(display); 87 | } 88 | 89 | const char *selfname() { int i = 5; } 90 | 91 | RemoteVSTClient::RemoteVSTClient(audioMasterCallback theMaster) 92 | : RemotePluginClient(theMaster) { 93 | pid_t child; 94 | Dl_info info; 95 | std::string dllName; 96 | std::string LinVstName; 97 | std::string LinVstNameso; 98 | bool test; 99 | size_t found2; 100 | std::string filename; 101 | 102 | int dlltype; 103 | unsigned int offset; 104 | char buffer[256]; 105 | 106 | char hit2[4096]; 107 | 108 | if (!dladdr((const char *)selfname, &info)) { 109 | m_runok = 1; 110 | cleanup(); 111 | return; 112 | } 113 | 114 | if (!info.dli_fname) { 115 | m_runok = 1; 116 | cleanup(); 117 | return; 118 | } 119 | 120 | dllName = info.dli_fname; 121 | 122 | found2 = dllName.find_last_of("/"); 123 | filename = dllName.substr(found2 + 1, strlen(dllName.c_str()) - (found2 + 1)); 124 | 125 | if (!strcmp(filename.c_str(), "linvst3.so")) { 126 | m_runok = 2; 127 | cleanup(); 128 | return; 129 | } 130 | 131 | if (realpath(dllName.c_str(), hit2) == 0) { 132 | m_runok = 1; 133 | cleanup(); 134 | return; 135 | } 136 | 137 | dllName = hit2; 138 | 139 | size_t found3 = dllName.find("-part-"); 140 | 141 | if (found3 != std::string::npos) { 142 | // printf("partnamesofile %s\n", dllName.c_str()); 143 | 144 | size_t found4 = dllName.find_last_of("-"); 145 | 146 | if (found4 != std::string::npos) { 147 | filename = 148 | dllName.substr(found4 + 1, strlen(dllName.c_str()) - (found4 + 1)); 149 | filename.replace(filename.begin() + filename.find(".so"), filename.end(), 150 | ""); 151 | } 152 | 153 | dllName = dllName.substr(0, found3); 154 | dllName = dllName + ".so"; 155 | 156 | // printf("partname %s\n", dllName.c_str()); 157 | 158 | // printf("idxname %s\n", filename.c_str()); 159 | } else 160 | filename = "10000"; 161 | 162 | dllName.replace(dllName.begin() + dllName.find(".so"), dllName.end(), 163 | ".vst3"); 164 | test = std::ifstream(dllName.c_str()).good(); 165 | 166 | if (!test) { 167 | dllName = hit2; 168 | dllName.replace(dllName.begin() + dllName.find(".so"), dllName.end(), 169 | ".Vst3"); 170 | test = std::ifstream(dllName.c_str()).good(); 171 | 172 | if (!test) { 173 | dllName = hit2; 174 | dllName.replace(dllName.begin() + dllName.find(".so"), dllName.end(), 175 | ".VST3"); 176 | test = std::ifstream(dllName.c_str()).good(); 177 | } 178 | 179 | if (!test) { 180 | dllName = hit2; 181 | dllName.replace(dllName.begin() + dllName.find(".so"), dllName.end(), 182 | ".dll"); 183 | // errwin(dllName); 184 | m_runok = 2; 185 | cleanup(); 186 | return; 187 | } 188 | } 189 | 190 | std::ifstream mfile(dllName.c_str(), std::ifstream::binary); 191 | 192 | if (!mfile) { 193 | m_runok = 1; 194 | cleanup(); 195 | return; 196 | } 197 | 198 | mfile.read(&buffer[0], 2); 199 | short *ptr; 200 | ptr = (short *)&buffer[0]; 201 | 202 | if (*ptr != 0x5a4d) { 203 | mfile.close(); 204 | m_runok = 1; 205 | cleanup(); 206 | return; 207 | } 208 | 209 | mfile.seekg(60, mfile.beg); 210 | mfile.read(&buffer[0], 4); 211 | 212 | int *ptr2; 213 | ptr2 = (int *)&buffer[0]; 214 | offset = *ptr2; 215 | offset += 4; 216 | 217 | mfile.seekg(offset, mfile.beg); 218 | mfile.read(&buffer[0], 2); 219 | 220 | unsigned short *ptr3; 221 | ptr3 = (unsigned short *)&buffer[0]; 222 | 223 | dlltype = 0; 224 | if (*ptr3 == 0x8664) 225 | dlltype = 1; 226 | else if (*ptr3 == 0x014c) 227 | dlltype = 2; 228 | else if (*ptr3 == 0x0200) 229 | dlltype = 3; 230 | 231 | if (dlltype == 0 || dlltype == 2) { 232 | mfile.close(); 233 | m_runok = 1; 234 | cleanup(); 235 | return; 236 | } 237 | 238 | mfile.close(); 239 | 240 | LinVstName = BIN_DIR "/lin-vst3-server.exe"; 241 | LinVstNameso = BIN_DIR "/lin-vst3-server.exe.so"; 242 | 243 | test = std::ifstream(LinVstName.c_str()).good(); 244 | if (!test) { 245 | m_runok = 1; 246 | cleanup(); 247 | return; 248 | } 249 | test = std::ifstream(LinVstNameso.c_str()).good(); 250 | if (!test) { 251 | m_runok = 1; 252 | cleanup(); 253 | return; 254 | } 255 | 256 | hit2[0] = '\0'; 257 | 258 | std::string dllNamewin = dllName; 259 | std::size_t idx = dllNamewin.find("drive_c"); 260 | 261 | if (idx != std::string::npos) { 262 | const char *hit = dllNamewin.c_str(); 263 | strcpy(hit2, hit); 264 | hit2[idx - 1] = '\0'; 265 | setenv("WINEPREFIX", hit2, 1); 266 | } 267 | 268 | std::string arg = filename + "," + dllName + "," + getFileIdentifiers(); 269 | const char *argStr = arg.c_str(); 270 | 271 | #ifdef LVRT 272 | struct sched_param param; 273 | param.sched_priority = 1; 274 | 275 | int result = sched_setscheduler(0, SCHED_FIFO, ¶m); 276 | 277 | if (result < 0) { 278 | perror("Failed to set realtime priority"); 279 | } 280 | #endif 281 | 282 | if ((child = vfork()) < 0) { 283 | m_runok = 1; 284 | cleanup(); 285 | return; 286 | } else if (child == 0) { 287 | if (execlp(BIN_DIR "/lin-vst3-server.exe", BIN_DIR "/lin-vst3-server.exe", argStr, NULL)) { 288 | m_runok = 1; 289 | cleanup(); 290 | return; 291 | } 292 | } 293 | syncStartup(); 294 | } 295 | 296 | RemoteVSTClient::~RemoteVSTClient() { 297 | int pidval, wstatus; 298 | for (int i = 0; i < 50000; i++) { 299 | pidval = waitpid(-1, &wstatus, WNOHANG|WUNTRACED); 300 | if (pidval <= 0) 301 | break; 302 | usleep(100); 303 | } 304 | } 305 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LinVst3 2 | 3 | Vst3 wrapper (beta). 4 | 5 | For 64 bit vst3's only. 6 | 7 | Not all vst3 features are supported. 8 | 9 | Unlike Vst2, saved projects using wrapped Vst3 plugins are not compatible/transferable between Linux daws and their Windows versions and vice versa. 10 | 11 | LinVst3 binaries are on the releases page (under Assets) https://github.com/osxmidi/LinVst3/releases 12 | 13 | See https://github.com/osxmidi/LinVst3/tree/master/Tested-VST3-Plugins for some common Vst3 tested plugin details. 14 | Native Access installation steps are at https://github.com/osxmidi/LinVst/tree/master/Tested-VST-Plugins 15 | 16 | The same usage applies as per LinVst except that it's linvst3.so instead of linvst.so and the vst dll filename extensions are .vst3 instead of .dll https://github.com/osxmidi/LinVst/wiki https://github.com/osxmidi/LinVst/blob/master/README.md https://github.com/osxmidi/LinVst/tree/master/Detailed-Guide 17 | 18 | The vst3 dlls or folders are most likely going to be installed into ~/.wine/drive_c/Program Files/Common Files/VST3 19 | 20 | The ~/.wine/drive_c/Program Files/Common Files/VST3 path needs to be added to the Daw's vst search path list. 21 | 22 | linvst3convert would then be used on the ~/.wine/drive_c/Program Files/Common Files/VST3 folder (select the linvst3.so file and then select the vst3 path which is usually ~/.wine/drive_c/Program Files/Common Files/VST3). 23 | 24 | LinVst3 will try to produce multiple loader part files for vst3's that contain multiple plugins. 25 | The multiple loader part files should be picked up on the daw's next plugin scan and then the multiple plugins should be available for use in the daw. 26 | 27 | If window resizing does not work, then after a resize the UI needs to be closed and then reopened for the new window size to take effect. 28 | 29 | Some vst3 plugins might not work due to Wines current capabilities or for some other reason. 30 | 31 | Use TestVst3 for testing how a vst3 plugin might run under Wine. 32 | 33 | Some vst3 plugins rely on the d2d1 dll which is not totally implemented in current Wine. 34 | 35 | If a plugin has trouble with it's display then disabling d2d1 in the winecfg Libraries tab can be tried. 36 | 37 | ----------- 38 | 39 | Optional Symlinks 40 | 41 | A symlink can be used to access vst3 plugin folders from another more convenient folder. 42 | 43 | Hidden folders such as /home/your-user-name/.wine/drive_c/Program Files/Common Files/VST3 can be accessed by the Daw by creating a symlink to them using a more convenient folder such as /home/your-user-name/vst3 for instance. 44 | 45 | For example 46 | 47 | ln -s "/home/your-user-name/.wine/drive_c/Program Files/Common Files/VST3" /home/your-user-name/vst3/vst3plugins.so 48 | 49 | creates a symbolic link named vst3plugins.so in the /home/your-user-name/vst3 folder that points to the /home/your-user-name/.wine/drive_c/Program Files/Common Files/VST3 folder containing the vst3 plugins. 50 | 51 | The /home/your-user-name/.wine/drive_c/Program Files/Common Files/VST3 vst3 plugin folder needs to have had the vst3 plugins previously setup by using linvst3convert. 52 | 53 | Then the Daw needs to have the /home/your-user-name/vst3 folder included in it's search path. 54 | 55 | When the Daw scans the /home/your-user-name/vst3 folder it should also automatically scan the /home/your-user-name/.wine/drive_c/Program Files/Common Files/VST3 folder that contains the vst3 plugins (that have been previously setup by using linvst3convert). 56 | 57 | ------- 58 | 59 | **Hyperthreading** 60 | 61 | For Reaper, in Options/Preferences/Buffering uncheck Auto-detect the number of needed audio processing threads and set 62 | Audio reading/processing threads to the amount of physical cores of the cpu (not virtual cores such as hyperthreading cores). 63 | 64 | This can help with stutters and rough audio response. 65 | 66 | Other Daws might have similar settings. 67 | 68 | **Waveform** 69 | 70 | For Waveform,(maybe) disable sandbox option for plugins. 71 | 72 | **Bitwig** 73 | 74 | For Bitwig, in Settings->Plug-ins choose "Individually" plugin setting and check all of the LinVst plugins. 75 | For Bitwig 2.4.3, In Settings->Plug-ins choose Independent plug-in host process for "Each plug-in" setting and check all of the LinVst3 plugins. 76 | 77 | **Renoise** 78 | 79 | Choose the sandbox option for plugins. 80 | 81 | ------- 82 | 83 | **To Make** 84 | 85 | LinVst3 binaries are on the releases page (under Assets) https://github.com/osxmidi/LinVst3/releases 86 | 87 | See https://github.com/osxmidi/LinVst/tree/master/Make-Guide for setup info and make options 88 | 89 | The vst3 sdk needs to be patched and the default LinVst3 script patch file (lin-patchwin) is for this version of the Steinberg vst sdk https://download.steinberg.net/sdk_downloads/vst-sdk_3.7.1_build-50_2020-11-17.zip 90 | 91 | ``` 92 | Once the vst3 sdk is unzipped, add #include to the optional.h file in VST_SDK/VST3_SDK/public.sdk/source/vst/utility/ 93 | 94 | ``` 95 | 96 | Some libraries also need to be pre installed, 97 | 98 | For Ubuntu/Debian: 99 | 100 | sudo apt-get install libx11-dev 101 | 102 | sudo apt-get install wine-stable-dev or sudo apt-get install wine-staging-dev 103 | 104 | sudo apt-get install cmake 105 | 106 | sudo apt-get install libfreetype6-dev libxcb-util0-dev libxcb-cursor-dev libxcb-keysyms1-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev libgtkmm-3.0-dev libsqlite3-dev 107 | 108 | For For Manjaro/EndeavourOS/Arch: 109 | 110 | sudo pacman -Sy wine (or wine-staging) libx11 gcc-multilib 111 | 112 | sudo pacman -Sy cmake freetype2 sqlite libxcb xcb-util gtkmm3 xcb-util-cursor libx11 pkgconfig xcb-util-keysyms 113 | 114 | For Fedora: (yum has changed to dnf) 115 | 116 | sudo yum -y install wine-devel libX11-devel 117 | 118 | sudo yum -y install sqlite sqlite-devel cmake freetype-devel xcb-util-devel gcc g++ xcb-util-cursor xcb-util-cursor-devel xcb-util-keysyms xcb-util-keysyms-devel libxkbcommon libxkbcommon-devel libxkbcommon-x11 libxkbcommon-x11-devel gtk+ gtk+-devel gtk3 gtk3-devel gtkmm3.0 gtkmm3.0-devel 119 | 120 | optional libraries xcb-util libX11-xcb 121 | 122 | ------ 123 | 124 | (Optional libraries, Maybe needed for some systems), 125 | 126 | libx11-xcb-dev 127 | libxcb-util-dev 128 | libxcb-cursor-dev 129 | libxcb-xkb-dev 130 | libxkbcommon-dev 131 | libxkbcommon-x11-dev 132 | libfontconfig1-dev 133 | libcairo2-dev 134 | libgtkmm-3.0-dev 135 | libsqlite3-dev 136 | libxcb-keysyms1-dev 137 | 138 | ------- 139 | 140 | This LinVst3 source folder needs to be placed within the VST3 SDK main folder (the VST3_SDK folder or the VST3 folder that contains the base, public.sdk, pluginterfaces etc folders) ie the LinVst3 source folder needs to be placed alongside the base, public.sdk, pluginterfaces etc folders of the VST3 SDK. 141 | 142 | Then change into the LinVst3 source folder and run make and then sudo make install 143 | 144 | Then use the batch name conversion utilities (in the convert/binaries folder) to name convert linvst3.so to the vst3 plugin names ie first select linvst3.so and then select the ~/.wine/drive_c/Program Files/Common Files/VST3 folder https://github.com/osxmidi/LinVst/wiki 145 | 146 | To make using the vst2sdk, remove the -DVESTIGE entries from the Makefile and place the vst2sdk pluginterfaces folder inside the main LinVst3 source folder. 147 | 148 | ---------- 149 | 150 | ````//----------------------------------------------------------------------------- 151 | // LICENSE 152 | // (c) 2018, Steinberg Media Technologies GmbH, All Rights Reserved 153 | //----------------------------------------------------------------------------- 154 | // Redistribution and use in source and binary forms, with or without modification, 155 | // are permitted provided that the following conditions are met: 156 | // 157 | // * Redistributions of source code must retain the above copyright notice, 158 | // this list of conditions and the following disclaimer. 159 | // * Redistributions in binary form must reproduce the above copyright notice, 160 | // this list of conditions and the following disclaimer in the documentation 161 | // and/or other materials provided with the distribution. 162 | // * Neither the name of the Steinberg Media Technologies nor the names of its 163 | // contributors may be used to endorse or promote products derived from this 164 | // software without specific prior written permission. 165 | // 166 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 167 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 168 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 169 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 170 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 171 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 172 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 173 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 174 | // OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 175 | // OF THE POSSIBILITY OF SUCH DAMAGE. 176 | //----------------------------------------------------------------------------- 177 | -------------------------------------------------------------------------------- /vst2wrapper.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------ 2 | // Project : VST SDK 3 | // 4 | // Category : Helpers 5 | // Filename : public.sdk/source/vst/vst2wrapper/vst2wrapper.h 6 | // Created by : Steinberg, 01/2009 7 | // Description : VST 3 -> VST 2 Wrapper 8 | // 9 | //----------------------------------------------------------------------------- 10 | // LICENSE 11 | // (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved 12 | //----------------------------------------------------------------------------- 13 | // Redistribution and use in source and binary forms, with or without 14 | // modification, are permitted provided that the following conditions are met: 15 | // 16 | // * Redistributions of source code must retain the above copyright notice, 17 | // this list of conditions and the following disclaimer. 18 | // * Redistributions in binary form must reproduce the above copyright notice, 19 | // this list of conditions and the following disclaimer in the documentation 20 | // and/or other materials provided with the distribution. 21 | // * Neither the name of the Steinberg Media Technologies nor the names of its 22 | // contributors may be used to endorse or promote products derived from this 23 | // software without specific prior written permission. 24 | // 25 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | // POSSIBILITY OF SUCH DAMAGE. 36 | //----------------------------------------------------------------------------- 37 | 38 | #pragma once 39 | 40 | #include "docvst2.h" 41 | 42 | /// \cond ignore 43 | #include "basewrapper.h" 44 | // #include "public.sdk/source/vst2.x/audioeffectx.h" 45 | 46 | //------------------------------------------------------------------------ 47 | namespace Steinberg { 48 | namespace Vst { 49 | 50 | class Vst2MidiEventQueue; 51 | class Vst2EditorWrapper; 52 | 53 | //------------------------------------------------------------------------ 54 | class Vst2Wrapper : public BaseWrapper, 55 | public IVst3ToVst2Wrapper 56 | // , public ::AudioEffectX, public IVst3ToVst2Wrapper 57 | { 58 | public: 59 | Vst2EditorWrapper *editor; 60 | 61 | // will owned factory 62 | static Vst2Wrapper *create(IPluginFactory *factory, 63 | const TUID vst3ComponentID, VstInt32 vst2ID, 64 | audioMasterCallback audioMaster); 65 | 66 | Vst2Wrapper(BaseWrapper::SVST3Config &config, audioMasterCallback audioMaster, 67 | VstInt32 vst2ID); 68 | virtual ~Vst2Wrapper(); 69 | 70 | //--- ------------------------------------------------------ 71 | //--- BaseWrapper ------------------------------------------ 72 | bool init(audioMasterCallback audioMaster); 73 | void _canDoubleReplacing(bool val); 74 | void _setInitialDelay(int32 delay); 75 | void _noTail(bool val); 76 | void setupProcessTimeInfo(); 77 | 78 | void setupParameters(); 79 | void setupBuses(); 80 | 81 | void _ioChanged(); 82 | void _updateDisplay(); 83 | void _setNumInputs(int32 inputs); 84 | void _setNumOutputs(int32 outputs); 85 | bool _sizeWindow(int32 width, int32 height); 86 | 87 | //--- --------------------------------------------------------------------- 88 | // VST 3 Interfaces ------------------------------------------------------ 89 | // IComponentHandler 90 | tresult PLUGIN_API beginEdit(ParamID tag); 91 | tresult PLUGIN_API performEdit(ParamID tag, ParamValue valueNormalized); 92 | tresult PLUGIN_API endEdit(ParamID tag); 93 | 94 | // IHostApplication 95 | tresult PLUGIN_API getName(String128 name); 96 | 97 | //--- --------------------------------------------------------------------- 98 | // VST 2 AudioEffectX overrides 99 | // ----------------------------------------------- 100 | void suspend(); // Called when Plug-in is switched to off 101 | void resume(); // Called when Plug-in is switched to on 102 | VstInt32 startProcess(); 103 | VstInt32 stopProcess(); 104 | 105 | // Called when the sample rate changes (always in a suspend state) 106 | void setSampleRate(float newSamplerate); 107 | 108 | // Called when the maximum block size changes 109 | // (always in a suspend state). Note that the 110 | // sampleFrames in Process Calls could be 111 | // smaller than this block size, but NOT bigger. 112 | void setBlockSize(VstInt32 newBlockSize); 113 | 114 | float getParameter(VstInt32 index); 115 | void setParameter(VstInt32 index, float value); 116 | 117 | void setProgram(VstInt32 program); 118 | void setProgramName(char *name); 119 | VstInt32 getProgram(); 120 | void getProgramName(char *name); 121 | bool getProgramNameIndexed(VstInt32 category, VstInt32 index, char *text); 122 | 123 | void getParameterLabel(VstInt32 index, char *label); 124 | void getParameterDisplay(VstInt32 index, char *text); 125 | void getParameterName(VstInt32 index, char *text); 126 | bool canParameterBeAutomated(VstInt32 index); 127 | bool string2parameter(VstInt32 index, char *text); 128 | 129 | VstInt32 getChunk(void **data, bool isPreset = false); 130 | VstInt32 setChunk(void *data, VstInt32 byteSize, bool isPreset = false); 131 | 132 | bool setBypass(bool onOff); 133 | 134 | bool setProcessPrecision(VstInt32 precision); 135 | VstInt32 getNumMidiInputChannels(); 136 | VstInt32 getNumMidiOutputChannels(); 137 | VstInt32 getGetTailSize(); 138 | bool getEffectName(char *name); 139 | bool getVendorString(char *text); 140 | VstInt32 getVendorVersion(); 141 | VstIntPtr vendorSpecific(VstInt32 lArg, VstIntPtr lArg2, void *ptrArg, 142 | float floatArg); 143 | 144 | VstInt32 canDo(char *text); 145 | 146 | // finally process... 147 | void processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames); 148 | void processDoubleReplacing(double **inputs, double **outputs, 149 | VstInt32 sampleFrames); 150 | VstInt32 processEvents(VstEvents *events); 151 | 152 | #ifndef VESTIGE 153 | bool getInputProperties(VstInt32 index, VstPinProperties *properties); 154 | bool getOutputProperties(VstInt32 index, VstPinProperties *properties); 155 | 156 | bool getPinProperties(BusDirection dir, VstInt32 pinIndex, 157 | VstPinProperties *properties); 158 | bool pinIndexToBusChannel(BusDirection dir, VstInt32 pinIndex, 159 | int32 &busIndex, int32 &busChannel); 160 | 161 | static VstInt32 vst3ToVst2SpeakerArr(SpeakerArrangement vst3Arr); 162 | static SpeakerArrangement vst2ToVst3SpeakerArr(VstInt32 vst2Arr); 163 | static VstInt32 vst3ToVst2Speaker(Speaker vst3Speaker); 164 | #endif 165 | 166 | VstInt32 curProgram; 167 | int32 initialdelay; 168 | bool doublereplacing; 169 | int32 numinputs; 170 | int32 numoutputs; 171 | int32 numparams; 172 | int32 numprograms; 173 | bool synth; 174 | 175 | audioMasterCallback audioMaster = nullptr; 176 | 177 | //--- ------------------------------------------------------ 178 | DEFINE_INTERFACES 179 | DEF_INTERFACE(Vst::IVst3ToVst2Wrapper) 180 | END_DEFINE_INTERFACES(BaseWrapper) 181 | REFCOUNT_METHODS( 182 | BaseWrapper) //------------------------------------------------------------------------ 183 | protected: 184 | Vst2MidiEventQueue *mVst2OutputEvents{nullptr}; 185 | VstInt32 mCurrentProcessLevel{0}; 186 | 187 | void updateProcessLevel(); 188 | 189 | void processOutputEvents(); 190 | }; 191 | 192 | //------------------------------------------------------------------------ 193 | // Vst2EditorWrapper Declaration 194 | //------------------------------------------------------------------------ 195 | class Vst2EditorWrapper : public BaseEditorWrapper { 196 | public: 197 | //------------------------------------------------------------------------ 198 | Vst2EditorWrapper(IEditController *controller, 199 | audioMasterCallback audioMaster); 200 | 201 | //--- from BaseEditorWrapper --------------------- 202 | void _close(); 203 | 204 | //--- from AEffEditor------------------- 205 | bool getRect(ERect **rect); 206 | bool open(void *ptr); 207 | void close() { _close(); } 208 | bool setKnobMode(VstInt32 val) { 209 | return BaseEditorWrapper::_setKnobMode(static_cast(val)); 210 | } 211 | 212 | //--- IPlugFrame ---------------------------- 213 | tresult PLUGIN_API resizeView(IPlugView *view, ViewRect *newSize); 214 | 215 | audioMasterCallback audioMaster3 = nullptr; 216 | 217 | //------------------------------------------------------------------------ 218 | protected: 219 | ERect mERect; 220 | }; 221 | 222 | //------------------------------------------------------------------------ 223 | } // namespace Vst 224 | } // namespace Steinberg 225 | 226 | /** Must be implemented externally. */ 227 | // extern ::AudioEffect* createEffectInstance (audioMasterCallback audioMaster); 228 | 229 | /// \endcond 230 | -------------------------------------------------------------------------------- /TestVst3/vst2wrapper.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------ 2 | // Project : VST SDK 3 | // 4 | // Category : Helpers 5 | // Filename : public.sdk/source/vst/vst2wrapper/vst2wrapper.h 6 | // Created by : Steinberg, 01/2009 7 | // Description : VST 3 -> VST 2 Wrapper 8 | // 9 | //----------------------------------------------------------------------------- 10 | // LICENSE 11 | // (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved 12 | //----------------------------------------------------------------------------- 13 | // Redistribution and use in source and binary forms, with or without 14 | // modification, are permitted provided that the following conditions are met: 15 | // 16 | // * Redistributions of source code must retain the above copyright notice, 17 | // this list of conditions and the following disclaimer. 18 | // * Redistributions in binary form must reproduce the above copyright notice, 19 | // this list of conditions and the following disclaimer in the documentation 20 | // and/or other materials provided with the distribution. 21 | // * Neither the name of the Steinberg Media Technologies nor the names of its 22 | // contributors may be used to endorse or promote products derived from this 23 | // software without specific prior written permission. 24 | // 25 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | // POSSIBILITY OF SUCH DAMAGE. 36 | //----------------------------------------------------------------------------- 37 | 38 | #pragma once 39 | 40 | #include "docvst2.h" 41 | 42 | /// \cond ignore 43 | #include "basewrapper.h" 44 | // #include "public.sdk/source/vst2.x/audioeffectx.h" 45 | 46 | //------------------------------------------------------------------------ 47 | namespace Steinberg { 48 | namespace Vst { 49 | 50 | class Vst2MidiEventQueue; 51 | class Vst2EditorWrapper; 52 | 53 | //------------------------------------------------------------------------ 54 | class Vst2Wrapper : public BaseWrapper, 55 | public IVst3ToVst2Wrapper 56 | // , public ::AudioEffectX, public IVst3ToVst2Wrapper 57 | { 58 | public: 59 | Vst2EditorWrapper *editor; 60 | 61 | // will owned factory 62 | static Vst2Wrapper *create(IPluginFactory *factory, 63 | const TUID vst3ComponentID, VstInt32 vst2ID, 64 | audioMasterCallback audioMaster); 65 | 66 | Vst2Wrapper(BaseWrapper::SVST3Config &config, audioMasterCallback audioMaster, 67 | VstInt32 vst2ID); 68 | virtual ~Vst2Wrapper(); 69 | 70 | //--- ------------------------------------------------------ 71 | //--- BaseWrapper ------------------------------------------ 72 | bool init(audioMasterCallback audioMaster); 73 | void _canDoubleReplacing(bool val); 74 | void _setInitialDelay(int32 delay); 75 | void _noTail(bool val); 76 | void setupProcessTimeInfo(); 77 | 78 | void setupParameters(); 79 | void setupBuses(); 80 | 81 | void _ioChanged(); 82 | void _updateDisplay(); 83 | void _setNumInputs(int32 inputs); 84 | void _setNumOutputs(int32 outputs); 85 | bool _sizeWindow(int32 width, int32 height); 86 | 87 | //--- --------------------------------------------------------------------- 88 | // VST 3 Interfaces ------------------------------------------------------ 89 | // IComponentHandler 90 | tresult PLUGIN_API beginEdit(ParamID tag); 91 | tresult PLUGIN_API performEdit(ParamID tag, ParamValue valueNormalized); 92 | tresult PLUGIN_API endEdit(ParamID tag); 93 | 94 | // IHostApplication 95 | tresult PLUGIN_API getName(String128 name); 96 | 97 | //--- --------------------------------------------------------------------- 98 | // VST 2 AudioEffectX overrides 99 | // ----------------------------------------------- 100 | void suspend(); // Called when Plug-in is switched to off 101 | void resume(); // Called when Plug-in is switched to on 102 | VstInt32 startProcess(); 103 | VstInt32 stopProcess(); 104 | 105 | // Called when the sample rate changes (always in a suspend state) 106 | void setSampleRate(float newSamplerate); 107 | 108 | // Called when the maximum block size changes 109 | // (always in a suspend state). Note that the 110 | // sampleFrames in Process Calls could be 111 | // smaller than this block size, but NOT bigger. 112 | void setBlockSize(VstInt32 newBlockSize); 113 | 114 | float getParameter(VstInt32 index); 115 | void setParameter(VstInt32 index, float value); 116 | 117 | void setProgram(VstInt32 program); 118 | void setProgramName(char *name); 119 | VstInt32 getProgram(); 120 | void getProgramName(char *name); 121 | bool getProgramNameIndexed(VstInt32 category, VstInt32 index, char *text); 122 | 123 | void getParameterLabel(VstInt32 index, char *label); 124 | void getParameterDisplay(VstInt32 index, char *text); 125 | void getParameterName(VstInt32 index, char *text); 126 | bool canParameterBeAutomated(VstInt32 index); 127 | bool string2parameter(VstInt32 index, char *text); 128 | 129 | VstInt32 getChunk(void **data, bool isPreset = false); 130 | VstInt32 setChunk(void *data, VstInt32 byteSize, bool isPreset = false); 131 | 132 | bool setBypass(bool onOff); 133 | 134 | bool setProcessPrecision(VstInt32 precision); 135 | VstInt32 getNumMidiInputChannels(); 136 | VstInt32 getNumMidiOutputChannels(); 137 | VstInt32 getGetTailSize(); 138 | bool getEffectName(char *name); 139 | bool getVendorString(char *text); 140 | VstInt32 getVendorVersion(); 141 | VstIntPtr vendorSpecific(VstInt32 lArg, VstIntPtr lArg2, void *ptrArg, 142 | float floatArg); 143 | 144 | VstInt32 canDo(char *text); 145 | 146 | // finally process... 147 | void processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames); 148 | void processDoubleReplacing(double **inputs, double **outputs, 149 | VstInt32 sampleFrames); 150 | VstInt32 processEvents(VstEvents *events); 151 | 152 | #ifndef VESTIGE 153 | bool getInputProperties(VstInt32 index, VstPinProperties *properties); 154 | bool getOutputProperties(VstInt32 index, VstPinProperties *properties); 155 | 156 | bool getPinProperties(BusDirection dir, VstInt32 pinIndex, 157 | VstPinProperties *properties); 158 | bool pinIndexToBusChannel(BusDirection dir, VstInt32 pinIndex, 159 | int32 &busIndex, int32 &busChannel); 160 | 161 | static VstInt32 vst3ToVst2SpeakerArr(SpeakerArrangement vst3Arr); 162 | static SpeakerArrangement vst2ToVst3SpeakerArr(VstInt32 vst2Arr); 163 | static VstInt32 vst3ToVst2Speaker(Speaker vst3Speaker); 164 | #endif 165 | 166 | VstInt32 curProgram; 167 | int32 initialdelay; 168 | bool doublereplacing; 169 | int32 numinputs; 170 | int32 numoutputs; 171 | int32 numparams; 172 | int32 numprograms; 173 | bool synth; 174 | 175 | audioMasterCallback audioMaster = nullptr; 176 | 177 | //--- ------------------------------------------------------ 178 | DEFINE_INTERFACES 179 | DEF_INTERFACE(Vst::IVst3ToVst2Wrapper) 180 | END_DEFINE_INTERFACES(BaseWrapper) 181 | REFCOUNT_METHODS( 182 | BaseWrapper) //------------------------------------------------------------------------ 183 | protected: 184 | Vst2MidiEventQueue *mVst2OutputEvents{nullptr}; 185 | VstInt32 mCurrentProcessLevel{0}; 186 | 187 | void updateProcessLevel(); 188 | 189 | void processOutputEvents(); 190 | }; 191 | 192 | //------------------------------------------------------------------------ 193 | // Vst2EditorWrapper Declaration 194 | //------------------------------------------------------------------------ 195 | class Vst2EditorWrapper : public BaseEditorWrapper { 196 | public: 197 | //------------------------------------------------------------------------ 198 | Vst2EditorWrapper(IEditController *controller, 199 | audioMasterCallback audioMaster); 200 | 201 | //--- from BaseEditorWrapper --------------------- 202 | void _close(); 203 | 204 | //--- from AEffEditor------------------- 205 | bool getRect(ERect **rect); 206 | bool open(void *ptr); 207 | void close() { _close(); } 208 | bool setKnobMode(VstInt32 val) { 209 | return BaseEditorWrapper::_setKnobMode(static_cast(val)); 210 | } 211 | 212 | //--- IPlugFrame ---------------------------- 213 | tresult PLUGIN_API resizeView(IPlugView *view, ViewRect *newSize); 214 | 215 | audioMasterCallback audioMaster3 = nullptr; 216 | 217 | //------------------------------------------------------------------------ 218 | protected: 219 | ERect mERect; 220 | }; 221 | 222 | //------------------------------------------------------------------------ 223 | } // namespace Vst 224 | } // namespace Steinberg 225 | 226 | /** Must be implemented externally. */ 227 | // extern ::AudioEffect* createEffectInstance (audioMasterCallback audioMaster); 228 | 229 | /// \endcond 230 | -------------------------------------------------------------------------------- /convert/linvstconvertgtk.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | gchar *folderpath; 12 | gchar *filepath; 13 | 14 | int filehit = 0; 15 | int folderhit = 0; 16 | int filecopy = 0; 17 | 18 | int intimer = 0; 19 | 20 | int dofullup = 0; 21 | 22 | char foldertest[2048]; 23 | 24 | size_t find_last(std::string searchstr, std::string searcharg) 25 | { 26 | size_t foundret = 0; 27 | size_t found = searchstr.find(searcharg, 0); 28 | foundret = found; 29 | 30 | while(found != std::string::npos) 31 | { 32 | found += searcharg.size(); 33 | found = searchstr.find(searcharg, found); 34 | if(found != std::string::npos) 35 | foundret = found; 36 | } 37 | return foundret; 38 | } 39 | 40 | bool dosym(std::string path) 41 | { 42 | std::string vst3string; 43 | std::string vst3string2; 44 | std::string vst3stringcase; 45 | struct stat sb; 46 | size_t found; 47 | 48 | vst3string = path; 49 | vst3stringcase = path; 50 | transform(vst3stringcase.begin(), vst3stringcase.end(), vst3stringcase.begin(), ::tolower); 51 | found = vst3stringcase.find(".vst3", 0); 52 | vst3string2 = vst3string.substr(0, found + 5); 53 | vst3string = vst3string.substr(0, found); 54 | if((stat(vst3string2.c_str(), &sb) == 0) && S_ISDIR(sb.st_mode)) 55 | { 56 | vst3string = vst3string + "-linvst3"; 57 | symlink(vst3string2.c_str(), vst3string.c_str()); 58 | return true; 59 | } 60 | return false; 61 | } 62 | 63 | int doconvert(char *linvst, char folder[]) 64 | { 65 | DIR *dirlist; 66 | struct dirent *dentry; 67 | std::string convertname; 68 | std::string convertnamecase; 69 | std::string cfolder; 70 | char *folderpath[] = {folder, 0}; 71 | int vst3filehit; 72 | FTSENT *node; 73 | FTS *fs; 74 | bool test; 75 | 76 | filecopy = 1; 77 | test = std::ifstream(linvst).good(); 78 | 79 | if(!test) 80 | { 81 | filecopy = 0; 82 | return 1; 83 | } 84 | 85 | fs = fts_open(folderpath, FTS_NOCHDIR | FTS_LOGICAL, 0); 86 | if (!fs) 87 | { 88 | return 1; 89 | } 90 | 91 | while ((node = fts_read(fs))) 92 | { 93 | switch (node->fts_info) { 94 | case FTS_DNR: 95 | case FTS_ERR: 96 | case FTS_NS: 97 | case FTS_DP: 98 | break; 99 | case FTS_F: 100 | convertname = node->fts_path; 101 | convertnamecase = convertname; 102 | transform(convertnamecase.begin(), convertnamecase.end(), convertnamecase.begin(), ::tolower); 103 | vst3filehit = 0; 104 | 105 | if(convertnamecase.find(".vst3") != std::string::npos) 106 | { 107 | int fulllength = strlen(convertnamecase.c_str()); 108 | if((convertnamecase[fulllength - 1] == '3') && (convertnamecase[fulllength - 2] == 't') && (convertnamecase[fulllength - 3] == 's') && (convertnamecase[fulllength - 4] == 'v') && (convertnamecase[fulllength - 5] == '.')) 109 | { 110 | dosym(convertname.c_str()); 111 | size_t position = find_last(convertnamecase, ".vst3"); 112 | if(position != 0) 113 | convertname.replace(convertname.begin() + position, convertname.end(), ".so"); 114 | vst3filehit = 1; 115 | } 116 | } 117 | 118 | if(vst3filehit == 1) 119 | { 120 | if(dofullup == 1) 121 | { 122 | std::string sourcename = linvst; 123 | std::ifstream source(sourcename.c_str(), std::ios::binary); 124 | std::ofstream dest(convertname.c_str(), std::ios::binary); 125 | dest << source.rdbuf(); 126 | source.close(); 127 | dest.close(); 128 | } 129 | else 130 | { 131 | test = std::ifstream(convertname).good(); 132 | 133 | if(!test) 134 | { 135 | std::string sourcename = linvst; 136 | std::ifstream source(sourcename.c_str(), std::ios::binary); 137 | std::ofstream dest(convertname.c_str(), std::ios::binary); 138 | dest << source.rdbuf(); 139 | source.close(); 140 | dest.close(); 141 | } 142 | } 143 | } 144 | break; 145 | 146 | default: 147 | break; 148 | } 149 | } 150 | 151 | if(fs) 152 | fts_close(fs); 153 | filecopy = 0; 154 | 155 | return 0; 156 | } 157 | 158 | void quitcallback () 159 | { 160 | if(filecopy == 0) 161 | { 162 | if(folderpath) 163 | g_free(folderpath); 164 | 165 | if(filepath) 166 | g_free(filepath); 167 | 168 | gtk_main_quit (); 169 | } 170 | } 171 | 172 | void foldercallback (GtkFileChooser *folderselect) 173 | { 174 | 175 | folderpath = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (folderselect)); 176 | 177 | folderhit = 1; 178 | 179 | } 180 | 181 | void filecallback (GtkFileChooser *fileselect) 182 | { 183 | 184 | filepath = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (fileselect)); 185 | 186 | filehit = 1; 187 | 188 | } 189 | 190 | gboolean dolabelupdate(gpointer data) 191 | { 192 | 193 | gtk_button_set_label(GTK_BUTTON (data), "Update Newly Added Plugins"); 194 | 195 | intimer = 0; 196 | 197 | return FALSE; 198 | 199 | } 200 | 201 | gboolean dolabelupdate2(gpointer data) 202 | { 203 | 204 | gtk_button_set_label(GTK_BUTTON (data), "Update All Plugins (Upgrade All Plugins)"); 205 | 206 | intimer = 0; 207 | 208 | return FALSE; 209 | 210 | } 211 | 212 | void buttoncallback(GtkFileChooser *button, gpointer data) 213 | { 214 | 215 | std::string name; 216 | 217 | if((filehit == 1) && (folderhit == 1) && (intimer == 0)) 218 | { 219 | 220 | name = filepath; 221 | 222 | if(name.find("linvst3.so") == std::string::npos) 223 | { 224 | gtk_button_set_label(GTK_BUTTON (button), "Not Found"); 225 | 226 | filecopy = 0; 227 | filehit = 0; 228 | folderhit = 0; 229 | 230 | intimer = 1; 231 | 232 | g_timeout_add_seconds(3, dolabelupdate, (GtkWidget *)data); 233 | 234 | return; 235 | } 236 | 237 | if(doconvert(filepath, folderpath) == 1) 238 | { 239 | gtk_button_set_label(GTK_BUTTON (button), "Not Found"); 240 | 241 | filecopy = 0; 242 | filehit = 0; 243 | folderhit = 0; 244 | 245 | intimer = 1; 246 | 247 | g_timeout_add_seconds(3, dolabelupdate, (GtkWidget *)data); 248 | 249 | return; 250 | } 251 | 252 | filecopy = 0; 253 | filehit = 1; 254 | folderhit = 0; 255 | 256 | gtk_button_set_label(GTK_BUTTON (button), "Done"); 257 | 258 | intimer = 1; 259 | 260 | g_timeout_add_seconds(3, dolabelupdate, (GtkWidget *)data); 261 | 262 | } 263 | 264 | } 265 | 266 | void buttoncallback2(GtkFileChooser *button, gpointer data) 267 | { 268 | std::string name; 269 | 270 | if((filehit == 1) && (folderhit == 1) && (intimer == 0)) 271 | { 272 | 273 | name = filepath; 274 | 275 | if(name.find("linvst3.so") == std::string::npos) 276 | { 277 | gtk_button_set_label(GTK_BUTTON (button), "Not Found"); 278 | 279 | filecopy = 0; 280 | filehit = 0; 281 | folderhit = 0; 282 | 283 | intimer = 1; 284 | 285 | g_timeout_add_seconds(3, dolabelupdate2, (GtkWidget *)data); 286 | 287 | return; 288 | } 289 | 290 | dofullup = 1; 291 | 292 | if(doconvert(filepath, folderpath) == 1) 293 | { 294 | gtk_button_set_label(GTK_BUTTON (button), "Not Found"); 295 | 296 | filecopy = 0; 297 | filehit = 0; 298 | folderhit = 0; 299 | dofullup = 0; 300 | 301 | intimer = 1; 302 | 303 | g_timeout_add_seconds(3, dolabelupdate2, (GtkWidget *)data); 304 | 305 | return; 306 | } 307 | 308 | filecopy = 0; 309 | filehit = 1; 310 | folderhit = 0; 311 | dofullup = 0; 312 | 313 | gtk_button_set_label(GTK_BUTTON (button), "Done"); 314 | 315 | intimer = 1; 316 | 317 | g_timeout_add_seconds(3, dolabelupdate2, (GtkWidget *)data); 318 | 319 | } 320 | } 321 | 322 | int main (int argc, char *argv[]) 323 | { 324 | GtkWidget *window, *folderselect, *fileselect, *spacertext, *spacertext2, *spacertext3, *vbox, *button, *button2; 325 | GtkFileFilter *extfilter; 326 | 327 | gtk_init (&argc, &argv); 328 | 329 | window = gtk_window_new (GTK_WINDOW_TOPLEVEL); 330 | gtk_window_set_default_size (GTK_WINDOW (window), 600, 300); 331 | gtk_window_set_title (GTK_WINDOW (window), "LinVst3"); 332 | gtk_container_set_border_width (GTK_CONTAINER (window), 8); 333 | 334 | spacertext = gtk_label_new ("Choose linvst3.so"); 335 | spacertext2 = gtk_label_new ("Choose vst3 folder"); 336 | spacertext3 = gtk_label_new ("Convert"); 337 | 338 | folderselect = gtk_file_chooser_button_new ("Choose vst3 Folder", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); 339 | fileselect = gtk_file_chooser_button_new ("Choose linvst3.so", GTK_FILE_CHOOSER_ACTION_OPEN); 340 | 341 | button = gtk_button_new (); 342 | gtk_button_set_label(GTK_BUTTON (button), "Update Newly Added Plugins"); 343 | 344 | button2 = gtk_button_new (); 345 | gtk_button_set_label(GTK_BUTTON (button2), "Update All Plugins (Upgrade All Plugins)"); 346 | 347 | vbox = gtk_vbox_new (FALSE, 8); 348 | gtk_box_pack_start(GTK_BOX (vbox), spacertext, FALSE, FALSE, 0); 349 | gtk_box_pack_start(GTK_BOX (vbox), fileselect, FALSE, FALSE, 0); 350 | gtk_box_pack_start(GTK_BOX (vbox), spacertext2, FALSE, FALSE, 0); 351 | gtk_box_pack_start(GTK_BOX (vbox), folderselect, FALSE, FALSE, 0); 352 | gtk_box_pack_start(GTK_BOX (vbox), spacertext3, FALSE, FALSE, 0); 353 | gtk_box_pack_start(GTK_BOX (vbox), button, FALSE, FALSE, 0); 354 | gtk_box_pack_start(GTK_BOX (vbox), button2, FALSE, FALSE, 0); 355 | 356 | g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (quitcallback), NULL); 357 | g_signal_connect (G_OBJECT (folderselect), "selection_changed", G_CALLBACK (foldercallback), NULL); 358 | g_signal_connect (G_OBJECT (fileselect), "selection_changed", G_CALLBACK (filecallback), NULL); 359 | g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (buttoncallback), button); 360 | g_signal_connect (G_OBJECT (button2), "clicked", G_CALLBACK (buttoncallback2), button2); 361 | 362 | gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(folderselect), TRUE); 363 | gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(fileselect), TRUE); 364 | 365 | gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (folderselect), g_get_home_dir()); 366 | gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (fileselect), g_get_current_dir ()); 367 | 368 | extfilter = gtk_file_filter_new (); 369 | gtk_file_filter_add_pattern (extfilter, "linvst3.so"); 370 | gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (fileselect), extfilter); 371 | 372 | gtk_container_add (GTK_CONTAINER (window), vbox); 373 | gtk_widget_show_all (window); 374 | 375 | gtk_main (); 376 | return 0; 377 | } 378 | 379 | -------------------------------------------------------------------------------- /TestVst3/vestige.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aeffectx.h - simple header to allow VeSTige compilation and eventually work 3 | * 4 | * Copyright (c) 2006 Javier Serrano Polo 5 | * 6 | * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net 7 | * 8 | * This program is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2 of the License, or (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public 19 | * License along with this program (see COPYING); if not, write to the 20 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 | * Boston, MA 02110-1301 USA. 22 | * 23 | */ 24 | 25 | #ifndef _AEFFECTX_H 26 | #define _AEFFECTX_H 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | #define CCONST(a, b, c, d) \ 33 | ((((int)a) << 24) | (((int)b) << 16) | (((int)c) << 8) | (((int)d) << 0)) 34 | 35 | const int audioMasterAutomate = 0; 36 | const int audioMasterVersion = 1; 37 | const int audioMasterCurrentId = 2; 38 | const int audioMasterIdle = 3; 39 | const int audioMasterPinConnected = 4; 40 | // unsupported? 5 41 | const int audioMasterWantMidi = 6; 42 | const int audioMasterGetTime = 7; 43 | const int audioMasterProcessEvents = 8; 44 | const int audioMasterSetTime = 9; 45 | const int audioMasterTempoAt = 10; 46 | const int audioMasterGetNumAutomatableParameters = 11; 47 | const int audioMasterGetParameterQuantization = 12; 48 | const int audioMasterIOChanged = 13; 49 | const int audioMasterNeedIdle = 14; 50 | const int audioMasterSizeWindow = 15; 51 | const int audioMasterGetSampleRate = 16; 52 | const int audioMasterGetBlockSize = 17; 53 | const int audioMasterGetInputLatency = 18; 54 | const int audioMasterGetOutputLatency = 19; 55 | const int audioMasterGetPreviousPlug = 20; 56 | const int audioMasterGetNextPlug = 21; 57 | const int audioMasterWillReplaceOrAccumulate = 22; 58 | const int audioMasterGetCurrentProcessLevel = 23; 59 | const int audioMasterGetAutomationState = 24; 60 | const int audioMasterOfflineStart = 25; 61 | const int audioMasterOfflineRead = 26; 62 | const int audioMasterOfflineWrite = 27; 63 | const int audioMasterOfflineGetCurrentPass = 28; 64 | const int audioMasterOfflineGetCurrentMetaPass = 29; 65 | const int audioMasterSetOutputSampleRate = 30; 66 | // unsupported? 31 67 | const int audioMasterGetSpeakerArrangement = 31; // deprecated in 2.4? 68 | const int audioMasterGetVendorString = 32; 69 | const int audioMasterGetProductString = 33; 70 | const int audioMasterGetVendorVersion = 34; 71 | const int audioMasterVendorSpecific = 35; 72 | const int audioMasterSetIcon = 36; 73 | const int audioMasterCanDo = 37; 74 | const int audioMasterGetLanguage = 38; 75 | const int audioMasterOpenWindow = 39; 76 | const int audioMasterCloseWindow = 40; 77 | const int audioMasterGetDirectory = 41; 78 | const int audioMasterUpdateDisplay = 42; 79 | const int audioMasterBeginEdit = 43; 80 | const int audioMasterEndEdit = 44; 81 | const int audioMasterOpenFileSelector = 45; 82 | const int audioMasterCloseFileSelector = 46; // currently unused 83 | const int audioMasterEditFile = 47; // currently unused 84 | const int audioMasterGetChunkFile = 48; // currently unused 85 | const int audioMasterGetInputSpeakerArrangement = 49; // currently unused 86 | 87 | const int effFlagsHasEditor = 1; 88 | const int effFlagsCanReplacing = 1 << 4; // very likely 89 | const int effFlagsProgramChunks = 1 << 5; // from Ardour 90 | const int effFlagsIsSynth = 1 << 8; // currently unused 91 | 92 | const int effFlagsCanDoubleReplacing = 1 << 12; 93 | 94 | const int effOpen = 0; 95 | const int effClose = 1; // currently unused 96 | const int effSetProgram = 2; // currently unused 97 | const int effGetProgram = 3; // currently unused 98 | // The next one was gleaned from 99 | // http://www.kvraudio.com/forum/viewtopic.php?p=1905347 100 | const int effSetProgramName = 4; 101 | const int effGetProgramName = 5; // currently unused 102 | // The next two were gleaned from 103 | // http://www.kvraudio.com/forum/viewtopic.php?p=1905347 104 | const int effGetParamLabel = 6; 105 | const int effGetParamDisplay = 7; 106 | const int effGetParamName = 8; // currently unused 107 | const int effSetSampleRate = 10; 108 | const int effSetBlockSize = 11; 109 | const int effMainsChanged = 12; 110 | const int effEditGetRect = 13; 111 | const int effEditOpen = 14; 112 | const int effEditClose = 15; 113 | const int effEditIdle = 19; 114 | const int effEditTop = 20; 115 | const int effIdentify = 116 | 22; // from http://www.asseca.org/vst-24-specs/efIdentify.html 117 | const int effGetChunk = 23; // from Ardour 118 | const int effSetChunk = 24; // from Ardour 119 | const int effProcessEvents = 25; 120 | // The next one was gleaned from 121 | // http://www.asseca.org/vst-24-specs/efCanBeAutomated.html 122 | const int effCanBeAutomated = 26; 123 | // The next one was gleaned from 124 | // http://www.kvraudio.com/forum/viewtopic.php?p=1905347 125 | const int effGetProgramNameIndexed = 29; 126 | const int effGetInputProperties = 33; 127 | const int effGetOutputProperties = 34; 128 | // The next one was gleaned from 129 | // http://www.asseca.org/vst-24-specs/efGetPlugCategory.html 130 | const int effGetPlugCategory = 35; 131 | const int effGetEffectName = 45; 132 | const int effGetParameterProperties = 56; // missing 133 | const int effGetVendorString = 47; 134 | const int effGetProductString = 48; 135 | const int effGetVendorVersion = 49; 136 | const int effCanDo = 51; // currently unused 137 | // The next one was gleaned from http://www.asseca.org/vst-24-specs/efIdle.html 138 | const int effIdle = 53; 139 | const int effGetVstVersion = 58; // currently unused 140 | // The next one was gleaned from 141 | // http://www.asseca.org/vst-24-specs/efBeginSetProgram.html 142 | const int effBeginSetProgram = 67; 143 | // The next one was gleaned from 144 | // http://www.asseca.org/vst-24-specs/efEndSetProgram.html 145 | const int effEndSetProgram = 68; 146 | // The next one was gleaned from 147 | // http://www.asseca.org/vst-24-specs/efShellGetNextPlugin.html 148 | const int effShellGetNextPlugin = 70; 149 | // The next two were gleaned from 150 | // http://www.kvraudio.com/forum/printview.php?t=143587&start=0 151 | const int effStartProcess = 71; 152 | const int effStopProcess = 72; 153 | // The next one was gleaned from 154 | // http://www.asseca.org/vst-24-specs/efBeginLoadBank.html 155 | const int effBeginLoadBank = 75; 156 | // The next one was gleaned from 157 | // http://www.asseca.org/vst-24-specs/efBeginLoadProgram.html 158 | const int effBeginLoadProgram = 76; 159 | const int effSetProcessPrecision = 77; 160 | 161 | const int kEffectMagic = CCONST('V', 's', 't', 'P'); 162 | const int kVstLangEnglish = 1; 163 | const int kVstMidiType = 1; 164 | 165 | const int kVstNanosValid = 1 << 8; 166 | const int kVstPpqPosValid = 1 << 9; 167 | const int kVstTempoValid = 1 << 10; 168 | const int kVstBarsValid = 1 << 11; 169 | const int kVstCyclePosValid = 1 << 12; 170 | const int kVstTimeSigValid = 1 << 13; 171 | const int kVstSmpteValid = 1 << 14; // from Ardour 172 | const int kVstClockValid = 1 << 15; // from Ardour 173 | 174 | const int kVstTransportPlaying = 1 << 1; 175 | const int kVstTransportCycleActive = 1 << 2; 176 | const int kVstTransportChanged = 1; 177 | 178 | const int kVstSysExType = 6; 179 | const int kVstMaxVendorStrLen = 64; 180 | const int kVstMaxEffectNameLen = 32; 181 | const int kVstMaxProgNameLen = 24; 182 | const int kVstVersion = 2400; 183 | const int kVstMaxParamStrLen = 24; 184 | const int kVstProcessPrecision32 = 0; 185 | const int kVstProcessPrecision64 = 1; 186 | const int kVstMidiEventIsRealtime = 1; 187 | 188 | class VstMidiEvent { 189 | public: 190 | // 00 191 | int type; 192 | // 04 193 | int byteSize; 194 | // 08 195 | int deltaFrames; 196 | // 0c? 197 | int flags; 198 | // 10? 199 | int noteLength; 200 | // 14? 201 | int noteOffset; 202 | // 18 203 | char midiData[4]; 204 | // 1c? 205 | char detune; 206 | // 1d? 207 | char noteOffVelocity; 208 | // 1e? 209 | char reserved1; 210 | // 1f? 211 | char reserved2; 212 | }; 213 | 214 | class VstMidiSysexEvent { 215 | public: 216 | // 00 217 | int type; 218 | // 04 219 | int byteSize; 220 | // 08 221 | int deltaFrames; 222 | // 0c 223 | int flags; 224 | 225 | int dumpBytes; 226 | 227 | int *unknownptr; 228 | 229 | char *sysexDump; 230 | 231 | int *unknownptr2; 232 | }; 233 | 234 | class VstEvent { 235 | public: 236 | // 00 237 | int type; 238 | // 04 239 | int byteSize; 240 | // 08 241 | int deltaFrames; 242 | // 0c 243 | int flags; 244 | // 10 245 | char empty5[16]; 246 | }; 247 | 248 | class VstEvents { 249 | public: 250 | // 00 251 | int numEvents; 252 | // 04 253 | void *reserved; 254 | // 08 255 | VstEvent *events[2]; 256 | }; 257 | 258 | class AEffect { 259 | public: 260 | // Never use virtual functions!!! 261 | // 00-03 262 | int magic; 263 | // dispatcher 04-07 264 | intptr_t VESTIGECALLBACK (*dispatcher)(AEffect *, int, int, intptr_t, void *, 265 | float); 266 | // process, quite sure 08-0b 267 | void VESTIGECALLBACK (*process)(AEffect *, float **, float **, int); 268 | // setParameter 0c-0f 269 | void VESTIGECALLBACK (*setParameter)(AEffect *, int, float); 270 | // getParameter 10-13 271 | float VESTIGECALLBACK (*getParameter)(AEffect *, int); 272 | // programs 14-17 273 | int numPrograms; 274 | // Params 18-1b 275 | int numParams; 276 | // Input 1c-1f 277 | int numInputs; 278 | // Output 20-23 279 | int numOutputs; 280 | // flags 24-27 281 | int flags; 282 | // Fill somewhere 28-2b 283 | void *resvd1; 284 | void *resvd2; 285 | int initialDelay; 286 | // Zeroes 34-37 38-3b 287 | int empty3a; 288 | int empty3b; 289 | // 1.0f 3c-3f 290 | float unkown_float; 291 | // An object? pointer 40-43 292 | void *object; 293 | // Zeroes 44-47 294 | void *user; 295 | // Id 48-4b 296 | int32_t uniqueID; 297 | int32_t version; 298 | // processReplacing 50-53 299 | void VESTIGECALLBACK (*processReplacing)(AEffect *, float **, float **, int); 300 | void VESTIGECALLBACK (*processDoubleReplacing)(AEffect *, double **, 301 | double **, int); 302 | char empty6[56]; 303 | }; 304 | 305 | class VstTimeInfo { 306 | public: 307 | // 00 308 | double samplePos; 309 | // 08 310 | double sampleRate; 311 | // 10 312 | double nanoSeconds; 313 | // 18 314 | double ppqPos; 315 | // 20? 316 | double tempo; 317 | // 28 318 | double barStartPos; 319 | // 30? 320 | double cycleStartPos; 321 | // 38? 322 | double cycleEndPos; 323 | // 40? 324 | int timeSigNumerator; 325 | // 44? 326 | int timeSigDenominator; 327 | // unconfirmed 48 4c 50 328 | char empty3[4 + 4 + 4]; 329 | // 54 330 | int flags; 331 | }; 332 | 333 | typedef intptr_t VESTIGECALLBACK (*audioMasterCallback)(AEffect *, int32_t, 334 | int32_t, intptr_t, 335 | void *, float); 336 | 337 | class ERect { 338 | public: 339 | short top; 340 | short left; 341 | short bottom; 342 | short right; 343 | }; 344 | 345 | #endif 346 | -------------------------------------------------------------------------------- /vestige.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aeffectx.h - simple header to allow VeSTige compilation and eventually work 3 | * 4 | * Copyright (c) 2006 Javier Serrano Polo 5 | * 6 | * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net 7 | * 8 | * This program is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2 of the License, or (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public 19 | * License along with this program (see COPYING); if not, write to the 20 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 | * Boston, MA 02110-1301 USA. 22 | * 23 | */ 24 | 25 | #ifndef _AEFFECTX_H 26 | #define _AEFFECTX_H 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | #define CCONST(a, b, c, d) \ 33 | ((((int)a) << 24) | (((int)b) << 16) | (((int)c) << 8) | (((int)d) << 0)) 34 | 35 | const int audioMasterAutomate = 0; 36 | const int audioMasterVersion = 1; 37 | const int audioMasterCurrentId = 2; 38 | const int audioMasterIdle = 3; 39 | const int audioMasterPinConnected = 4; 40 | // unsupported? 5 41 | const int audioMasterWantMidi = 6; 42 | const int audioMasterGetTime = 7; 43 | const int audioMasterProcessEvents = 8; 44 | const int audioMasterSetTime = 9; 45 | const int audioMasterTempoAt = 10; 46 | const int audioMasterGetNumAutomatableParameters = 11; 47 | const int audioMasterGetParameterQuantization = 12; 48 | const int audioMasterIOChanged = 13; 49 | const int audioMasterNeedIdle = 14; 50 | const int audioMasterSizeWindow = 15; 51 | const int audioMasterGetSampleRate = 16; 52 | const int audioMasterGetBlockSize = 17; 53 | const int audioMasterGetInputLatency = 18; 54 | const int audioMasterGetOutputLatency = 19; 55 | const int audioMasterGetPreviousPlug = 20; 56 | const int audioMasterGetNextPlug = 21; 57 | const int audioMasterWillReplaceOrAccumulate = 22; 58 | const int audioMasterGetCurrentProcessLevel = 23; 59 | const int audioMasterGetAutomationState = 24; 60 | const int audioMasterOfflineStart = 25; 61 | const int audioMasterOfflineRead = 26; 62 | const int audioMasterOfflineWrite = 27; 63 | const int audioMasterOfflineGetCurrentPass = 28; 64 | const int audioMasterOfflineGetCurrentMetaPass = 29; 65 | const int audioMasterSetOutputSampleRate = 30; 66 | // unsupported? 31 67 | const int audioMasterGetSpeakerArrangement = 31; // deprecated in 2.4? 68 | const int audioMasterGetVendorString = 32; 69 | const int audioMasterGetProductString = 33; 70 | const int audioMasterGetVendorVersion = 34; 71 | const int audioMasterVendorSpecific = 35; 72 | const int audioMasterSetIcon = 36; 73 | const int audioMasterCanDo = 37; 74 | const int audioMasterGetLanguage = 38; 75 | const int audioMasterOpenWindow = 39; 76 | const int audioMasterCloseWindow = 40; 77 | const int audioMasterGetDirectory = 41; 78 | const int audioMasterUpdateDisplay = 42; 79 | const int audioMasterBeginEdit = 43; 80 | const int audioMasterEndEdit = 44; 81 | const int audioMasterOpenFileSelector = 45; 82 | const int audioMasterCloseFileSelector = 46; // currently unused 83 | const int audioMasterEditFile = 47; // currently unused 84 | const int audioMasterGetChunkFile = 48; // currently unused 85 | const int audioMasterGetInputSpeakerArrangement = 49; // currently unused 86 | 87 | const int effFlagsHasEditor = 1; 88 | const int effFlagsCanReplacing = 1 << 4; // very likely 89 | const int effFlagsProgramChunks = 1 << 5; // from Ardour 90 | const int effFlagsIsSynth = 1 << 8; // currently unused 91 | 92 | const int effFlagsCanDoubleReplacing = 1 << 12; 93 | 94 | const int effOpen = 0; 95 | const int effClose = 1; // currently unused 96 | const int effSetProgram = 2; // currently unused 97 | const int effGetProgram = 3; // currently unused 98 | // The next one was gleaned from 99 | // http://www.kvraudio.com/forum/viewtopic.php?p=1905347 100 | const int effSetProgramName = 4; 101 | const int effGetProgramName = 5; // currently unused 102 | // The next two were gleaned from 103 | // http://www.kvraudio.com/forum/viewtopic.php?p=1905347 104 | const int effGetParamLabel = 6; 105 | const int effGetParamDisplay = 7; 106 | const int effGetParamName = 8; // currently unused 107 | const int effSetSampleRate = 10; 108 | const int effSetBlockSize = 11; 109 | const int effMainsChanged = 12; 110 | const int effEditGetRect = 13; 111 | const int effEditOpen = 14; 112 | const int effEditClose = 15; 113 | const int effEditIdle = 19; 114 | const int effEditTop = 20; 115 | const int effIdentify = 116 | 22; // from http://www.asseca.org/vst-24-specs/efIdentify.html 117 | const int effGetChunk = 23; // from Ardour 118 | const int effSetChunk = 24; // from Ardour 119 | const int effProcessEvents = 25; 120 | // The next one was gleaned from 121 | // http://www.asseca.org/vst-24-specs/efCanBeAutomated.html 122 | const int effCanBeAutomated = 26; 123 | // The next one was gleaned from 124 | // http://www.kvraudio.com/forum/viewtopic.php?p=1905347 125 | const int effGetProgramNameIndexed = 29; 126 | const int effGetInputProperties = 33; 127 | const int effGetOutputProperties = 34; 128 | // The next one was gleaned from 129 | // http://www.asseca.org/vst-24-specs/efGetPlugCategory.html 130 | const int effGetPlugCategory = 35; 131 | const int effGetEffectName = 45; 132 | const int effGetParameterProperties = 56; // missing 133 | const int effGetVendorString = 47; 134 | const int effGetProductString = 48; 135 | const int effGetVendorVersion = 49; 136 | const int effCanDo = 51; // currently unused 137 | // The next one was gleaned from http://www.asseca.org/vst-24-specs/efIdle.html 138 | const int effIdle = 53; 139 | const int effGetVstVersion = 58; // currently unused 140 | // The next one was gleaned from 141 | // http://www.asseca.org/vst-24-specs/efBeginSetProgram.html 142 | const int effBeginSetProgram = 67; 143 | // The next one was gleaned from 144 | // http://www.asseca.org/vst-24-specs/efEndSetProgram.html 145 | const int effEndSetProgram = 68; 146 | // The next one was gleaned from 147 | // http://www.asseca.org/vst-24-specs/efShellGetNextPlugin.html 148 | const int effShellGetNextPlugin = 70; 149 | // The next two were gleaned from 150 | // http://www.kvraudio.com/forum/printview.php?t=143587&start=0 151 | const int effStartProcess = 71; 152 | const int effStopProcess = 72; 153 | // The next one was gleaned from 154 | // http://www.asseca.org/vst-24-specs/efBeginLoadBank.html 155 | const int effBeginLoadBank = 75; 156 | // The next one was gleaned from 157 | // http://www.asseca.org/vst-24-specs/efBeginLoadProgram.html 158 | const int effBeginLoadProgram = 76; 159 | const int effSetProcessPrecision = 77; 160 | 161 | const int kEffectMagic = CCONST('V', 's', 't', 'P'); 162 | const int kVstLangEnglish = 1; 163 | const int kVstMidiType = 1; 164 | 165 | const int kVstNanosValid = 1 << 8; 166 | const int kVstPpqPosValid = 1 << 9; 167 | const int kVstTempoValid = 1 << 10; 168 | const int kVstBarsValid = 1 << 11; 169 | const int kVstCyclePosValid = 1 << 12; 170 | const int kVstTimeSigValid = 1 << 13; 171 | const int kVstSmpteValid = 1 << 14; // from Ardour 172 | const int kVstClockValid = 1 << 15; // from Ardour 173 | 174 | const int kVstTransportPlaying = 1 << 1; 175 | const int kVstTransportCycleActive = 1 << 2; 176 | const int kVstTransportChanged = 1; 177 | 178 | const int kVstSysExType = 6; 179 | const int kVstMaxVendorStrLen = 64; 180 | const int kVstMaxEffectNameLen = 32; 181 | const int kVstMaxProgNameLen = 24; 182 | const int kVstVersion = 2400; 183 | const int kVstMaxParamStrLen = 24; 184 | const int kVstProcessPrecision32 = 0; 185 | const int kVstProcessPrecision64 = 1; 186 | const int kVstMidiEventIsRealtime = 1; 187 | 188 | class VstMidiEvent { 189 | public: 190 | // 00 191 | int type; 192 | // 04 193 | int byteSize; 194 | // 08 195 | int deltaFrames; 196 | // 0c? 197 | int flags; 198 | // 10? 199 | int noteLength; 200 | // 14? 201 | int noteOffset; 202 | // 18 203 | char midiData[4]; 204 | // 1c? 205 | char detune; 206 | // 1d? 207 | char noteOffVelocity; 208 | // 1e? 209 | char reserved1; 210 | // 1f? 211 | char reserved2; 212 | }; 213 | 214 | class VstMidiSysexEvent { 215 | public: 216 | // 00 217 | int type; 218 | // 04 219 | int byteSize; 220 | // 08 221 | int deltaFrames; 222 | // 0c 223 | int flags; 224 | 225 | int dumpBytes; 226 | 227 | int *unknownptr; 228 | 229 | char *sysexDump; 230 | 231 | int *unknownptr2; 232 | }; 233 | 234 | class VstEvent { 235 | public: 236 | // 00 237 | int type; 238 | // 04 239 | int byteSize; 240 | // 08 241 | int deltaFrames; 242 | // 0c 243 | int flags; 244 | // 10 245 | char empty5[16]; 246 | }; 247 | 248 | class VstEvents { 249 | public: 250 | // 00 251 | int numEvents; 252 | // 04 253 | void *reserved; 254 | // 08 255 | VstEvent *events[2]; 256 | }; 257 | 258 | class AEffect { 259 | public: 260 | // Never use virtual functions!!! 261 | // 00-03 262 | int magic; 263 | // dispatcher 04-07 264 | intptr_t VESTIGECALLBACK (*dispatcher)(AEffect *, int, int, intptr_t, void *, 265 | float); 266 | // process, quite sure 08-0b 267 | void VESTIGECALLBACK (*process)(AEffect *, float **, float **, int); 268 | // setParameter 0c-0f 269 | void VESTIGECALLBACK (*setParameter)(AEffect *, int, float); 270 | // getParameter 10-13 271 | float VESTIGECALLBACK (*getParameter)(AEffect *, int); 272 | // programs 14-17 273 | int numPrograms; 274 | // Params 18-1b 275 | int numParams; 276 | // Input 1c-1f 277 | int numInputs; 278 | // Output 20-23 279 | int numOutputs; 280 | // flags 24-27 281 | int flags; 282 | // Fill somewhere 28-2b 283 | void *resvd1; 284 | void *resvd2; 285 | int initialDelay; 286 | // Zeroes 34-37 38-3b 287 | int empty3a; 288 | int empty3b; 289 | // 1.0f 3c-3f 290 | float unkown_float; 291 | // An object? pointer 40-43 292 | void *object; 293 | // Zeroes 44-47 294 | void *user; 295 | // Id 48-4b 296 | int32_t uniqueID; 297 | int32_t version; 298 | // processReplacing 50-53 299 | void VESTIGECALLBACK (*processReplacing)(AEffect *, float **, float **, int); 300 | void VESTIGECALLBACK (*processDoubleReplacing)(AEffect *, double **, 301 | double **, int); 302 | char empty6[56]; 303 | }; 304 | 305 | class VstTimeInfo { 306 | public: 307 | // 00 308 | double samplePos; 309 | // 08 310 | double sampleRate; 311 | // 10 312 | double nanoSeconds; 313 | // 18 314 | double ppqPos; 315 | // 20? 316 | double tempo; 317 | // 28 318 | double barStartPos; 319 | // 30? 320 | double cycleStartPos; 321 | // 38? 322 | double cycleEndPos; 323 | // 40? 324 | int timeSigNumerator; 325 | // 44? 326 | int timeSigDenominator; 327 | // unconfirmed 48 4c 50 328 | char empty3[4 + 4 + 4]; 329 | // 54 330 | int flags; 331 | }; 332 | 333 | typedef intptr_t VESTIGECALLBACK (*audioMasterCallback)(AEffect *, int32_t, 334 | int32_t, intptr_t, 335 | void *, float); 336 | 337 | class ERect { 338 | public: 339 | short top; 340 | short left; 341 | short bottom; 342 | short right; 343 | }; 344 | 345 | #ifdef MIDIEFF 346 | class VstSpeakerArrangement { 347 | public: 348 | int val; 349 | int val2; 350 | char data[8][112]; 351 | }; 352 | #endif 353 | 354 | #endif 355 | -------------------------------------------------------------------------------- /TestVst3/testvst3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #ifdef __WINE__ 8 | #else 9 | #define __cdecl 10 | #endif 11 | 12 | #define WIN32_LEAN_AND_MEAN 13 | 14 | #include 15 | #include 16 | 17 | #ifdef VESTIGE 18 | typedef int16_t VstInt16; 19 | typedef int32_t VstInt32; 20 | typedef int64_t VstInt64; 21 | typedef intptr_t VstIntPtr; 22 | #define VESTIGECALLBACK __cdecl 23 | #include "vestige.h" 24 | #else 25 | #include "pluginterfaces/vst2.x/aeffectx.h" 26 | #endif 27 | 28 | #ifdef VESTIGE 29 | typedef AEffect *(VESTIGECALLBACK *VstEntry)(audioMasterCallback audioMaster); 30 | #else 31 | typedef AEffect *(VSTCALLBACK *VstEntry)(audioMasterCallback audioMaster); 32 | #endif 33 | 34 | #include "public.sdk/source/vst/hosting/module.h" 35 | 36 | #include "basewrapper.h" 37 | 38 | #include "vst2wrapper.h" 39 | 40 | extern "C" 41 | { 42 | typedef bool (PLUGIN_API *InitModuleProc) (); 43 | typedef bool (PLUGIN_API *ExitModuleProc) (); 44 | } 45 | static const Steinberg::FIDString kInitModuleProcName = "InitDll"; 46 | static const Steinberg::FIDString kExitModuleProcName = "ExitDll"; 47 | 48 | #define APPLICATION_CLASS_NAME "dssi_vst" 49 | 50 | #define OLD_PLUGIN_ENTRY_POINT "main" 51 | #define NEW_PLUGIN_ENTRY_POINT "VSTPluginMain" 52 | 53 | using namespace std; 54 | 55 | VstIntPtr VESTIGECALLBACK hostCallback(AEffect *plugin, VstInt32 opcode, VstInt32 index, VstIntPtr value, void *ptr, float opt) 56 | { 57 | VstIntPtr rv = 0; 58 | 59 | switch (opcode) 60 | { 61 | case audioMasterVersion: 62 | rv = 2400; 63 | break; 64 | 65 | default: 66 | break; 67 | } 68 | 69 | return rv; 70 | } 71 | 72 | #define mchr(a,b,c,d) ( ((a)<<24) | ((b)<<16) | ((c)<<8) | (d) ) 73 | 74 | Steinberg::Vst::Vst2Wrapper *createEffectInstance2(audioMasterCallback audioMaster, HMODULE libHandle, Steinberg::IPluginFactory* factory, int *vstuid) 75 | { 76 | bool test; 77 | Steinberg::FIDString cid; 78 | 79 | int audioclassfirst = 0; 80 | int audioclass = 0; 81 | int firstdone = 0; 82 | 83 | auto proc = (GetFactoryProc)::GetProcAddress ((HMODULE)libHandle, "GetPluginFactory"); 84 | 85 | if(!proc) 86 | return nullptr; 87 | 88 | factory = proc(); 89 | 90 | if(!factory) 91 | return nullptr; 92 | 93 | Steinberg::PFactoryInfo factoryInfo; 94 | 95 | factory->getFactoryInfo (&factoryInfo); 96 | 97 | // cout << " Factory Info:\n\tvendor = " << factoryInfo.vendor << "\n\turl = " << factoryInfo.url << "\n\temail = " << factoryInfo.email << "\n\n" << endl; 98 | 99 | int countclasses = factory->countClasses (); 100 | 101 | if(countclasses == 0) 102 | return nullptr; 103 | 104 | int idval = 0; 105 | 106 | for (Steinberg::int32 i = 0; i < countclasses; i++) 107 | { 108 | Steinberg::PClassInfo classInfo; 109 | 110 | factory->getClassInfo (i, &classInfo); 111 | 112 | if (strcmp(classInfo.category, "Audio Module Class") == 0) 113 | { 114 | if(audioclassfirst == 0 && firstdone == 0) 115 | { 116 | audioclassfirst = i; 117 | firstdone = 1; 118 | } 119 | 120 | } // Audio Module Class 121 | } // for 122 | 123 | audioclass = audioclassfirst; 124 | 125 | Steinberg::PClassInfo classInfo2; 126 | 127 | factory->getClassInfo (audioclass, &classInfo2); 128 | cid = classInfo2.cid; 129 | 130 | Steinberg::FIDString iid = Steinberg::Vst::IComponent::iid; 131 | 132 | Steinberg::char8 cidString[50]; 133 | Steinberg::FUID (classInfo2.cid).toRegistryString (cidString); 134 | Steinberg::String cidStr (cidString); 135 | // cout << " Class Info " << audioclass << ":\n\tname = " << classInfo2.name << "\n\tcategory = " << classInfo2.category << "\n\tcid = " << cidStr.text8 () << "\n\n" << endl; 136 | 137 | idval = mchr(cidStr[1], cidStr[10], cidStr[15], cidStr[20]); 138 | 139 | int idval1 = cidStr[1] + cidStr[2] + cidStr[3] + cidStr[4]; 140 | int idval2 = cidStr[5] + cidStr[6] + cidStr[7]+ cidStr[8]; 141 | int idval3 = cidStr[10] + cidStr[11] + cidStr[12] + cidStr[13]; 142 | int idval4 = cidStr[15] + cidStr[16] + cidStr[17] + cidStr[18]; 143 | int idval5 = cidStr[20] + cidStr[21] + cidStr[22] + cidStr[23]; 144 | int idval6 = cidStr[25] + cidStr[26] + cidStr[27] + cidStr[28]; 145 | int idval7 = cidStr[29] + cidStr[30] + cidStr[31] + cidStr[32]; 146 | int idval8 = cidStr[33] + cidStr[34] + cidStr[35] + cidStr[36]; 147 | 148 | int idvalout = 0; 149 | 150 | idvalout += idval1; 151 | idvalout += idval2 << 1; 152 | idvalout += idval3 << 2; 153 | idvalout += idval4 << 3; 154 | idvalout += idval5 << 4; 155 | idvalout += idval6 << 5; 156 | idvalout += idval7 << 6; 157 | idvalout += idval8 << 7; 158 | 159 | idval += idvalout; 160 | 161 | *vstuid = idval; 162 | 163 | return Steinberg::Vst::Vst2Wrapper::create(factory, cid, idval, audioMaster); 164 | } 165 | 166 | std::string getMaker(Steinberg::Vst::Vst2Wrapper *vst2wrap) 167 | { 168 | char buffer[512]; 169 | memset(buffer, 0, sizeof(buffer)); 170 | vst2wrap->getVendorString (buffer); 171 | if (buffer[0]) 172 | return buffer; 173 | } 174 | 175 | int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdline, int cmdshow) 176 | { 177 | LPWSTR *args; 178 | int numargs; 179 | 180 | Steinberg::Vst::Vst2Wrapper *vst2wrap; 181 | int vst2uid; 182 | Steinberg::IPluginFactory* factory; 183 | 184 | cout << "LinVst3 Vst3 Test: " << cmdline << endl; 185 | 186 | args = CommandLineToArgvW(GetCommandLineW(), &numargs); 187 | 188 | if(args == NULL) 189 | { 190 | printf("CommandLine arguments failed\n"); 191 | return 0; 192 | } 193 | 194 | if(args[1] == NULL) 195 | { 196 | printf("Usage: vstest.exe path_to_vst_dll\n"); 197 | return 0; 198 | } 199 | 200 | HINSTANCE libHandle = 0; 201 | libHandle = LoadLibraryW(args[1]); 202 | if (!libHandle) 203 | { 204 | printf("LibraryLoadError\n"); 205 | return 0; 206 | } 207 | 208 | LocalFree(args); 209 | 210 | InitModuleProc initProc = (InitModuleProc)::GetProcAddress ((HMODULE)libHandle, kInitModuleProcName); 211 | if (initProc) 212 | { 213 | if (initProc () == false) 214 | { 215 | cerr << "InitProcError" << endl; 216 | 217 | if(libHandle) 218 | { 219 | ExitModuleProc exitProc = (ExitModuleProc)::GetProcAddress ((HMODULE)libHandle, kExitModuleProcName); 220 | if (exitProc) 221 | exitProc (); 222 | FreeLibrary(libHandle); 223 | } 224 | return 0; 225 | } 226 | } 227 | 228 | audioMasterCallback hostCallbackFuncPtr = hostCallback; 229 | 230 | vst2wrap = createEffectInstance2 (hostCallbackFuncPtr, libHandle, factory, &vst2uid); 231 | 232 | if (!vst2wrap) 233 | { 234 | printf("InstnceError\n"); 235 | 236 | if(libHandle) 237 | { 238 | ExitModuleProc exitProc = (ExitModuleProc)::GetProcAddress ((HMODULE)libHandle, kExitModuleProcName); 239 | if (exitProc) 240 | exitProc (); 241 | FreeLibrary(libHandle); 242 | } 243 | return 0; 244 | } 245 | 246 | if(vst2wrap->editor) 247 | { 248 | printf("HasEditor\n"); 249 | } 250 | else 251 | { 252 | printf("NoEditor\n"); 253 | 254 | printf("NumInputs %d\n", vst2wrap->numinputs); 255 | printf("NumOutputs %d\n", vst2wrap->numoutputs); 256 | 257 | cout << "Maker " << getMaker(vst2wrap) << endl; 258 | 259 | vst2wrap->suspend (); 260 | 261 | if(vst2wrap) 262 | delete vst2wrap; 263 | 264 | if (factory) 265 | factory->release (); 266 | 267 | if(libHandle) 268 | { 269 | ExitModuleProc exitProc = (ExitModuleProc)::GetProcAddress ((HMODULE)libHandle, kExitModuleProcName); 270 | if (exitProc) 271 | exitProc (); 272 | FreeLibrary(libHandle); 273 | } 274 | return 0; 275 | 276 | } 277 | 278 | printf("NumInputs %d\n", vst2wrap->numinputs); 279 | printf("NumOutputs %d\n", vst2wrap->numoutputs); 280 | 281 | cout << "Maker " << getMaker(vst2wrap) << endl; 282 | 283 | WNDCLASSEX wclass; 284 | 285 | memset(&wclass, 0, sizeof(WNDCLASSEX)); 286 | wclass.cbSize = sizeof(WNDCLASSEX); 287 | wclass.style = 0; 288 | // CS_HREDRAW | CS_VREDRAW; 289 | wclass.lpfnWndProc = DefWindowProc; 290 | wclass.cbClsExtra = 0; 291 | wclass.cbWndExtra = 0; 292 | wclass.hInstance = GetModuleHandle(0); 293 | wclass.hIcon = LoadIcon(GetModuleHandle(0), APPLICATION_CLASS_NAME); 294 | wclass.hCursor = LoadCursor(0, IDI_APPLICATION); 295 | // wclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); 296 | wclass.lpszMenuName = "MENU_DSSI_VST"; 297 | wclass.lpszClassName = APPLICATION_CLASS_NAME; 298 | wclass.hIconSm = 0; 299 | 300 | if (!RegisterClassEx(&wclass)) 301 | { 302 | vst2wrap->suspend (); 303 | 304 | if(vst2wrap) 305 | delete vst2wrap; 306 | 307 | if (factory) 308 | factory->release (); 309 | 310 | if(libHandle) 311 | { 312 | ExitModuleProc exitProc = (ExitModuleProc)::GetProcAddress ((HMODULE)libHandle, kExitModuleProcName); 313 | if (exitProc) 314 | exitProc (); 315 | FreeLibrary(libHandle); 316 | } 317 | return 0; 318 | } 319 | 320 | HWND hWnd = CreateWindow(APPLICATION_CLASS_NAME, "LinVst", WS_OVERLAPPEDWINDOW & ~WS_THICKFRAME & ~WS_MAXIMIZEBOX, 321 | CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, GetModuleHandle(0), 0); 322 | 323 | if (!hWnd) 324 | { 325 | UnregisterClassA(APPLICATION_CLASS_NAME, GetModuleHandle(0)); 326 | 327 | vst2wrap->suspend (); 328 | 329 | if(vst2wrap) 330 | delete vst2wrap; 331 | 332 | if (factory) 333 | factory->release (); 334 | 335 | if(libHandle) 336 | { 337 | ExitModuleProc exitProc = (ExitModuleProc)::GetProcAddress ((HMODULE)libHandle, kExitModuleProcName); 338 | if (exitProc) 339 | exitProc (); 340 | FreeLibrary(libHandle); 341 | } 342 | return 0; 343 | } 344 | 345 | ERect *rect = 0; 346 | vst2wrap->editor->getRect (&rect); 347 | vst2wrap->editor->open (hWnd); 348 | vst2wrap->editor->getRect (&rect); 349 | if (!rect) 350 | { 351 | DestroyWindow(hWnd); 352 | UnregisterClassA(APPLICATION_CLASS_NAME, GetModuleHandle(0)); 353 | vst2wrap->suspend (); 354 | 355 | if(vst2wrap) 356 | delete vst2wrap; 357 | 358 | if (factory) 359 | factory->release (); 360 | if(libHandle) 361 | { 362 | ExitModuleProc exitProc = (ExitModuleProc)::GetProcAddress ((HMODULE)libHandle, kExitModuleProcName); 363 | if (exitProc) 364 | exitProc (); 365 | FreeLibrary(libHandle); 366 | } 367 | return 0; 368 | } 369 | 370 | SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, rect->right - rect->left + 6, rect->bottom - rect->top + 25, SWP_NOMOVE); 371 | 372 | ShowWindow(hWnd, SW_SHOWNORMAL); 373 | UpdateWindow(hWnd); 374 | 375 | UINT_PTR timerval; 376 | 377 | timerval = 678; 378 | timerval = SetTimer(hWnd, timerval, 80, 0); 379 | 380 | int count = 0; 381 | 382 | MSG msg; 383 | while (GetMessage(&msg, NULL, 0, 0)) 384 | { 385 | TranslateMessage(&msg); 386 | DispatchMessage(&msg); 387 | 388 | if((msg.message == WM_TIMER) && (msg.wParam == 678)) 389 | { 390 | count += 1; 391 | 392 | if(count == 100) 393 | break; 394 | } 395 | } 396 | 397 | vst2wrap->editor->close (); 398 | 399 | KillTimer(hWnd, timerval); 400 | 401 | DestroyWindow(hWnd); 402 | 403 | UnregisterClassA(APPLICATION_CLASS_NAME, GetModuleHandle(0)); 404 | 405 | vst2wrap->suspend (); 406 | 407 | if(vst2wrap) 408 | delete vst2wrap; 409 | 410 | if (factory) 411 | factory->release (); 412 | 413 | if(libHandle) 414 | { 415 | ExitModuleProc exitProc = (ExitModuleProc)::GetProcAddress ((HMODULE)libHandle, kExitModuleProcName); 416 | if (exitProc) 417 | exitProc (); 418 | FreeLibrary(libHandle); 419 | } 420 | 421 | return 0; 422 | } 423 | 424 | -------------------------------------------------------------------------------- /basewrapper.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------ 2 | // Project : VST SDK 3 | // 4 | // Category : Helpers 5 | // Filename : public.sdk/source/vst/basewrapper/basewrapper.h 6 | // Created by : Steinberg, 01/2018 7 | // Description : Base Wrapper 8 | // 9 | //----------------------------------------------------------------------------- 10 | // LICENSE 11 | // (c) 2018, Steinberg Media Technologies GmbH, All Rights Reserved 12 | //----------------------------------------------------------------------------- 13 | // Redistribution and use in source and binary forms, with or without 14 | // modification, are permitted provided that the following conditions are met: 15 | // 16 | // * Redistributions of source code must retain the above copyright notice, 17 | // this list of conditions and the following disclaimer. 18 | // * Redistributions in binary form must reproduce the above copyright notice, 19 | // this list of conditions and the following disclaimer in the documentation 20 | // and/or other materials provided with the distribution. 21 | // * Neither the name of the Steinberg Media Technologies nor the names of its 22 | // contributors may be used to endorse or promote products derived from this 23 | // software without specific prior written permission. 24 | // 25 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | // POSSIBILITY OF SUCH DAMAGE. 36 | //----------------------------------------------------------------------------- 37 | 38 | #pragma once 39 | 40 | /// \cond ignore 41 | 42 | #include "pluginterfaces/base/ftypes.h" 43 | #include "pluginterfaces/gui/iplugview.h" 44 | #include "pluginterfaces/vst/ivstaudioprocessor.h" 45 | #include "pluginterfaces/vst/ivsteditcontroller.h" 46 | #include "pluginterfaces/vst/ivsthostapplication.h" 47 | #include "pluginterfaces/vst/ivstprocesscontext.h" 48 | #include "pluginterfaces/vst/ivstunits.h" 49 | 50 | #include "public.sdk/source/common/memorystream.h" 51 | #include "public.sdk/source/vst/hosting/eventlist.h" 52 | #include "public.sdk/source/vst/hosting/parameterchanges.h" 53 | #include "public.sdk/source/vst/hosting/pluginterfacesupport.h" 54 | #include "public.sdk/source/vst/hosting/processdata.h" 55 | 56 | #include "base/source/fstring.h" 57 | #include "base/source/timer.h" 58 | 59 | #include 60 | #include 61 | 62 | //------------------------------------------------------------------------ 63 | namespace Steinberg { 64 | namespace Vst { 65 | 66 | //------------------------------------------------------------------------ 67 | class BaseEditorWrapper : public IPlugFrame, public FObject { 68 | public: 69 | //------------------------------------------------------------------------ 70 | BaseEditorWrapper(IEditController *controller); 71 | ~BaseEditorWrapper(); 72 | 73 | static bool hasEditor(IEditController *controller); 74 | 75 | bool getRect(ViewRect &rect); 76 | virtual bool _open(void *ptr); 77 | virtual void _close(); 78 | 79 | bool _setKnobMode(Vst::KnobMode val); 80 | 81 | // IPlugFrame 82 | tresult PLUGIN_API resizeView(IPlugView *view, 83 | ViewRect *newSize) SMTG_OVERRIDE; 84 | 85 | // FUnknown 86 | tresult PLUGIN_API queryInterface(const char *_iid, void **obj) SMTG_OVERRIDE; 87 | REFCOUNT_METHODS(FObject); 88 | //------------------------------------------------------------------------ 89 | protected: 90 | void createView(); 91 | 92 | IPtr mController; 93 | IPtr mView; 94 | 95 | ViewRect mViewRect; 96 | }; 97 | 98 | //------------------------------------------------------------------------ 99 | const int32 kMaxEvents = 2048; 100 | 101 | //------------------------------------------------------------------------------------------------------- 102 | class BaseWrapper : public IHostApplication, 103 | public IComponentHandler, 104 | public IUnitHandler, 105 | public ITimerCallback, 106 | public FObject { 107 | public: 108 | struct SVST3Config { 109 | IPluginFactory *factory = nullptr; 110 | IAudioProcessor *processor = nullptr; 111 | IEditController *controller = nullptr; 112 | FUID vst3ComponentID; 113 | IComponent *component = nullptr; 114 | }; 115 | 116 | BaseWrapper(SVST3Config &config); 117 | virtual ~BaseWrapper(); 118 | 119 | virtual bool init(); 120 | 121 | virtual void _canDoubleReplacing(bool val) {} 122 | virtual void _setInitialDelay(int32 delay) {} 123 | virtual void _noTail(bool val) {} 124 | 125 | virtual void _ioChanged() {} 126 | virtual void _updateDisplay() {} 127 | virtual void _setNumInputs(int32 inputs) { mNumInputs = inputs; } 128 | virtual void _setNumOutputs(int32 outputs) { mNumOutputs = outputs; } 129 | virtual bool _sizeWindow(int32 width, int32 height) = 0; 130 | virtual int32 _getChunk(void **data, bool isPreset); 131 | virtual int32 _setChunk(void *data, int32 byteSize, bool isPreset); 132 | 133 | virtual bool getEditorSize(int32 &width, int32 &height) const; 134 | 135 | bool isActive() const { return mActive; } 136 | int32 getNumInputs() const { return mNumInputs; } 137 | int32 getNumOutputs() const { return mNumOutputs; } 138 | 139 | BaseEditorWrapper *getEditor() const { return mEditor; } 140 | 141 | //--- --------------------------------------------------------------------- 142 | // VST 3 Interfaces ------------------------------------------------------ 143 | // FUnknown 144 | tresult PLUGIN_API queryInterface(const char *iid, void **obj) SMTG_OVERRIDE; 145 | REFCOUNT_METHODS(FObject); 146 | 147 | // IHostApplication 148 | tresult PLUGIN_API createInstance(TUID cid, TUID iid, 149 | void **obj) SMTG_OVERRIDE; 150 | 151 | // IComponentHandler 152 | tresult PLUGIN_API restartComponent(int32 flags) SMTG_OVERRIDE; 153 | 154 | // IUnitHandler 155 | tresult PLUGIN_API notifyUnitSelection(UnitID unitId) SMTG_OVERRIDE; 156 | tresult PLUGIN_API notifyProgramListChange(ProgramListID listId, 157 | int32 programIndex) SMTG_OVERRIDE; 158 | 159 | // ITimer 160 | void onTimer(Timer *timer) SMTG_OVERRIDE; 161 | 162 | //------------------------------------------------------------------------------------------------------- 163 | protected: 164 | virtual void setupParameters(); 165 | virtual void setupProcessTimeInfo() = 0; 166 | virtual void processOutputEvents() {} 167 | virtual void processOutputParametersChanges() {} 168 | 169 | void _setSampleRate(float newSamplerate); 170 | bool setupProcessing(int32 processModeOverwrite = -1); 171 | void _processReplacing(float **inputs, float **outputs, int32 sampleFrames); 172 | void _processDoubleReplacing(double **inputs, double **outputs, 173 | int32 sampleFrames); 174 | 175 | template void setProcessingBuffers(T **inputs, T **outputs); 176 | void doProcess(int32 sampleFrames); 177 | 178 | void processMidiEvent(Event &toAdd, char *midiData, bool isLive = false, 179 | int32 noteLength = 0, float noteOffVelocity = 1.f, 180 | float detune = 0.f); 181 | 182 | void setEventPPQPositions(); 183 | 184 | void _setEditor(BaseEditorWrapper *editor); 185 | 186 | bool _setBlockSize(int32 newBlockSize); 187 | float _getParameter(int32 index) const; 188 | 189 | void _suspend(); 190 | void _resume(); 191 | void _startProcess(); 192 | void _stopProcess(); 193 | bool _setBypass(bool onOff); 194 | 195 | virtual void setupBuses(); 196 | void initMidiCtrlerAssignment(); 197 | void getUnitPath(UnitID unitID, String &path) const; 198 | 199 | int32 countMainBusChannels(BusDirection dir, uint64 &mainBusBitset); 200 | 201 | /** Returns the last param change from guiTransfer queue. */ 202 | bool getLastParamChange(ParamID id, ParamValue &value); 203 | 204 | void addParameterChange(ParamID id, ParamValue value, int32 sampleOffset); 205 | 206 | void setVendorName(char *name); 207 | void setEffectName(char *name); 208 | void setEffectVersion(char *version); 209 | void setSubCategories(char *string); 210 | 211 | bool getProgramListAndUnit(int32 midiChannel, UnitID &unitId, 212 | ProgramListID &programListId); 213 | bool getProgramListInfoByProgramListID(ProgramListID programListId, 214 | ProgramListInfo &info); 215 | 216 | static const int32 kMaxProgramChangeParameters = 16; 217 | ParamID 218 | mProgramChangeParameterIDs[kMaxProgramChangeParameters]; // for each MIDI 219 | // channel 220 | int32 221 | mProgramChangeParameterIdxs[kMaxProgramChangeParameters]; // for each MIDI 222 | // channel 223 | 224 | FUID mVst3EffectClassID; 225 | 226 | // vst3 data 227 | IPtr mProcessor; 228 | IPtr mComponent; 229 | IPtr mController; 230 | IPtr mUnitInfo; 231 | IPtr mMidiMapping; 232 | 233 | IPtr mEditor; 234 | 235 | IPtr mPlugInterfaceSupport; 236 | 237 | int32 mVst3SampleSize = kSample32; 238 | int32 mVst3processMode = kRealtime; 239 | 240 | char mName[PClassInfo::kNameSize]; 241 | char mVendor[PFactoryInfo::kNameSize]; 242 | char mSubCategories[PClassInfo2::kSubCategoriesSize]; 243 | int32 mVersion = 0; 244 | 245 | struct ParamMapEntry { 246 | ParamID vst3ID; 247 | int32 vst3Index; 248 | }; 249 | 250 | std::vector mParameterMap; 251 | std::map mParamIndexMap; 252 | ParamID mBypassParameterID = kNoParamId; 253 | ParamID mProgramParameterID = kNoParamId; 254 | int32 mProgramParameterIdx = -1; 255 | 256 | HostProcessData mProcessData; 257 | ProcessContext mProcessContext; 258 | ParameterChanges mInputChanges; 259 | ParameterChanges mOutputChanges; 260 | IPtr mInputEvents; 261 | IPtr mOutputEvents; 262 | 263 | uint64 mMainAudioInputBuses = 0; 264 | uint64 mMainAudioOutputBuses = 0; 265 | 266 | ParameterChangeTransfer mInputTransfer; 267 | ParameterChangeTransfer mOutputTransfer; 268 | ParameterChangeTransfer mGuiTransfer; 269 | 270 | MemoryStream mChunk; 271 | 272 | IPtr mTimer; 273 | IPtr mFactory; 274 | 275 | int32 mNumPrograms{0}; 276 | float mSampleRate{44100}; 277 | int32 mBlockSize{256}; 278 | int32 mNumParams{0}; 279 | int32 mCurProgram{-1}; 280 | int32 mNumInputs{0}; 281 | int32 mNumOutputs{0}; 282 | 283 | enum { kMaxMidiMappingBusses = 4 }; 284 | int32 *mMidiCCMapping[kMaxMidiMappingBusses][16]; 285 | 286 | bool mComponentInitialized = false; 287 | bool mControllerInitialized = false; 288 | bool mComponentsConnected = false; 289 | bool mUseExportedBypass = true; 290 | 291 | bool mActive = false; 292 | bool mProcessing = false; 293 | bool mHasEventInputBuses = false; 294 | bool mHasEventOutputBuses = false; 295 | 296 | bool mUseIncIndex = true; 297 | }; 298 | 299 | const uint8 kNoteOff = 0x80; ///< note, off velocity 300 | const uint8 kNoteOn = 0x90; ///< note, on velocity 301 | const uint8 kPolyPressure = 0xA0; ///< note, pressure 302 | const uint8 kController = 0xB0; ///< controller, value 303 | const uint8 kProgramChangeStatus = 0xC0; ///< program change 304 | const uint8 kAfterTouchStatus = 0xD0; ///< channel pressure 305 | const uint8 kPitchBendStatus = 0xE0; ///< lsb, msb 306 | 307 | const float kMidiScaler = 1.f / 127.f; 308 | static const uint8 kChannelMask = 0x0F; 309 | static const uint8 kStatusMask = 0xF0; 310 | static const uint32 kDataMask = 0x7F; 311 | //------------------------------------------------------------------------ 312 | } // namespace Vst 313 | } // namespace Steinberg 314 | 315 | /// \endcond 316 | -------------------------------------------------------------------------------- /TestVst3/basewrapper.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------ 2 | // Project : VST SDK 3 | // 4 | // Category : Helpers 5 | // Filename : public.sdk/source/vst/basewrapper/basewrapper.h 6 | // Created by : Steinberg, 01/2018 7 | // Description : Base Wrapper 8 | // 9 | //----------------------------------------------------------------------------- 10 | // LICENSE 11 | // (c) 2018, Steinberg Media Technologies GmbH, All Rights Reserved 12 | //----------------------------------------------------------------------------- 13 | // Redistribution and use in source and binary forms, with or without 14 | // modification, are permitted provided that the following conditions are met: 15 | // 16 | // * Redistributions of source code must retain the above copyright notice, 17 | // this list of conditions and the following disclaimer. 18 | // * Redistributions in binary form must reproduce the above copyright notice, 19 | // this list of conditions and the following disclaimer in the documentation 20 | // and/or other materials provided with the distribution. 21 | // * Neither the name of the Steinberg Media Technologies nor the names of its 22 | // contributors may be used to endorse or promote products derived from this 23 | // software without specific prior written permission. 24 | // 25 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | // POSSIBILITY OF SUCH DAMAGE. 36 | //----------------------------------------------------------------------------- 37 | 38 | #pragma once 39 | 40 | /// \cond ignore 41 | 42 | #include "pluginterfaces/base/ftypes.h" 43 | #include "pluginterfaces/gui/iplugview.h" 44 | #include "pluginterfaces/vst/ivstaudioprocessor.h" 45 | #include "pluginterfaces/vst/ivsteditcontroller.h" 46 | #include "pluginterfaces/vst/ivsthostapplication.h" 47 | #include "pluginterfaces/vst/ivstprocesscontext.h" 48 | #include "pluginterfaces/vst/ivstunits.h" 49 | 50 | #include "public.sdk/source/common/memorystream.h" 51 | #include "public.sdk/source/vst/hosting/eventlist.h" 52 | #include "public.sdk/source/vst/hosting/parameterchanges.h" 53 | #include "public.sdk/source/vst/hosting/pluginterfacesupport.h" 54 | #include "public.sdk/source/vst/hosting/processdata.h" 55 | 56 | #include "base/source/fstring.h" 57 | #include "base/source/timer.h" 58 | 59 | #include 60 | #include 61 | 62 | //------------------------------------------------------------------------ 63 | namespace Steinberg { 64 | namespace Vst { 65 | 66 | //------------------------------------------------------------------------ 67 | class BaseEditorWrapper : public IPlugFrame, public FObject { 68 | public: 69 | //------------------------------------------------------------------------ 70 | BaseEditorWrapper(IEditController *controller); 71 | ~BaseEditorWrapper(); 72 | 73 | static bool hasEditor(IEditController *controller); 74 | 75 | bool getRect(ViewRect &rect); 76 | virtual bool _open(void *ptr); 77 | virtual void _close(); 78 | 79 | bool _setKnobMode(Vst::KnobMode val); 80 | 81 | // IPlugFrame 82 | tresult PLUGIN_API resizeView(IPlugView *view, 83 | ViewRect *newSize) SMTG_OVERRIDE; 84 | 85 | // FUnknown 86 | tresult PLUGIN_API queryInterface(const char *_iid, void **obj) SMTG_OVERRIDE; 87 | REFCOUNT_METHODS(FObject); 88 | //------------------------------------------------------------------------ 89 | protected: 90 | void createView(); 91 | 92 | IPtr mController; 93 | IPtr mView; 94 | 95 | ViewRect mViewRect; 96 | }; 97 | 98 | //------------------------------------------------------------------------ 99 | const int32 kMaxEvents = 2048; 100 | 101 | //------------------------------------------------------------------------------------------------------- 102 | class BaseWrapper : public IHostApplication, 103 | public IComponentHandler, 104 | public IUnitHandler, 105 | public ITimerCallback, 106 | public FObject { 107 | public: 108 | struct SVST3Config { 109 | IPluginFactory *factory = nullptr; 110 | IAudioProcessor *processor = nullptr; 111 | IEditController *controller = nullptr; 112 | FUID vst3ComponentID; 113 | IComponent *component = nullptr; 114 | }; 115 | 116 | BaseWrapper(SVST3Config &config); 117 | virtual ~BaseWrapper(); 118 | 119 | virtual bool init(); 120 | 121 | virtual void _canDoubleReplacing(bool val) {} 122 | virtual void _setInitialDelay(int32 delay) {} 123 | virtual void _noTail(bool val) {} 124 | 125 | virtual void _ioChanged() {} 126 | virtual void _updateDisplay() {} 127 | virtual void _setNumInputs(int32 inputs) { mNumInputs = inputs; } 128 | virtual void _setNumOutputs(int32 outputs) { mNumOutputs = outputs; } 129 | virtual bool _sizeWindow(int32 width, int32 height) = 0; 130 | virtual int32 _getChunk(void **data, bool isPreset); 131 | virtual int32 _setChunk(void *data, int32 byteSize, bool isPreset); 132 | 133 | virtual bool getEditorSize(int32 &width, int32 &height) const; 134 | 135 | bool isActive() const { return mActive; } 136 | int32 getNumInputs() const { return mNumInputs; } 137 | int32 getNumOutputs() const { return mNumOutputs; } 138 | 139 | BaseEditorWrapper *getEditor() const { return mEditor; } 140 | 141 | //--- --------------------------------------------------------------------- 142 | // VST 3 Interfaces ------------------------------------------------------ 143 | // FUnknown 144 | tresult PLUGIN_API queryInterface(const char *iid, void **obj) SMTG_OVERRIDE; 145 | REFCOUNT_METHODS(FObject); 146 | 147 | // IHostApplication 148 | tresult PLUGIN_API createInstance(TUID cid, TUID iid, 149 | void **obj) SMTG_OVERRIDE; 150 | 151 | // IComponentHandler 152 | tresult PLUGIN_API restartComponent(int32 flags) SMTG_OVERRIDE; 153 | 154 | // IUnitHandler 155 | tresult PLUGIN_API notifyUnitSelection(UnitID unitId) SMTG_OVERRIDE; 156 | tresult PLUGIN_API notifyProgramListChange(ProgramListID listId, 157 | int32 programIndex) SMTG_OVERRIDE; 158 | 159 | // ITimer 160 | void onTimer(Timer *timer) SMTG_OVERRIDE; 161 | 162 | //------------------------------------------------------------------------------------------------------- 163 | protected: 164 | virtual void setupParameters(); 165 | virtual void setupProcessTimeInfo() = 0; 166 | virtual void processOutputEvents() {} 167 | virtual void processOutputParametersChanges() {} 168 | 169 | void _setSampleRate(float newSamplerate); 170 | bool setupProcessing(int32 processModeOverwrite = -1); 171 | void _processReplacing(float **inputs, float **outputs, int32 sampleFrames); 172 | void _processDoubleReplacing(double **inputs, double **outputs, 173 | int32 sampleFrames); 174 | 175 | template void setProcessingBuffers(T **inputs, T **outputs); 176 | void doProcess(int32 sampleFrames); 177 | 178 | void processMidiEvent(Event &toAdd, char *midiData, bool isLive = false, 179 | int32 noteLength = 0, float noteOffVelocity = 1.f, 180 | float detune = 0.f); 181 | 182 | void setEventPPQPositions(); 183 | 184 | void _setEditor(BaseEditorWrapper *editor); 185 | 186 | bool _setBlockSize(int32 newBlockSize); 187 | float _getParameter(int32 index) const; 188 | 189 | void _suspend(); 190 | void _resume(); 191 | void _startProcess(); 192 | void _stopProcess(); 193 | bool _setBypass(bool onOff); 194 | 195 | virtual void setupBuses(); 196 | void initMidiCtrlerAssignment(); 197 | void getUnitPath(UnitID unitID, String &path) const; 198 | 199 | int32 countMainBusChannels(BusDirection dir, uint64 &mainBusBitset); 200 | 201 | /** Returns the last param change from guiTransfer queue. */ 202 | bool getLastParamChange(ParamID id, ParamValue &value); 203 | 204 | void addParameterChange(ParamID id, ParamValue value, int32 sampleOffset); 205 | 206 | void setVendorName(char *name); 207 | void setEffectName(char *name); 208 | void setEffectVersion(char *version); 209 | void setSubCategories(char *string); 210 | 211 | bool getProgramListAndUnit(int32 midiChannel, UnitID &unitId, 212 | ProgramListID &programListId); 213 | bool getProgramListInfoByProgramListID(ProgramListID programListId, 214 | ProgramListInfo &info); 215 | 216 | static const int32 kMaxProgramChangeParameters = 16; 217 | ParamID 218 | mProgramChangeParameterIDs[kMaxProgramChangeParameters]; // for each MIDI 219 | // channel 220 | int32 221 | mProgramChangeParameterIdxs[kMaxProgramChangeParameters]; // for each MIDI 222 | // channel 223 | 224 | FUID mVst3EffectClassID; 225 | 226 | // vst3 data 227 | IPtr mProcessor; 228 | IPtr mComponent; 229 | IPtr mController; 230 | IPtr mUnitInfo; 231 | IPtr mMidiMapping; 232 | 233 | IPtr mEditor; 234 | 235 | IPtr mPlugInterfaceSupport; 236 | 237 | int32 mVst3SampleSize = kSample32; 238 | int32 mVst3processMode = kRealtime; 239 | 240 | char mName[PClassInfo::kNameSize]; 241 | char mVendor[PFactoryInfo::kNameSize]; 242 | char mSubCategories[PClassInfo2::kSubCategoriesSize]; 243 | int32 mVersion = 0; 244 | 245 | struct ParamMapEntry { 246 | ParamID vst3ID; 247 | int32 vst3Index; 248 | }; 249 | 250 | std::vector mParameterMap; 251 | std::map mParamIndexMap; 252 | ParamID mBypassParameterID = kNoParamId; 253 | ParamID mProgramParameterID = kNoParamId; 254 | int32 mProgramParameterIdx = -1; 255 | 256 | HostProcessData mProcessData; 257 | ProcessContext mProcessContext; 258 | ParameterChanges mInputChanges; 259 | ParameterChanges mOutputChanges; 260 | IPtr mInputEvents; 261 | IPtr mOutputEvents; 262 | 263 | uint64 mMainAudioInputBuses = 0; 264 | uint64 mMainAudioOutputBuses = 0; 265 | 266 | ParameterChangeTransfer mInputTransfer; 267 | ParameterChangeTransfer mOutputTransfer; 268 | ParameterChangeTransfer mGuiTransfer; 269 | 270 | MemoryStream mChunk; 271 | 272 | IPtr mTimer; 273 | IPtr mFactory; 274 | 275 | int32 mNumPrograms{0}; 276 | float mSampleRate{44100}; 277 | int32 mBlockSize{256}; 278 | int32 mNumParams{0}; 279 | int32 mCurProgram{-1}; 280 | int32 mNumInputs{0}; 281 | int32 mNumOutputs{0}; 282 | 283 | enum { kMaxMidiMappingBusses = 4 }; 284 | int32 *mMidiCCMapping[kMaxMidiMappingBusses][16]; 285 | 286 | bool mComponentInitialized = false; 287 | bool mControllerInitialized = false; 288 | bool mComponentsConnected = false; 289 | bool mUseExportedBypass = true; 290 | 291 | bool mActive = false; 292 | bool mProcessing = false; 293 | bool mHasEventInputBuses = false; 294 | bool mHasEventOutputBuses = false; 295 | 296 | bool mUseIncIndex = true; 297 | }; 298 | 299 | const uint8 kNoteOff = 0x80; ///< note, off velocity 300 | const uint8 kNoteOn = 0x90; ///< note, on velocity 301 | const uint8 kPolyPressure = 0xA0; ///< note, pressure 302 | const uint8 kController = 0xB0; ///< controller, value 303 | const uint8 kProgramChangeStatus = 0xC0; ///< program change 304 | const uint8 kAfterTouchStatus = 0xD0; ///< channel pressure 305 | const uint8 kPitchBendStatus = 0xE0; ///< lsb, msb 306 | 307 | const float kMidiScaler = 1.f / 127.f; 308 | static const uint8 kChannelMask = 0x0F; 309 | static const uint8 kStatusMask = 0xF0; 310 | static const uint32 kDataMask = 0x7F; 311 | //------------------------------------------------------------------------ 312 | } // namespace Vst 313 | } // namespace Steinberg 314 | 315 | /// \endcond 316 | -------------------------------------------------------------------------------- /linvst.cpp: -------------------------------------------------------------------------------- 1 | /* linvst is based on wacvst Copyright 2009 retroware. All rights reserved. and 2 | dssi-vst Copyright 2004-2007 Chris Cannam 3 | 4 | linvst Mark White 2017 5 | 6 | This file is part of linvst. 7 | 8 | linvst is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . * 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include "remotevstclient.h" 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | #include 34 | 35 | extern "C" { 36 | 37 | #define VST_EXPORT __attribute__((visibility("default"))) 38 | 39 | extern VST_EXPORT AEffect *VSTPluginMain(audioMasterCallback audioMaster); 40 | 41 | AEffect *main_plugin(audioMasterCallback audioMaster) asm("main"); 42 | 43 | #define main main_plugin 44 | 45 | VST_EXPORT AEffect *main(audioMasterCallback audioMaster) { 46 | return VSTPluginMain(audioMaster); 47 | } 48 | } 49 | 50 | VstIntPtr dispatcher(AEffect *effect, VstInt32 opcode, VstInt32 index, 51 | VstIntPtr value, void *ptr, float opt) { 52 | RemotePluginClient *plugin = (RemotePluginClient *)effect->object; 53 | VstIntPtr v = 0; 54 | 55 | #ifdef EMBED 56 | #ifdef TRACKTIONWM 57 | char dawbuf[512]; 58 | #endif 59 | #endif 60 | 61 | #ifdef VESTIGE 62 | struct vinfo2 { 63 | char a[64]; 64 | int32_t b; 65 | }; 66 | #endif 67 | 68 | if (!effect) 69 | return 0; 70 | 71 | if (!plugin) 72 | return 0; 73 | 74 | if (plugin->m_inexcept == 1) { 75 | return 0; 76 | } 77 | 78 | if (plugin->m_threadbreak == 1) { 79 | return 0; 80 | } 81 | 82 | switch (opcode) { 83 | case effEditGetRect: 84 | if (plugin->editopen == 1) 85 | { 86 | *((struct ERect **)ptr) = plugin->rp; 87 | v = 1; 88 | } 89 | else 90 | v = 0; 91 | break; 92 | 93 | case effEditIdle: 94 | sched_yield(); 95 | break; 96 | 97 | case effStartProcess: 98 | plugin->effVoidOp(effStartProcess); 99 | break; 100 | 101 | case effStopProcess: 102 | plugin->effVoidOp(effStopProcess); 103 | break; 104 | 105 | case effMainsChanged: 106 | v = plugin->getEffInt(effMainsChanged, value); 107 | break; 108 | 109 | case effGetVendorString: 110 | // strncpy((char *) ptr, plugin->getMaker().c_str(), 111 | // kVstMaxVendorStrLen); 112 | strcpy((char *)ptr, plugin->getMaker().c_str()); 113 | v = 1; 114 | break; 115 | 116 | case effGetEffectName: 117 | // strncpy((char *) ptr, plugin->getName().c_str(), 118 | // kVstMaxEffectNameLen); 119 | strcpy((char *)ptr, plugin->getName().c_str()); 120 | v = 1; 121 | break; 122 | 123 | case effGetParamName: 124 | // strncpy((char *) ptr, plugin->getParameterName(index).c_str(), 125 | // kVstMaxParamStrLen); 126 | // strncpy((char *) ptr, plugin->getParameterName(index).c_str(), 127 | // kVstMaxVendorStrLen); 128 | strcpy((char *)ptr, plugin->getParameterName(index).c_str()); 129 | break; 130 | 131 | case effGetParamLabel: 132 | strcpy((char *)ptr, plugin->getParameterLabel(index).c_str()); 133 | // strcpy((char *) ptr, plugin->getEffString(effGetParamLabel, 134 | // index).c_str()); 135 | break; 136 | 137 | case effGetParamDisplay: 138 | strcpy((char *)ptr, plugin->getParameterDisplay(index).c_str()); 139 | // strcpy((char *) ptr, plugin->getEffString(effGetParamDisplay, 140 | // index).c_str()); 141 | break; 142 | 143 | case effGetProgramNameIndexed: 144 | v = plugin->getProgramNameIndexed(index, (char *)ptr); 145 | break; 146 | 147 | case effGetProgramName: 148 | // strncpy((char *) ptr, plugin->getProgramName().c_str(), 149 | // kVstMaxProgNameLen); 150 | strcpy((char *)ptr, plugin->getProgramName().c_str()); 151 | break; 152 | 153 | case effSetSampleRate: 154 | plugin->setSampleRate(opt); 155 | break; 156 | 157 | case effSetBlockSize: 158 | plugin->setBufferSize((VstInt32)value); 159 | break; 160 | 161 | #ifdef DOUBLEP 162 | case effSetProcessPrecision: 163 | v = plugin->getEffInt(effSetProcessPrecision, value); 164 | break; 165 | #endif 166 | 167 | #ifdef VESTIGE 168 | case effGetInputProperties: { 169 | if (index >= 0 && index < effect->numInputs) { 170 | struct vinfo2 *ptr2 = (struct vinfo2 *)ptr; 171 | 172 | ptr2->b = 1; 173 | 174 | if (index % 2 == 0) 175 | ptr2->b |= 2; 176 | 177 | sprintf(ptr2->a, "In %d", index + 1); 178 | v = 1; 179 | } 180 | break; 181 | } 182 | 183 | case effGetOutputProperties: { 184 | if (index >= 0 && index < effect->numOutputs) { 185 | struct vinfo2 *ptr2 = (struct vinfo2 *)ptr; 186 | 187 | ptr2->b = 1; 188 | 189 | if (index % 2 == 0) 190 | ptr2->b |= 2; 191 | 192 | sprintf(ptr2->a, "Out %d", index + 1); 193 | v = 1; 194 | } 195 | break; 196 | } 197 | #else 198 | case effGetInputProperties: 199 | v = plugin->getEffInProp(index, (char *)ptr); 200 | break; 201 | 202 | case effGetOutputProperties: 203 | v = plugin->getEffOutProp(index, (char *)ptr); 204 | break; 205 | #endif 206 | 207 | #ifdef MIDIEFF 208 | case effGetMidiKeyName: 209 | v = plugin->getEffMidiKey(index, (char *)ptr); 210 | break; 211 | 212 | case effGetMidiProgramName: 213 | v = plugin->getEffMidiProgName(index, (char *)ptr); 214 | break; 215 | 216 | case effGetCurrentMidiProgram: 217 | v = plugin->getEffMidiCurProg(index, (char *)ptr); 218 | break; 219 | 220 | case effGetMidiProgramCategory: 221 | v = plugin->getEffMidiProgCat(index, (char *)ptr); 222 | break; 223 | 224 | case effHasMidiProgramsChanged: 225 | v = plugin->getEffMidiProgCh(index); 226 | break; 227 | 228 | case effSetSpeakerArrangement: 229 | v = plugin->setEffSpeaker(value, (char *)ptr); 230 | break; 231 | 232 | case effGetSpeakerArrangement: 233 | v = plugin->getEffSpeaker(value, (char *)ptr); 234 | break; 235 | #endif 236 | 237 | case effGetVstVersion: 238 | v = kVstVersion; 239 | break; 240 | 241 | case effGetPlugCategory: 242 | v = plugin->getEffInt(effGetPlugCategory, 0); 243 | break; 244 | 245 | case effSetProgram: 246 | plugin->setCurrentProgram((VstInt32)value); 247 | break; 248 | 249 | case effEditOpen: 250 | #ifdef EMBED 251 | plugin->editopen = 0; 252 | 253 | plugin->winm->handle = (intptr_t)ptr; 254 | plugin->winm->winerror = 0; 255 | plugin->winm->width = 0; 256 | plugin->winm->height = 0; 257 | 258 | plugin->showGUI(); 259 | 260 | if(plugin->winm->winerror == 0) 261 | { 262 | plugin->rp->bottom = plugin->winm->height; 263 | plugin->rp->top = 0; 264 | plugin->rp->right = plugin->winm->width; 265 | plugin->rp->left = 0; 266 | } 267 | else 268 | break; 269 | #else 270 | plugin->showGUI(); 271 | #endif 272 | plugin->editopen = 1; 273 | v = 1; 274 | break; 275 | 276 | case effEditClose: 277 | if((plugin->editopen == 1) && (plugin->winm->winerror == 0)) 278 | { 279 | plugin->hideGUI(); 280 | plugin->editopen = 0; 281 | v = 1; 282 | } 283 | break; 284 | 285 | case effCanDo: 286 | if (ptr && !strcmp((char *)ptr, "hasCockosExtensions")) { 287 | plugin->reaperid = 1; 288 | plugin->effVoidOp(78345432); 289 | } 290 | #ifdef EMBED 291 | #ifdef TRACKTIONWM 292 | if(plugin->reaperid == 0) 293 | { 294 | if(plugin->theEffect && plugin->m_audioMaster) 295 | { 296 | plugin->m_audioMaster(plugin->theEffect, audioMasterGetProductString, 0, 0, dawbuf, 0); 297 | if((strcmp(dawbuf, "Tracktion") == 0) || (strcmp(dawbuf, "Waveform") == 0)) 298 | { 299 | plugin->hosttracktion = 1; 300 | plugin->waveformid = plugin->effVoidOp2(67584930, index, value, opt); 301 | } 302 | } 303 | } 304 | #endif 305 | #endif 306 | #ifdef CANDOEFF 307 | v = plugin->getEffCanDo((char *)ptr); 308 | #else 309 | v = 1; 310 | #endif 311 | break; 312 | 313 | case effProcessEvents: 314 | v = plugin->processVstEvents((VstEvents *)ptr); 315 | break; 316 | 317 | case effGetChunk: 318 | v = plugin->getChunk((void **)ptr, index); 319 | break; 320 | 321 | case effSetChunk: 322 | v = plugin->setChunk(ptr, value, index); 323 | break; 324 | 325 | case effGetProgram: 326 | v = plugin->getProgram(); 327 | break; 328 | 329 | case effCanBeAutomated: 330 | v = plugin->canBeAutomated(index); 331 | break; 332 | 333 | case effOpen: 334 | plugin->EffectOpen(); 335 | break; 336 | 337 | case effClose: 338 | if(plugin->winm->winerror == 1) 339 | plugin->winm->winerror = 0; 340 | else 341 | { 342 | if(plugin->editopen == 1) 343 | { 344 | plugin->hideGUI(); 345 | plugin->editopen = 0; 346 | v = 1; 347 | } 348 | } 349 | 350 | plugin->effVoidOp(effClose); 351 | 352 | delete plugin; 353 | break; 354 | 355 | default: 356 | break; 357 | } 358 | 359 | return v; 360 | } 361 | 362 | void processDouble(AEffect *effect, double **inputs, double **outputs, 363 | VstInt32 sampleFrames) { 364 | #ifdef DOUBLEP 365 | RemotePluginClient *plugin = (RemotePluginClient *)effect->object; 366 | 367 | if (!plugin) 368 | return; 369 | 370 | if ((plugin->m_bufferSize > 0) && (plugin->m_numInputs >= 0) && 371 | (plugin->m_numOutputs >= 0)) { 372 | plugin->processdouble(inputs, outputs, sampleFrames); 373 | } 374 | #endif 375 | return; 376 | } 377 | 378 | void process(AEffect *effect, float **inputs, float **outputs, 379 | VstInt32 sampleFrames) { 380 | RemotePluginClient *plugin = (RemotePluginClient *)effect->object; 381 | 382 | if (!plugin) 383 | return; 384 | 385 | if ((plugin->m_bufferSize > 0) && (plugin->m_numInputs >= 0) && 386 | (plugin->m_numOutputs >= 0)) { 387 | plugin->process(inputs, outputs, sampleFrames); 388 | } 389 | return; 390 | } 391 | 392 | void setParameter(AEffect *effect, VstInt32 index, float parameter) { 393 | RemotePluginClient *plugin = (RemotePluginClient *)effect->object; 394 | 395 | if (!plugin) 396 | return; 397 | 398 | if ((plugin->m_bufferSize > 0) && (plugin->m_numInputs >= 0) && 399 | (plugin->m_numOutputs >= 0)) { 400 | plugin->setParameter(index, parameter); 401 | } 402 | return; 403 | } 404 | 405 | float getParameter(AEffect *effect, VstInt32 index) { 406 | RemotePluginClient *plugin = (RemotePluginClient *)effect->object; 407 | float retval = -1; 408 | 409 | if (!plugin) 410 | return retval; 411 | 412 | if ((plugin->m_bufferSize > 0) && (plugin->m_numInputs >= 0) && 413 | (plugin->m_numOutputs >= 0)) { 414 | retval = plugin->getParameter(index); 415 | } 416 | return retval; 417 | } 418 | 419 | void initEffect(AEffect *eff, RemotePluginClient *plugin) { 420 | memset(eff, 0x0, sizeof(AEffect)); 421 | eff->magic = kEffectMagic; 422 | eff->dispatcher = dispatcher; 423 | eff->setParameter = setParameter; 424 | eff->getParameter = getParameter; 425 | eff->numInputs = plugin->getInputCount(); 426 | eff->numOutputs = plugin->getOutputCount(); 427 | eff->numPrograms = plugin->getProgramCount(); 428 | eff->numParams = plugin->getParameterCount(); 429 | eff->flags = plugin->getFlags(); 430 | #ifndef DOUBLEP 431 | eff->flags &= ~effFlagsCanDoubleReplacing; 432 | eff->flags |= effFlagsCanReplacing; 433 | #endif 434 | eff->resvd1 = 0; 435 | eff->resvd2 = 0; 436 | eff->initialDelay = plugin->getinitialDelay(); 437 | eff->object = (void *)plugin; 438 | eff->user = 0; 439 | eff->uniqueID = plugin->getUID(); 440 | eff->version = 100; 441 | eff->processReplacing = process; 442 | #ifdef DOUBLEP 443 | eff->processDoubleReplacing = processDouble; 444 | #endif 445 | } 446 | 447 | void errwin2() { 448 | Window window = 0; 449 | Window ignored = 0; 450 | Display *display = 0; 451 | int screen = 0; 452 | Atom winstate; 453 | Atom winmodal; 454 | 455 | std::string filename2; 456 | 457 | filename2 = "lin-vst-server/vst not found or LinVst version mismatch"; 458 | 459 | XInitThreads(); 460 | display = XOpenDisplay(NULL); 461 | if (!display) 462 | return; 463 | screen = DefaultScreen(display); 464 | window = XCreateSimpleWindow(display, RootWindow(display, screen), 10, 10, 465 | 480, 20, 0, BlackPixel(display, screen), 466 | WhitePixel(display, screen)); 467 | if (!window) 468 | return; 469 | winstate = XInternAtom(display, "_NET_WM_STATE", True); 470 | winmodal = XInternAtom(display, "_NET_WM_STATE_ABOVE", True); 471 | XChangeProperty(display, window, winstate, XA_ATOM, 32, PropModeReplace, 472 | (unsigned char *)&winmodal, 1); 473 | XStoreName(display, window, filename2.c_str()); 474 | XMapWindow(display, window); 475 | XSync(display, false); 476 | sleep(10); 477 | XSync(display, false); 478 | XDestroyWindow(display, window); 479 | XSync(display, false); 480 | XCloseDisplay(display); 481 | display = 0; 482 | } 483 | 484 | VST_EXPORT AEffect *VSTPluginMain(audioMasterCallback audioMaster) { 485 | RemotePluginClient *plugin; 486 | 487 | if (!audioMaster(0, audioMasterVersion, 0, 0, 0, 0)) 488 | return 0; 489 | 490 | // try { 491 | plugin = new RemoteVSTClient(audioMaster); 492 | // } catch (std::string e) { 493 | if(!plugin) 494 | { 495 | std::cerr << "Could not connect to Server" << std::endl; 496 | errwin2(); 497 | return 0; 498 | } 499 | 500 | if (plugin->m_runok == 2) { 501 | std::cerr << "LinVst Error: trying to load unnamed linvst.so" << std::endl; 502 | if (plugin) 503 | delete plugin; 504 | return 0; 505 | } 506 | 507 | if (plugin->m_runok == 1) { 508 | std::cerr << "LinVst Error: lin-vst-server not found or vst dll load " 509 | "timeout or LinVst version mismatch" 510 | << std::endl; 511 | // errwin2(); 512 | if (plugin) 513 | delete plugin; 514 | return 0; 515 | } 516 | 517 | initEffect(plugin->theEffect, plugin); 518 | 519 | #ifdef EMBED 520 | XInitThreads(); 521 | #endif 522 | 523 | return plugin->theEffect; 524 | } 525 | --------------------------------------------------------------------------------