diff --git a/notes b/notes index a9b6511..9954121 100644 --- a/notes +++ b/notes @@ -4,22 +4,22 @@ company { LV2: manifest.ttl doap:maintainer foaf:name web: not used cmd: not used - ios: not used android: not used + ios: not used url: VST3: PFactoryInfo.url LV2: manifest.ttl doap:maintainer rdfs:seeAlso web: not used cmd: not used - ios: not used android: not used + ios: not used email: VST3: PFactoryInfo.email LV2: manifest.ttl doap:maintainer foaf:mbox web: not used cmd: not used - ios: not used android: not used + ios: not used } product { @@ -28,29 +28,29 @@ product { LV2: manifest.ttl plugin doap:name web: web-demo and <h1> cmd: not used - ios: index.html <title> android: index.html <title>, AndroidManifest.xml <application> <activity> android:label + ios: index.html <title> version: VST3: PClassInfo{2,W}.version (first 3 numbers) LV2: not used web: not used cmd: not used - ios: not used android: not used + ios: not used buildVersion: VST3: PClassInfo{2,W}.version (last number) LV2: not used web: not used cmd: not used - ios: not used android: not used + ios: not used bundleName: VST3: plugin folder name, plugin .dll name, Info.plist LV2: plugin folder name, plugin .dll name, manifest.ttl plugin lv2:binary web: registerProcessor(), output file names cmd: executable file name - ios: project.yml name/target, vars.mk BUNDLE_NAME android: .so/.apk filenames + ios: xcodegen name and target name, xcodeproj filename buses: [ { name: @@ -59,80 +59,80 @@ product { LV2: manifest.ttl lv2:port lv2:name web: not used cmd: not used - ios: not used android: not used + ios: not used shortName: bus short name string, required VST3: not used LV2: manifest.ttl lv2:port lv2:shortName web: not used cmd: not used - ios: not used android: not used + ios: not used id: bus unique id string, required VST3; not used LV2: manifest.ttl lv2:port lv2:symbol (resulting ports can have _l or _r appended) web: not used cmd: not used - ios: not used android: not used + ios: not used direction: "input" or "output", required VST3: BusInfo flags - lots of implications LV2: manifest.ttl lv2:port a - lots of implications web: AudioWorkletNode.{numberOfInputs,numberOfOutputs,outputChannelCount} - lots of implications cmd: lots of places - ios: data.h, index.html android: lots of places + ios: data.h, index.html type: "audio" or "midi", required VST3: BusInfo mediaType, ParameterInfo (channel pressure, pitch bend params) - lots of implications LV2: lots of implications everywhere web: AudioWorkletNode.{numberOfInputs,numberOfOutputs,outputChannelCount} - lots of implications cmd: lots of places - ios: data.h, index.html android: lots of places + ios: data.h, index.html channels: "mono" or "stereo", audio type only, required VST3: BusInfo channelCount, plugin get/set bus arrangements LV2: manifest.ttl lv2:port - lots of implications web: AudioWorkletNode.outputChannelCount - lots of implications cmd: lots of places - ios: data.h android: lots of places + ios: data.h sidechain: bus is not part of main audio path (sidechain)? boolean, default false VST3: BusInfo busType LV2: manifest.ttl lv2:port lv2:portProperty lv2:isSideChain web: web-demo choice of audio I/O buses cmd: choice of audio I/O buses - ios: choice of audio I/O buses android: choice of audio I/O buses + ios: choice of audio I/O buses cv: bus is control voltage audio-rate? boolean, audio type only, default false VST3: BusInfo flags LV2: manifest.ttl lv2:port a lv2:CVPort web: web-demo choice of audio I/O buses cmd: choice of audio I/O buses - ios: choice of audio I/O buses android: choice of audio I/O buses + ios: choice of audio I/O buses control: bus is the "primary control channel" (send cmds, receive responses)? boolean, midi type only, default false VST3: not used LV2: manifest.ttl lv2:port lv2:designation lv2:control web: not used cmd: not used - ios: not used android: not used + ios: not used optional: bus is optionally connected? boolean, default false VST3: BusInfo flags, plugin initialize, activate bus, set active LV2: manifest.ttl lv2:port lv2:portProperty lv2:connectionOptional web: not used cmd: whether to pass NULLs if not chosen audio I/O buses - ios: whether to pass NULLs if not chosen audio I/O buses android: whether to pass NULLs if not chosen audio I/O buses + ios: whether to pass NULLs if not chosen audio I/O buses } ] parameters: [ @@ -143,40 +143,40 @@ product { LV2: manifest.ttl lv2:port lv2:name web: AudioWorkletProcessor.parameterDescriptors, web-demo <label> cmd: not used - ios: index.html android: index.html <label> + ios: index.html <label> shortName: parameter short name string, required VST3: ParameterInfo shortTitle LV2: manifest.ttl lv2:port lv2:shortName web: not used cmd: not used - ios: not used android: not used + ios: not used id: parameter unique id string, required VST3; not used LV2: manifest.ttl lv2:port lv2:symbol (bypass ports used "enabled") web: not used cmd: command line parameter name etc. - ios: not used android: not used + ios: not used direction: "input" or "output", required VST3: ParameterInfo flags - lots of implications LV2: manifest.ttl lv2:port a - lots of implications web: AudioWorkletProcessor.parameterDescriptors, web-demo <range> readonly/input listener - lots of implications cmd: lots of places - ios: data.h, index.html android: lots of places + ios: data.h, index.html isBypass: parameter is bypass/enabled? boolean - lots of implications, default false VST3: ParameterInfo, controller get/set parameter/state LV2: manifest.ttl lv2:port, run() (set parameter) web: AudoWorkletProcessor.process(), web-demo <range> min/max/step cmd: set parameter - ios: native.mm set parameter, index.html <range> min/max/step android: JNI set parameter, index.html <range> min/max/step + ios: native set parameter, index.html <range> min/max/step isLatency: parameter is latency output? boolean - lots of implications, default false VST3: TBD @@ -191,56 +191,56 @@ product { LV2: data.h, lv2.c web: processor.js cmd: TODO - ios: data.h native.mm android: data.h jni.cpp + ios: data.h native.mm defaultValue: default value, number, mapped, required for non-bypass VST3: ParameterInfo defaultNormalizedValue, controller initialize LV2: manifest.ttl lv2:port lv2:default, activate() (set initial parameter) web: AudioWorkletProcessor.parameterDescriptors, processor_new(), web-demo initial <range> value and value <span> innerText cmd: default parameter value - ios: native.mm set parameter initial value, index.html initial <range> value android: JNI set parameter initial value, index.html initial <range> value + ios: native set parameter initial value, index.html initial <range> value minimum: minimum value, number, mapped, required for non-bypass VST3: ParameterInfo stepCount, defaultNormalizedValue, controller get/set parameter (value clamped) LV2: manifest.ttl lv2:port lv2:minimum, run() (set parameter, value clamped) web: AudioWorkletProcessor.parameterDescriptors, AudioWorkletProcessor.process() (value clamped), web-demo <range> mapping cmd: set parameter (value clamped) - ios: native.mm set parameter (value clamped), index.html <range> mapping android: JNI set parameter (value clamped), index.html <range> mapping + ios: native set parameter (value clamped), index.html <range> mapping maximum: maximum value, number, mapped, required for non-bypass VST3: ParameterInfo stepCount, defaultNormalizedValue, controller get/set parameter (value clamped) LV2: manifest.ttl lv2:port lv2:maximum, run() (set parameter, value clamped) web: AudioWorkletProcessor.parameterDescriptors, AudioWorkletProcessor.process() (value clamped), web-demo <range> mapping cmd: set parameter (value clamped) - ios: native.mm set parameter (value clamped), index.html <range> mapping android: JNI set parameter (value clamped), index.html <range> mapping + ios: native set parameter (value clamped), index.html <range> mapping toggled: parameter is on/off? boolean, default false VST3: ParameterInfo stepCount, controller set parameter/state LV2: manifest.ttl lv2:port lv2:portProperty lv2:toggled, run() (set parameter) web: AudoWorkletProcessor.process(), web-demo <range> min/max/step cmd: set parameter - ios: native.mm set parameter, index.html <range> min/max/step android: JNI set parameter, index.html <range> min/max/step + ios: native set parameter, index.html <range> min/max/step optional: parameter is optionally connected? boolean, default false VST3: not used LV2: manifest.ttl lv2:port lv2:portProperty lv2:connectionOptional web: not used cmd: not used - ios: not used android: not used + ios: not used integer: parameter values are integers? boolean, default false VST3: ParameterInfo stepCount, controller set parameter/state LV2: manifest.ttl lv2:port lv2:portProperty lv2:integer, run() (set parameter) web: AudoWorkletProcessor.process(), web-demo <range> step cmd: set parameter - ios: native.mm set parameter, index.html <range> step android: JNI set parameter, index.html <range> step + ios: native set parameter, index.html <range> step scalePoints: { "label1": value1, "label2", value2, ... } labeled values, default none @@ -248,32 +248,32 @@ product { LV2: manifest.ttl lv2:port lv2:scalePoint web: not (yet) used cmd: not (yet) used - ios: not (yet) used android: not (yet) used + ios: not (yet) used list: parameter is a list (using scalePoints values)? default false VST3: TBD (+approx to closest?) LV2: manifest.ttl lv2:port lv2:enumeration - run() (set parameter) TBD? web: TBD (approx to closest? dropdown? both?) cmd: not (yet) used - ios: not (yet) used android: not (yet) used + ios: not (yet) used unit: unit of measure (from predefined list, see tibia-index.js), default "" VST3: ParameterInfo units LV2: manifest.ttl lv2:port units:unit web: web-demo value <span> innerText cmd: not (yet) used - ios: not (yet) used android: not (yet) used + ios: not (yet) used map: "linear" vs "logarithmic" VST3: many places (requires libm) LV2: manifest.ttl lv2:port lv2:portProperty pprops:logarithmic web: web-demo <range> values cmd: not used - ios: index.html <range> values android: index.html <range> values + ios: index.html <range> values } ] } diff --git a/templates/android/src/jni.cpp b/templates/android/src/jni.cpp index 96a3725..b373fe7 100644 --- a/templates/android/src/jni.cpp +++ b/templates/android/src/jni.cpp @@ -21,9 +21,8 @@ #include <stdlib.h> #include <stdint.h> -#include "callbacks.h" - #include "data.h" +#include "plugin_api.h" #include "plugin.h" #include <string.h> diff --git a/templates/cmd/src/main.c b/templates/cmd/src/main.c index 747c220..6f598f2 100644 --- a/templates/cmd/src/main.c +++ b/templates/cmd/src/main.c @@ -21,9 +21,8 @@ #include <stdlib.h> #include <stdint.h> -#include "callbacks.h" - #include "data.h" +#include "plugin_api.h" #include "plugin.h" #include <stdio.h> diff --git a/templates/common/src/plugin_api.h b/templates/common/src/plugin_api.h new file mode 100644 index 0000000..dcd696b --- /dev/null +++ b/templates/common/src/plugin_api.h @@ -0,0 +1,49 @@ +/* + * Tibia + * + * Copyright (C) 2024 Orastron Srl unipersonale + * + * Tibia is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3 of the License. + * + * Tibia is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tibia. If not, see <http://www.gnu.org/licenses/>. + * + * File author: Stefano D'Angelo + */ + +#ifndef PLUGIN_API_H +#define PLUGIN_API_H + +typedef struct { + void * handle; + const char * format; + const char * (*get_bindir)(void *handle); + const char * (*get_datadir)(void *handle); +} plugin_callbacks; + +typedef struct { + void * handle; + const char * format; + const char * (*get_bindir)(void *handle); + const char * (*get_datadir)(void *handle); + void (*set_parameter_begin)(void *handle, size_t index); + void (*set_parameter)(void *handle, size_t index, float value); + void (*set_parameter_end)(void *handle, size_t index); +} plugin_ui_callbacks; + +{{?it.product.parameters.length > 0}} +enum { + {{~it.product.parameters :p}} + plugin_parameter_{{=p.id}}, + {{~}} +}; +{{?}} + +#endif diff --git a/templates/common/tibia-index.js b/templates/common/tibia-index.js new file mode 100644 index 0000000..1dfd137 --- /dev/null +++ b/templates/common/tibia-index.js @@ -0,0 +1,26 @@ +/* + * Tibia + * + * Copyright (C) 2024 Orastron Srl unipersonale + * + * Tibia is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3 of the License. + * + * Tibia is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tibia. If not, see <http://www.gnu.org/licenses/>. + * + * File author: Stefano D'Angelo + */ + +var path = require("path"); +var sep = path.sep; + +module.exports = function (data, api) { + api.generateFileFromTemplateFile(`src${sep}plugin_api.h`, `src${sep}plugin_api.h`, data); +}; diff --git a/templates/daisy-seed/src/main.cpp b/templates/daisy-seed/src/main.cpp index 7403e0b..43253b3 100644 --- a/templates/daisy-seed/src/main.cpp +++ b/templates/daisy-seed/src/main.cpp @@ -21,9 +21,8 @@ #include <stdlib.h> #include <stdint.h> -#include "callbacks.h" - #include "data.h" +#include "plugin_api.h" #include "plugin.h" #include <string.h> diff --git a/templates/ios/src/native.mm b/templates/ios/src/native.mm index e48446e..dfee0c1 100644 --- a/templates/ios/src/native.mm +++ b/templates/ios/src/native.mm @@ -21,9 +21,8 @@ #include <stdlib.h> #include <stdint.h> -#include "callbacks.h" - #include "data.h" +#include "plugin_api.h" #include "plugin.h" #if PARAMETERS_N > 0 # include <algorithm> diff --git a/templates/lv2/src/lv2.c b/templates/lv2/src/lv2.c index 7d38975..8827444 100644 --- a/templates/lv2/src/lv2.c +++ b/templates/lv2/src/lv2.c @@ -21,9 +21,8 @@ #include <stdlib.h> #include <stdint.h> -#include "callbacks.h" - #include "data.h" +#include "plugin_api.h" #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #include "plugin.h" diff --git a/templates/vst3/src/vst3.c b/templates/vst3/src/vst3.c index d48cbe3..7d3fdb9 100644 --- a/templates/vst3/src/vst3.c +++ b/templates/vst3/src/vst3.c @@ -21,14 +21,13 @@ #include <stdlib.h> #include <stdint.h> -#include "callbacks.h" - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpedantic" #include "vst3_c_api.h" #pragma GCC diagnostic pop #include "data.h" +#include "plugin_api.h" #include "plugin.h" #ifdef DATA_UI # include "plugin_ui.h" diff --git a/templates/web/src/processor.c b/templates/web/src/processor.c index 72619c4..7b70890 100644 --- a/templates/web/src/processor.c +++ b/templates/web/src/processor.c @@ -21,9 +21,8 @@ #include <stddef.h> #include <stdint.h> -#include "callbacks.h" - #include "data.h" +#include "plugin_api.h" #include "plugin.h" #include "string.h" diff --git a/test/plugin.h b/test/plugin.h index 4bbf97e..1910a51 100644 --- a/test/plugin.h +++ b/test/plugin.h @@ -68,17 +68,17 @@ static void plugin_reset(plugin *instance) { static void plugin_set_parameter(plugin *instance, size_t index, float value) { switch (index) { - case 0: + case plugin_parameter_gain: //approx instance->gain = powf(10.f, 0.05f * value); instance->gain = ((2.6039890429412597e-4f * value + 0.032131027163547855f) * value + 1.f) / ((0.0012705124328080768f * value - 0.0666763481312185f) * value + 1.f); break; - case 1: + case plugin_parameter_delay: instance->delay = 0.001f * value; break; - case 2: + case plugin_parameter_cutoff: instance->cutoff = value; break; - case 3: + case plugin_parameter_bypass: instance->bypass = value >= 0.5f; break; } diff --git a/test/run.sh b/test/run.sh index 50f3173..4b3eeb8 100755 --- a/test/run.sh +++ b/test/run.sh @@ -1,32 +1,39 @@ #!/bin/sh dir=`dirname $0` +$dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/common $dir/../out/vst3 $dir/../tibia $dir/product.json,$dir/company.json,$dir/vst3.json $dir/../templates/vst3 $dir/../out/vst3 $dir/../tibia $dir/product.json,$dir/company.json,$dir/vst3.json,$dir/vst3-make.json $dir/../templates/vst3-make $dir/../out/vst3 cp $dir/plugin.h $dir/plugin_ui.h $dir/../out/vst3/src +$dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/common $dir/../out/lv2 $dir/../tibia $dir/product.json,$dir/company.json,$dir/lv2.json $dir/../templates/lv2 $dir/../out/lv2 $dir/../tibia $dir/product.json,$dir/company.json,$dir/lv2.json,$dir/lv2-make.json $dir/../templates/lv2-make $dir/../out/lv2 cp $dir/plugin.h $dir/plugin_ui.h $dir/../out/lv2/src +$dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/common $dir/../out/web $dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/web $dir/../out/web $dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/web-make $dir/../out/web $dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/web-demo $dir/../out/web cp $dir/plugin.h $dir/../out/web/src +$dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/common $dir/../out/android $dir/../tibia $dir/product.json,$dir/company.json,$dir/android.json $dir/../templates/android $dir/../out/android $dir/../tibia $dir/product.json,$dir/company.json,$dir/android.json,$dir/android-make.json $dir/../templates/android-make $dir/../out/android cp $dir/keystore.jks $dir/../out/android cp $dir/plugin.h $dir/../out/android/src +$dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/common $dir/../out/ios $dir/../tibia $dir/product.json,$dir/company.json,$dir/ios.json $dir/../templates/ios $dir/../out/ios $dir/../tibia $dir/product.json,$dir/company.json,$dir/ios.json,$dir/ios-make.json $dir/../templates/ios-make $dir/../out/ios cp $dir/plugin.h $dir/../out/ios/src +$dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/common $dir/../out/cmd $dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/cmd $dir/../out/cmd $dir/../tibia $dir/product.json,$dir/company.json,$dir/cmd-make.json $dir/../templates/cmd-make $dir/../out/cmd cp $dir/plugin.h $dir/../out/cmd/src +$dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/common $dir/../out/daisy-seed $dir/../tibia $dir/product.json,$dir/company.json,$dir/daisy-seed.json $dir/../templates/daisy-seed $dir/../out/daisy-seed $dir/../tibia $dir/product.json,$dir/company.json,$dir/daisy-seed.json,$dir/daisy-seed-make.json $dir/../templates/daisy-seed-make $dir/../out/daisy-seed cp $dir/plugin.h $dir/../out/daisy-seed/src