set up LADSPA building on windows

This commit is contained in:
Connor Olding 2015-12-07 04:54:47 -08:00
parent f414ccc404
commit fad61c7c7d
5 changed files with 32 additions and 20 deletions

View File

@ -5,13 +5,13 @@ cd bin
set vst=../../../src/vstsdk2.4/
set vst2x=%vst%public.sdk/source/vst2.x/
set vstdef=%vst%public.sdk/samples/vst2.x/win/vstplug.def
set vst_c=/LD /I"%vst%"
set vst_c=/I"%vst%"
set vst_ld=/DEF:"%vstdef%"
set vstsrc=%vst2x%audioeffect.cpp %vst2x%audioeffectx.cpp %vst2x%vstplugmain.cpp
set wall=/Wall /wd4100 /wd4668 /wd4820 /wd4514 /wd4365 /wd4711 /wd4996
set wall=/Wall /wd4100 /wd4668 /wd4820 /wd4514 /wd4365 /wd4711 /wd4996 /wd4127
REM the warning disabled below is function-not-inlined
set common_c=/I"../" /I"../include/" %wall% /wd4710
set common_c=/LD /I"../" /I"../include/" %wall% /wd4710
set release_c=%common_c% /O2 /Oy- /GL /EHsc /fp:fast /analyze- /nologo
set release_ld=
@ -28,6 +28,8 @@ goto:eof
:compile
set crap=%~1
cscript ..\util\generate.vbs %crap%
cscript ..\util\generate.vbs %crap% vst
cscript ..\util\generate.vbs %crap% ladspa
cl %release_c% %vst_c% ../crap/vst/%crap%.cpp %vstsrc% /link %release_ld% %vst_ld% /OUT:"vst/crap_%crap%.dll"
cl %release_c% ../crap/ladspa/%crap%.cpp /link %release_ld% /OUT:"ladspa/crap_%crap%.dll"
goto:eof

View File

@ -107,9 +107,9 @@ typedef struct _LADSPA_Descriptor {
void (*deactivate)(LADSPA_Handle Instance);
void (*cleanup)(LADSPA_Handle Instance);
} LADSPA_Descriptor;
#ifdef WIN32
#if WIN32 || _WIN32
// weird clang bug workaround
#if (__clang__ != 1) || (_X86_ != 1)
#if (__clang__ != 1) || (_X86_ != 1) || _MSC_VER
__declspec(dllexport)
#endif
#endif

View File

@ -1,10 +1,15 @@
#include <stdlib.h>
#include "ladspa.hpp"
//#INCLUDE
//#REDEFINE
#include <stdlib.h>
#include <stdio.h>
#ifdef _MSC_VER
// we need memcpy
#include <memory.h>
#endif
#include "ladspa.hpp"
#ifndef PARAM_NAME_LEN
#define PARAM_NAME_LEN 25
#endif
@ -60,9 +65,9 @@ struct plug_t {
TEMPLATE
struct LADSPA_Plugin {
//static constexpr ulong name_buf_size = (portcount)*PARAM_NAME_LEN;
static constexpr ulong portcount = IO_PLUGS + T::parameters;
static Param default_params[T::parameters];
//static const ulong name_buf_size = (portcount)*PARAM_NAME_LEN;
static const ulong portcount = IO_PLUGS + T::parameters;
static Param *default_params;
static LADSPA_PortDescriptor descs[portcount];
static LADSPA_PortRangeHint hints[portcount];
static char* names[portcount];
@ -78,9 +83,12 @@ struct LADSPA_Plugin {
memcpy(names[i], p_default_strings[i], PARAM_NAME_LEN);
descs[i] = LADSPA_PORT_AUDIO;
descs[i] |= (i < 2) ? LADSPA_PORT_INPUT : LADSPA_PORT_OUTPUT;
hints[i] = (LADSPA_PortRangeHint){.HintDescriptor = 0};
hints[i] = {0, 0, 0};
}
default_params = NULL;
if (T::parameters)
default_params = new Param[T::parameters];
T::construct_params(default_params);
for (int i = 0; i < T::parameters; i++) {
int j = i + IO_PLUGS;
@ -172,7 +180,7 @@ struct LADSPA_Plugin {
};
#define P LADSPA_Plugin<T>
TEMPLATE Param P::default_params[T::parameters];
TEMPLATE Param *P::default_params;
TEMPLATE LADSPA_PortDescriptor P::descs[P::portcount];
TEMPLATE LADSPA_PortRangeHint P::hints[P::portcount];
TEMPLATE char* P::names[P::portcount];

View File

@ -1,9 +1,10 @@
#include <stdio.h>
#include "public.sdk/source/vst2.x/audioeffectx.h"
//#INCLUDE
//#REDEFINE
#include <stdio.h>
#include "public.sdk/source/vst2.x/audioeffectx.h"
// VST 2.4 by standard only holds 8 (+ 1 null) length strings,
// but this is never the case in practice. I've seen up to 24.
#define MAX_PARAM_LEN 24

View File

@ -1,9 +1,10 @@
Set FSO = CreateObject("Scripting.FileSystemObject")
Name = WScript.Arguments(0)
Kind = WScript.Arguments(1)
IPath = "../template/vst.cpp"
OPath = "../crap/vst/"&Name&".cpp"
IPath = "../template/"&Kind&".cpp"
OPath = "../crap/"&Kind&"/"&Name&".cpp"
Inc = "crap/"&Name&".hpp"
Set File = FSO.OpenTextFile(IPath)