diff --git a/templates/android/src/jni.cpp b/templates/android/src/jni.cpp index b062f7d..96a3725 100644 --- a/templates/android/src/jni.cpp +++ b/templates/android/src/jni.cpp @@ -21,12 +21,7 @@ #include #include -typedef struct { - void *handle; - const char *format; - const char *(*get_bindir)(void *handle); - const char *(*get_datadir)(void *handle); -} plugin_callbacks; +#include "callbacks.h" #include "data.h" #include "plugin.h" diff --git a/templates/android/tibia-index.js b/templates/android/tibia-index.js index fedbe9e..9e394fe 100644 --- a/templates/android/tibia-index.js +++ b/templates/android/tibia-index.js @@ -28,4 +28,5 @@ module.exports = function (data, api) { api.generateFileFromTemplateFile(`src${sep}MainActivity.java`, `src${sep}MainActivity.java`, data); api.generateFileFromTemplateFile(`src${sep}index.html`, `src${sep}index.html`, data); api.copyFile(`..${sep}common${sep}fatica.h`, `src${sep}fatica.h`); + api.copyFile(`..${sep}common${sep}callbacks.h`, `src${sep}callbacks.h`); }; diff --git a/templates/cmd/src/main.c b/templates/cmd/src/main.c index 97a9ed1..747c220 100644 --- a/templates/cmd/src/main.c +++ b/templates/cmd/src/main.c @@ -21,12 +21,7 @@ #include #include -typedef struct { - void * handle; - const char * format; - const char * (*get_bindir)(void *handle); - const char * (*get_datadir)(void *handle); -} plugin_callbacks; +#include "callbacks.h" #include "data.h" #include "plugin.h" diff --git a/templates/cmd/tibia-index.js b/templates/cmd/tibia-index.js index aecdbbc..3e057b7 100644 --- a/templates/cmd/tibia-index.js +++ b/templates/cmd/tibia-index.js @@ -24,4 +24,5 @@ var sep = path.sep; module.exports = function (data, api) { api.generateFileFromTemplateFile(`src${sep}data.h`, `src${sep}data.h`, data); api.copyFile(`src${sep}main.c`, `src${sep}main.c`); + api.copyFile(`..${sep}common${sep}callbacks.h`, `src${sep}callbacks.h`); }; diff --git a/templates/common/callbacks.h b/templates/common/callbacks.h new file mode 100644 index 0000000..2a1c5d4 --- /dev/null +++ b/templates/common/callbacks.h @@ -0,0 +1,22 @@ +#ifndef TIBIA_CALLBACKS_H +#define TIBIA_CALLBACKS_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; + +#endif diff --git a/templates/daisy-seed/src/main.cpp b/templates/daisy-seed/src/main.cpp index 7e218a7..7403e0b 100644 --- a/templates/daisy-seed/src/main.cpp +++ b/templates/daisy-seed/src/main.cpp @@ -21,12 +21,7 @@ #include #include -typedef struct { - void * handle; - const char * format; - const char * (*get_bindir)(void *handle); - const char * (*get_datadir)(void *handle); -} plugin_callbacks; +#include "callbacks.h" #include "data.h" #include "plugin.h" diff --git a/templates/daisy-seed/tibia-index.js b/templates/daisy-seed/tibia-index.js index 7826d36..3d5dc9c 100644 --- a/templates/daisy-seed/tibia-index.js +++ b/templates/daisy-seed/tibia-index.js @@ -24,4 +24,5 @@ var sep = path.sep; module.exports = function (data, api) { api.generateFileFromTemplateFile(`src${sep}data.h`, `src${sep}data.h`, data); api.copyFile(`src${sep}main.cpp`, `src${sep}main.cpp`); + api.copyFile(`..${sep}common${sep}callbacks.h`, `src${sep}callbacks.h`); }; diff --git a/templates/ios/src/native.mm b/templates/ios/src/native.mm index 086999c..e48446e 100644 --- a/templates/ios/src/native.mm +++ b/templates/ios/src/native.mm @@ -21,12 +21,7 @@ #include #include -typedef struct { - void *handle; - const char *format; - const char *(*get_bindir)(void *handle); - const char *(*get_datadir)(void *handle); -} plugin_callbacks; +#include "callbacks.h" #include "data.h" #include "plugin.h" diff --git a/templates/ios/tibia-index.js b/templates/ios/tibia-index.js index 093fb72..771aaba 100644 --- a/templates/ios/tibia-index.js +++ b/templates/ios/tibia-index.js @@ -28,4 +28,5 @@ module.exports = function (data, api) { api.copyFile(`src${sep}app-Bridging-Header.h`, `src${sep}app-Bridging-Header.h`); api.copyFile(`src${sep}app.swift`, `src${sep}app.swift`, data); api.copyFile(`..${sep}common${sep}fatica.h`, `src${sep}fatica.h`); + api.copyFile(`..${sep}common${sep}callbacks.h`, `src${sep}callbacks.h`); }; diff --git a/templates/lv2/src/lv2.c b/templates/lv2/src/lv2.c index 0aa4d72..7d38975 100644 --- a/templates/lv2/src/lv2.c +++ b/templates/lv2/src/lv2.c @@ -21,23 +21,7 @@ #include #include -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; +#include "callbacks.h" #include "data.h" #pragma GCC diagnostic push diff --git a/templates/lv2/tibia-index.js b/templates/lv2/tibia-index.js index c92b721..10fa359 100644 --- a/templates/lv2/tibia-index.js +++ b/templates/lv2/tibia-index.js @@ -121,6 +121,7 @@ module.exports = function (data, api, outputCommon, outputData) { api.generateFileFromTemplateFile(`data${sep}manifest.ttl.in`, `data${sep}manifest.ttl.in`, data); api.copyFile(`src${sep}lv2.c`, `src${sep}lv2.c`); - api.copyFile(`..${sep}common${sep}fatica.h`, `src${sep}fatica.h`); api.generateFileFromTemplateFile(`src${sep}data.h`, `src${sep}data.h`, data); + api.copyFile(`..${sep}common${sep}fatica.h`, `src${sep}fatica.h`); + api.copyFile(`..${sep}common${sep}callbacks.h`, `src${sep}callbacks.h`); }; diff --git a/templates/vst3/src/vst3.c b/templates/vst3/src/vst3.c index e8b7002..1b00530 100644 --- a/templates/vst3/src/vst3.c +++ b/templates/vst3/src/vst3.c @@ -21,22 +21,7 @@ #include #include -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; +#include "callbacks.h" #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpedantic" diff --git a/templates/vst3/tibia-index.js b/templates/vst3/tibia-index.js index c767603..40f4956 100644 --- a/templates/vst3/tibia-index.js +++ b/templates/vst3/tibia-index.js @@ -66,6 +66,7 @@ module.exports = function (data, api, outputCommon, outputData) { api.copyFile(`data${sep}PkgInfo`, `data${sep}PkgInfo`); api.generateFileFromTemplateFile(`data${sep}Info.plist`, `data${sep}Info.plist`, data); api.copyFile(`src${sep}vst3.c`, `src${sep}vst3.c`); - api.copyFile(`..${sep}common${sep}fatica.h`, `src${sep}fatica.h`); api.generateFileFromTemplateFile(`src${sep}data.h`, `src${sep}data.h`, data); + api.copyFile(`..${sep}common${sep}fatica.h`, `src${sep}fatica.h`); + api.copyFile(`..${sep}common${sep}callbacks.h`, `src${sep}callbacks.h`); }; diff --git a/templates/web/src/processor.c b/templates/web/src/processor.c index 645177e..72619c4 100644 --- a/templates/web/src/processor.c +++ b/templates/web/src/processor.c @@ -21,12 +21,7 @@ #include #include -typedef struct { - void *handle; - const char *format; - const char *(*get_bindir)(void *handle); - const char *(*get_datadir)(void *handle); -} plugin_callbacks; +#include "callbacks.h" #include "data.h" #include "plugin.h" diff --git a/templates/web/tibia-index.js b/templates/web/tibia-index.js index 6428f42..775c97e 100644 --- a/templates/web/tibia-index.js +++ b/templates/web/tibia-index.js @@ -31,4 +31,5 @@ module.exports = function (data, api) { api.generateFileFromTemplateFile(`src${sep}data.h`, `src${sep}data.h`, data); api.generateFileFromTemplateFile(`src${sep}processor.js`, `src${sep}processor.js`, data); api.generateFileFromTemplateFile(`src${sep}module.js`, `src${sep}module.js`, data); + api.copyFile(`..${sep}common${sep}callbacks.h`, `src${sep}callbacks.h`); };