From d0de2e96a336a2a5b948264fffc403161aa2022b Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Thu, 1 Feb 2024 09:15:00 +0100 Subject: [PATCH] update vst3 --- templates/vst3-make/Makefile | 20 ++++++----- templates/vst3-make/vars.mk | 3 ++ templates/vst3/src/vst3.c | 9 +++++ templates/vst3/tibia-index.js | 64 ++++++++++++++++++----------------- 4 files changed, 57 insertions(+), 39 deletions(-) diff --git a/templates/vst3-make/Makefile b/templates/vst3-make/Makefile index 2e326a1..284c916 100644 --- a/templates/vst3-make/Makefile +++ b/templates/vst3-make/Makefile @@ -23,8 +23,12 @@ else endif endif +COMMON_DIR := $(or $(COMMON_DIR),.) +DATA_DIR := $(or $(DATA_DIR),.) +PLUGIN_DIR := $(or $(PLUGIN_DIR),src) + CFLAGS = -O3 -Wall -Wpedantic -Wextra -CFLAGS_ALL = -fPIC ${CFLAGS} ${CFLAGS_EXTRA} +CFLAGS_ALL = -I${DATA_DIR}/src -I${PLUGIN_DIR} -fPIC ${CFLAGS} ${CFLAGS_EXTRA} LDFLAGS = LDFLAGS_ALL = -shared -lm ${LDFLAGS} ${LDFLAGS_EXTRA} @@ -38,17 +42,17 @@ ifeq ($(UNAME_S), Darwin) all: build/${BUNDLE_DIR}/${DLL_FILE} build/${BUNDLE_DIR}/Contents/Info.plist -build/${BUNDLE_DIR}/Contents/Info.plist: data/Info.plist | build/${BUNDLE_DIR}/Contents +build/${BUNDLE_DIR}/Contents/Info.plist: ${DATA_DIR}/data/Info.plist | build/${BUNDLE_DIR}/Contents cp $^ $@ build/${BUNDLE_DIR}/${DLL_FILE}: build/tmp/x86_64 build/tmp/arm64 | build/${BUNDLE_DIR}/${DLL_DIR} lipo -create -output $@ $^ -build/tmp/x86_64: src/vst3.c src/data.h src/plugin.h | build/tmp - ${CC} src/vst3.c -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL} -arch x86_64 +build/tmp/x86_64: ${COMMON_DIR}/src/vst3.c ${DATA_DIR}/src/data.h ${PLUGIN_DIR}/plugin.h | build/tmp + ${CC} ${COMMON_DIR}/src/vst3.c -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL} -arch x86_64 -build/tmp/arm64: src/vst3.c src/data.h src/plugin.h | build/tmp - ${CC} src/vst3.c -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL} -arch arm64 +build/tmp/arm64: ${COMMON_DIR}/src/vst3.c ${DATA_DIR}/src/data.h ${PLUGIN_DIR}/plugin.h | build/tmp + ${CC} ${COMMON_DIR}/src/vst3.c -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL} -arch arm64 build/tmp build/${BUILD_DIR}/Contents: mkdir -p $@ @@ -57,8 +61,8 @@ else all: build/${BUNDLE_DIR}/${DLL_FILE} -build/${BUNDLE_DIR}/${DLL_FILE}: src/vst3.c src/data.h | build/${BUNDLE_DIR}/${DLL_DIR} - ${CC} src/vst3.c -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL} +build/${BUNDLE_DIR}/${DLL_FILE}: ${COMMON_DIR}/src/vst3.c ${DATA_DIR}/src/data.h ${PLUGIN_DIR}/plugin.h | build/${BUNDLE_DIR}/${DLL_DIR} + ${CC} ${COMMON_DIR}/src/vst3.c -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL} endif diff --git a/templates/vst3-make/vars.mk b/templates/vst3-make/vars.mk index e793acf..ad08a2b 100644 --- a/templates/vst3-make/vars.mk +++ b/templates/vst3-make/vars.mk @@ -1,3 +1,6 @@ BUNDLE_NAME := {{=it.product.bundleName}} CFLAGS_EXTRA := {{=it.make && it.make.cflags ? it.make.cflags : ""}} {{=it.vst3_make && it.vst3_make.cflags ? it.vst3_make.cflags : ""}} LDFLAGS_EXTRA := {{=it.make && it.make.ldflags ? it.make.ldflags : ""}} {{=it.vst3_make && it.vst3_make.ldflags ? it.vst3_make.ldflags : ""}} +COMMON_DIR := {{=it.vst3_make && it.vst3_make.commonDir ? it.vst3_make.commonDir : (it.make && it.make.commonDir ? it.make.commonDir : "")}} +DATA_DIR := {{=it.vst3_make && it.vst3_make.dataDir ? it.vst3_make.dataDir : (it.make && it.make.dataDir ? it.make.dataDir : "")}} +PLUGIN_DIR := {{=it.vst3_make && it.vst3_make.pluginDir ? it.vst3_make.pluginDir : (it.make && it.make.pluginDir ? it.make.pluginDir : "")}} diff --git a/templates/vst3/src/vst3.c b/templates/vst3/src/vst3.c index f637b31..e570d64 100644 --- a/templates/vst3/src/vst3.c +++ b/templates/vst3/src/vst3.c @@ -990,8 +990,14 @@ static Steinberg_Vst_ParamValue controllerGetParamNormalized(void* thisInterface TRACE("controller get param normalized\n"); #if DATA_PRODUCT_PARAMETERS_N + DATA_PRODUCT_BUSES_MIDI_INPUT_N > 0 controller *c = (controller *)((char *)thisInterface - offsetof(controller, vtblIEditController)); +# if DATA_PRODUCT_BUSES_MIDI_INPUT_N > 0 return id >= DATA_PRODUCT_PARAMETERS_N ? c->parameters[id] : parameterUnmap(id, c->parameters[id]); +# else + return parameterUnmap(id, c->parameters[id]); +# endif #else + (void)thisInterface; + (void)id; return 0.0; #endif } @@ -1005,6 +1011,9 @@ static Steinberg_tresult controllerSetParamNormalized(void* thisInterface, Stein c->parameters[id] = id >= DATA_PRODUCT_PARAMETERS_N ? value : parameterAdjust(id, parameterMap(id, value)); return Steinberg_kResultTrue; #else + (void)thisInterface; + (void)id; + (void)value; return Steinberg_kResultFalse; #endif } diff --git a/templates/vst3/tibia-index.js b/templates/vst3/tibia-index.js index a9a3a66..ac5ee67 100644 --- a/templates/vst3/tibia-index.js +++ b/templates/vst3/tibia-index.js @@ -1,38 +1,40 @@ var path = require("path"); var sep = path.sep; -module.exports = function (data, api) { - data.tibia.vst3 = { - units: { - "bar": "bars", - "beat": "beats", - "bpm": "BPM", - "cent": "ct", - "cm": "cm", - "coef": "", - "db": "dB", - "degree": "deg", - "frame": "frames", - "hz": "Hz", - "inch": "\"", - "khz": "kHz", - "km": "km", - "m": "m", - "mhz": "MHz", - "midiNote": "MIDI note", - "mile": "mi", - "min": "mins", - "mm": "mm", - "ms": "ms", - "oct": "octaves", - "pc": "%", - "s": "s", - "semitone12TET": "semi" - } - }; +module.exports = function (data, api, outputCommon, outputData) { + if (outputData) { + data.tibia.vst3 = { + units: { + "bar": "bars", + "beat": "beats", + "bpm": "BPM", + "cent": "ct", + "cm": "cm", + "coef": "", + "db": "dB", + "degree": "deg", + "frame": "frames", + "hz": "Hz", + "inch": "\"", + "khz": "kHz", + "km": "km", + "m": "m", + "mhz": "MHz", + "midiNote": "MIDI note", + "mile": "mi", + "min": "mins", + "mm": "mm", + "ms": "ms", + "oct": "octaves", + "pc": "%", + "s": "s", + "semitone12TET": "semi" + } + }; - for (var i = 0; i < data.product.parameters.length; i++) - data.product.parameters[i].paramIndex = i; + for (var i = 0; i < data.product.parameters.length; i++) + data.product.parameters[i].paramIndex = i; + } api.generateFileFromTemplateFile(`data${sep}Info.plist`, `data${sep}Info.plist`, data); api.copyFile(`src${sep}vst3.c`, `src${sep}vst3.c`);