Compare commits

..

2 Commits

Author SHA1 Message Date
Paolo Marrone
8ddf42ea33 output parameters work. UI needs to be synced to params 2025-03-03 15:26:14 +01:00
Paolo Marrone
2d66e616cd parameter via messages system. Input control ones work. Output ones not yet 2025-02-24 23:07:06 +01:00
17 changed files with 612 additions and 296 deletions

View File

@ -20,7 +20,7 @@ Feel free to try it out anyway and perhaps give us some feedback (we'd appreciat
## Legal ## Legal
Copyright (C) 2021-2025 Orastron Srl unipersonale. Copyright (C) 2021-2024 Orastron Srl unipersonale.
Authors: Stefano D'Angelo, Paolo Marrone. Authors: Stefano D'Angelo, Paolo Marrone.

View File

@ -50,19 +50,8 @@ KOTLIN_STDLIB_FILE := $(KOTLIN_DIR)/kotlin-stdlib-$(KOTLIN_STDLIB_VERSION).jar
KOTLINX_COROUTINES_CORE_FILE := $(KOTLIN_DIR)/kotlinx-coroutines-core-$(KOTLINX_COROUTINES_CORE_VERSION).jar KOTLINX_COROUTINES_CORE_FILE := $(KOTLIN_DIR)/kotlinx-coroutines-core-$(KOTLINX_COROUTINES_CORE_VERSION).jar
KOTLINX_COROUTINES_CORE_JVM_FILE := $(KOTLIN_DIR)/kotlinx-coroutines-core-jvm-$(KOTLINX_COROUTINES_CORE_JVM_VERSION).jar KOTLINX_COROUTINES_CORE_JVM_FILE := $(KOTLIN_DIR)/kotlinx-coroutines-core-jvm-$(KOTLINX_COROUTINES_CORE_JVM_VERSION).jar
ifeq ($(OS), Windows_NT) CC := $(NDK_DIR)/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi$(MIN_API)-clang
NDK_BIN_DIR ?= $(NDK_DIR)/toolchains/llvm/prebuilt/windows-x86_64/bin/ CXX := $(NDK_DIR)/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi$(MIN_API)-clang++
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Darwin)
NDK_BIN_DIR ?= $(NDK_DIR)/toolchains/llvm/prebuilt/darwin-x86_64/bin/
else
NDK_BIN_DIR ?= $(NDK_DIR)/toolchains/llvm/prebuilt/linux-x86_64/bin/
endif
endif
CC := $(NDK_BIN_DIR)/armv7a-linux-androideabi$(MIN_API)-clang
CXX := $(NDK_BIN_DIR)/armv7a-linux-androideabi$(MIN_API)-clang++
JC := javac JC := javac
APKSIGNER := $(BUILD_TOOLS_DIR)/apksigner APKSIGNER := $(BUILD_TOOLS_DIR)/apksigner

View File

@ -20,7 +20,6 @@
BUNDLE_NAME := {{=it.product.bundleName}} BUNDLE_NAME := {{=it.product.bundleName}}
JAVA_PACKAGE_NAME := {{=it.android.javaPackageName}} JAVA_PACKAGE_NAME := {{=it.android.javaPackageName}}
ANDROID_VERSION := {{=it.android.androidVersion}}
{{?(it.android_make?.commonDir || it.make?.commonDir)}} {{?(it.android_make?.commonDir || it.make?.commonDir)}}
COMMON_DIR := {{=it.android_make?.commonDir ?? (it.make?.commonDir ?? "")}} COMMON_DIR := {{=it.android_make?.commonDir ?? (it.make?.commonDir ?? "")}}

View File

@ -8,7 +8,7 @@
{{??}} {{??}}
<uses-sdk android:minSdkVersion="26" /> <!-- for androidx core and AAudio --> <uses-sdk android:minSdkVersion="26" /> <!-- for androidx core and AAudio -->
{{?}} {{?}}
<uses-sdk android:targetSdkVersion="{{=it.android.androidVersion}}" /> <uses-sdk android:targetSdkVersion="34" />
<application android:label="{{=it.product.name}}"> <application android:label="{{=it.product.name}}">
<activity android:name=".MainActivity" android:label="{{=it.product.name}}" android:exported="true"> <activity android:name=".MainActivity" android:label="{{=it.product.name}}" android:exported="true">
<intent-filter> <intent-filter>

View File

@ -38,8 +38,8 @@ BUILD_DATA_DIR := build/$(BUNDLE_DIR)
ifeq ($(OS), Windows_NT) ifeq ($(OS), Windows_NT)
DLL_SUFFIX := .dll DLL_SUFFIX := .dll
UI_TYPE := WindowsUI UI_TYPE := WindowsUI
LV2DIR := $(subst \,/,$(COMMONPROGRAMFILES))/LV2 LV2DIR := $(shell echo '$(COMMONPROGRAMFILES)' | sed 's:\\:/:g')/LV2
LV2DIR_USER := $(subst \,/,$(APPDATA))/LV2 LV2DIR_USER := $(shell echo '$(APPDATA)' | sed 's:\\:/:g')/LV2
CC := gcc CC := gcc
CXX := g++ CXX := g++
else else
@ -62,7 +62,7 @@ else
endif endif
endif endif
CFLAGS := -O3 -Wall -Wpedantic -Wextra CFLAGS := -O0 -g -Wall -Wpedantic -Wextra
CFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) -I$(API_DIR) $(shell pkg-config --cflags lv2) -fPIC $(CFLAGS_EXTRA) $(CFLAGS) CFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) -I$(API_DIR) $(shell pkg-config --cflags lv2) -fPIC $(CFLAGS_EXTRA) $(CFLAGS)
LDFLAGS := LDFLAGS :=
@ -123,8 +123,6 @@ strip: $(STRIP_PREREQS)
#rdfproc lv2_store parse build/$(BUNDLE_DIR)/manifest.ttl turtle || (rm lv2_store* && exit 1) #rdfproc lv2_store parse build/$(BUNDLE_DIR)/manifest.ttl turtle || (rm lv2_store* && exit 1)
#rdfproc lv2_store serialize ntriples > build/$(BUNDLE_DIR)/manifest.ttl || (rm lv2_store* && exit 1) #rdfproc lv2_store serialize ntriples > build/$(BUNDLE_DIR)/manifest.ttl || (rm lv2_store* && exit 1)
#rm lv2_store* #rm lv2_store*
#f=`cat build/$(BUNDLE_DIR)/manifest.ttl` && echo "$f" | sed '/^[[:space:]]**$/d' > build/$(BUNDLE_DIR)/manifest.ttl
f=`sed '/^[[:space:]]*$$/d' build/$(BUNDLE_DIR)/manifest.ttl` && echo "$$f" > build/$(BUNDLE_DIR)/manifest.ttl
install: all install: all
@for d in `find build/$(BUNDLE_DIR) -type d`; do \ @for d in `find build/$(BUNDLE_DIR) -type d`; do \

View File

@ -36,6 +36,15 @@
{{?(it.product.state && it.product.state.dspCustom)}} {{?(it.product.state && it.product.state.dspCustom)}}
lv2:extensionData state:interface ; lv2:extensionData state:interface ;
{{?}} {{?}}
{{~it.tibia.lv2.parameters:p:i}}
{{?p.direction == "input"}}
patch:writable plugin:{{=p.id}};
{{??}}
patch:readable plugin:{{=p.id}};
{{?}}
{{~}}
lv2:port [ lv2:port [
{{~it.tibia.lv2.ports :p:i}} {{~it.tibia.lv2.ports :p:i}}
{{?p.isBypass}} {{?p.isBypass}}
@ -68,6 +77,22 @@
lv2:portProperty lv2:connectionOptional ; lv2:portProperty lv2:connectionOptional ;
lv2:portProperty lv2:integer ; lv2:portProperty lv2:integer ;
lv2:portProperty lv2:reportsLatency ; lv2:portProperty lv2:reportsLatency ;
{{??p.isInputParameterMessage}}
a lv2:InputPort ,
atom:AtomPort ;
atom:bufferType atom:Sequence ;
atom:supports patch:Message ;
lv2:designation lv2:control ;
lv2:symbol "InputParameterMessage" ;
lv2:name "InputParameterMessage" ;
{{??p.isOutputParameterMessage}}
a lv2:OutputPort ,
atom:AtomPort ;
atom:bufferType atom:Sequence ;
atom:supports patch:Message ;
lv2:designation lv2:control ;
lv2:symbol "OutputParameterMessage" ;
lv2:name "OutputParameterMessage" ;
{{??}} {{??}}
a {{?p.type == "control"}}lv2:ControlPort{{??p.type == "midi"}}atom:AtomPort{{??}}{{?p.cv}}lv2:CVPort{{??}}lv2:AudioPort{{?}}{{?}} , a {{?p.type == "control"}}lv2:ControlPort{{??p.type == "midi"}}atom:AtomPort{{??}}{{?p.cv}}lv2:CVPort{{??}}lv2:AudioPort{{?}}{{?}} ,
{{?p.direction == "input"}}lv2:InputPort{{??}}lv2:OutputPort{{?}} ; {{?p.direction == "input"}}lv2:InputPort{{??}}lv2:OutputPort{{?}} ;
@ -129,6 +154,20 @@
{{?}} {{?}}
{{~}} {{~}}
{{~it.tibia.lv2.parameters:p:i}}
plugin:{{=p.id}}
a lv2:Parameter ;
rdfs:label "{{=p.name}}" ;
rdfs:range {{?p.toggled}}atom:Bool{{??p.integer}}atom:Int{{??}}atom:Float{{?}} ;
{{?p.unit && p.unit in it.tibia.lv2.units}}
units:unit {{=it.tibia.lv2.ttlURI(it.tibia.lv2.units[p.unit])}} ;
{{?}}
lv2:minimum {{=p.minimum.toExponential()}} ;
lv2:maximum {{=p.maximum.toExponential()}} ;
lv2:default {{=p.defaultValue.toExponential()}} .
{{~}}
{{?it.product.ui}} {{?it.product.ui}}
plugin:ui plugin:ui
a ui:@UI_TYPE@ ; a ui:@UI_TYPE@ ;

View File

@ -37,12 +37,56 @@ static uint32_t midi_in_index[DATA_PRODUCT_MIDI_INPUTS_N] = {
}; };
#endif #endif
#if DATA_PRODUCT_CONTROL_INPUTS_N > 0
# define DATA_PARAM_BYPASS 1 # define DATA_PARAM_BYPASS 1
# define DATA_PARAM_TOGGLED (1<<1) # define DATA_PARAM_TOGGLED (1<<1)
# define DATA_PARAM_INTEGER (1<<2) # define DATA_PARAM_INTEGER (1<<2)
{{?it.lv2.use_parameters}}
#define DATA_PRODUCT_USE_PARAMETERS 1
{{?it.tibia.lv2.ports.find(p => p.isInputParameterMessage)}}
#define DATA_PRODUCT_IPM {{=it.tibia.lv2.ports.indexOf(it.tibia.lv2.ports.find(p => p.isInputParameterMessage))}}
{{?}}
{{?it.tibia.lv2.ports.find(p => p.isOutputParameterMessage)}}
#define DATA_PRODUCT_OPM {{=it.tibia.lv2.ports.indexOf(it.tibia.lv2.ports.find(p => p.isOutputParameterMessage))}}
{{?}}
#if DATA_PRODUCT_CONTROL_INPUTS_N + DATA_PRODUCT_CONTROL_OUTPUTS_N > 0
static struct {
uint32_t index;
float min;
float max;
float def;
uint32_t flags;
const char *id;
} param_data[DATA_PRODUCT_CONTROL_INPUTS_N + DATA_PRODUCT_CONTROL_OUTPUTS_N] = {
{{~it.tibia.lv2.parameters :p}}
{
/* .index = */ {{=p.paramIndex}},
/* .min = */ {{=p.minimum.toExponential()}}f,
/* .max = */ {{=p.maximum.toExponential()}}f,
/* .def = */ {{=p.defaultValue.toExponential()}}f,
/* .flags = */ {{?p.isBypass}}DATA_PARAM_BYPASS{{??p.isLatency}}DATA_PARAM_INTEGER{{??}}0{{?p.toggled}} | DATA_PARAM_TOGGLED{{?}}{{?p.integer}} | DATA_PARAM_INTEGER{{?}}{{?}},
/* .id = */ DATA_LV2_URI"#{{=p.id}}"
},
{{~}}
};
#endif
#if DATA_PRODUCT_CONTROL_OUTPUTS_N > 0
static uint32_t param_out_index[DATA_PRODUCT_CONTROL_OUTPUTS_N] = {
{{~it.tibia.lv2.parameters.filter(x => x.direction == "output") :p}}{{=p.paramIndex}}, {{~}}
};
#endif
{{??}}
#if DATA_PRODUCT_CONTROL_INPUTS_N > 0
static struct { static struct {
uint32_t index; uint32_t index;
float min; float min;
@ -69,6 +113,8 @@ static uint32_t param_out_index[DATA_PRODUCT_CONTROL_OUTPUTS_N] = {
}; };
#endif #endif
{{?}}
{{?it.product.ui}} {{?it.product.ui}}
#define DATA_UI #define DATA_UI
#define DATA_LV2_UI_URI "{{=it.tibia.CGetUTF8StringLiteral(it.tibia.lv2.expandURI(it.lv2.uri + '#ui'))}}" #define DATA_LV2_UI_URI "{{=it.tibia.CGetUTF8StringLiteral(it.tibia.lv2.expandURI(it.lv2.uri + '#ui'))}}"

View File

@ -49,6 +49,10 @@
#ifdef DATA_STATE_DSP_CUSTOM #ifdef DATA_STATE_DSP_CUSTOM
# include <lv2/state/state.h> # include <lv2/state/state.h>
#endif #endif
#if DATA_PRODUCT_USE_PARAMETERS
# include "lv2/lv2plug.in/ns/ext/patch/patch.h"
# include <lv2/lv2plug.in/ns/ext/atom/forge.h>
#endif
#include <string.h> #include <string.h>
@ -93,7 +97,6 @@ static float adjust_param(size_t index, float value) {
typedef struct { typedef struct {
plugin p; plugin p;
float sample_rate;
#if DATA_PRODUCT_AUDIO_INPUT_CHANNELS_N > 0 #if DATA_PRODUCT_AUDIO_INPUT_CHANNELS_N > 0
const float * x[DATA_PRODUCT_AUDIO_INPUT_CHANNELS_N]; const float * x[DATA_PRODUCT_AUDIO_INPUT_CHANNELS_N];
#endif #endif
@ -106,9 +109,6 @@ typedef struct {
#if DATA_PRODUCT_MIDI_OUTPUTS_N > 0 #if DATA_PRODUCT_MIDI_OUTPUTS_N > 0
LV2_Atom_Sequence * y_midi[DATA_PRODUCT_MIDI_OUTPUTS_N]; LV2_Atom_Sequence * y_midi[DATA_PRODUCT_MIDI_OUTPUTS_N];
#endif #endif
#if (DATA_PRODUCT_CONTROL_INPUTS_N + DATA_PRODUCT_CONTROL_OUTPUTS_N) > 0
float * c[DATA_PRODUCT_CONTROL_INPUTS_N + DATA_PRODUCT_CONTROL_OUTPUTS_N];
#endif
#if DATA_PRODUCT_CONTROL_INPUTS_N > 0 #if DATA_PRODUCT_CONTROL_INPUTS_N > 0
float params[DATA_PRODUCT_CONTROL_INPUTS_N]; float params[DATA_PRODUCT_CONTROL_INPUTS_N];
# ifdef DATA_STATE_DSP_CUSTOM # ifdef DATA_STATE_DSP_CUSTOM
@ -132,6 +132,30 @@ typedef struct {
LV2_State_Store_Function state_store; LV2_State_Store_Function state_store;
LV2_State_Handle state_handle; LV2_State_Handle state_handle;
#endif #endif
#if (DATA_PRODUCT_CONTROL_INPUTS_N + DATA_PRODUCT_CONTROL_OUTPUTS_N) > 0
# if DATA_PRODUCT_USE_PARAMETERS
LV2_URID uri_atom_Blank;
LV2_URID uri_atom_Object;
LV2_URID uri_atom_URID;
LV2_URID uri_atom_Float;
LV2_URID uri_atom_Bool;
LV2_URID uri_patch_Set;
LV2_URID uri_patch_Get;
LV2_URID uri_patch_property;
LV2_URID uri_patch_value;
LV2_URID uri_parameters[DATA_PRODUCT_CONTROL_INPUTS_N + DATA_PRODUCT_CONTROL_OUTPUTS_N]; // TODO: Fix 0 params case
# if DATA_PRODUCT_IPM
const LV2_Atom_Sequence *controlIn;
# endif
# if DATA_PRODUCT_OPM
const LV2_Atom_Sequence *controlOut;
LV2_Atom_Forge forge;
LV2_Atom_Float output_parameter_atoms[DATA_PRODUCT_CONTROL_OUTPUTS_N];
# endif
# else
float *c[DATA_PRODUCT_CONTROL_INPUTS_N + DATA_PRODUCT_CONTROL_OUTPUTS_N];
# endif
#endif
} plugin_instance; } plugin_instance;
static const char * get_bundle_path_cb(void *handle) { static const char * get_bundle_path_cb(void *handle) {
@ -213,8 +237,7 @@ static LV2_Handle instantiate(const struct LV2_Descriptor * descriptor, double s
}; };
plugin_init(&instance->p, &cbs); plugin_init(&instance->p, &cbs);
instance->sample_rate = (float)sample_rate; plugin_set_sample_rate(&instance->p, sample_rate);
plugin_set_sample_rate(&instance->p, instance->sample_rate);
size_t req = plugin_mem_req(&instance->p); size_t req = plugin_mem_req(&instance->p);
if (req != 0) { if (req != 0) {
instance->mem = malloc(req); instance->mem = malloc(req);
@ -243,8 +266,29 @@ static LV2_Handle instantiate(const struct LV2_Descriptor * descriptor, double s
instance->y_midi[i] = NULL; instance->y_midi[i] = NULL;
#endif #endif
#if (DATA_PRODUCT_CONTROL_INPUTS_N + DATA_PRODUCT_CONTROL_OUTPUTS_N) > 0 #if (DATA_PRODUCT_CONTROL_INPUTS_N + DATA_PRODUCT_CONTROL_OUTPUTS_N) > 0
# if DATA_PRODUCT_USE_PARAMETERS
instance->uri_atom_Blank = instance->map->map (instance->map->handle, LV2_ATOM__Blank);
instance->uri_atom_Object = instance->map->map (instance->map->handle, LV2_ATOM__Object);
instance->uri_atom_URID = instance->map->map (instance->map->handle, LV2_ATOM__URID);
instance->uri_atom_Float = instance->map->map (instance->map->handle, LV2_ATOM__Float);
instance->uri_atom_Bool = instance->map->map (instance->map->handle, LV2_ATOM__Bool);
instance->uri_patch_Set = instance->map->map (instance->map->handle, LV2_PATCH__Set);
instance->uri_patch_Get = instance->map->map (instance->map->handle, LV2_PATCH__Get);
instance->uri_patch_property = instance->map->map (instance->map->handle, LV2_PATCH__property);
instance->uri_patch_value = instance->map->map (instance->map->handle, LV2_PATCH__value);
for (int i = 0; i < DATA_PRODUCT_CONTROL_INPUTS_N + DATA_PRODUCT_CONTROL_OUTPUTS_N; i++) {
instance->uri_parameters[i] = instance->map->map (instance->map->handle, param_data[i].id);
}
lv2_atom_forge_init(&instance->forge, instance->map);
for (int aa = 0; aa < DATA_PRODUCT_CONTROL_OUTPUTS_N; aa++) {
instance->output_parameter_atoms[aa].atom.size = sizeof(float);
instance->output_parameter_atoms[aa].atom.type = instance->uri_atom_Float;
instance->output_parameter_atoms[aa].body = param_data[param_out_index[aa]].def;
}
# else
for (uint32_t i = 0; i < DATA_PRODUCT_CONTROL_INPUTS_N + DATA_PRODUCT_CONTROL_OUTPUTS_N; i++) for (uint32_t i = 0; i < DATA_PRODUCT_CONTROL_INPUTS_N + DATA_PRODUCT_CONTROL_OUTPUTS_N; i++)
instance->c[i] = NULL; instance->c[i] = NULL;
# endif
#endif #endif
return instance; return instance;
@ -262,6 +306,9 @@ err_instance:
} }
static void connect_port(LV2_Handle instance, uint32_t port, void * data_location) { static void connect_port(LV2_Handle instance, uint32_t port, void * data_location) {
#if DATA_PRODUCT_USE_PARAMETERS
const uint32_t port0 = port;
#endif
plugin_instance * i = (plugin_instance *)instance; plugin_instance * i = (plugin_instance *)instance;
#if DATA_PRODUCT_AUDIO_INPUT_CHANNELS_N > 0 #if DATA_PRODUCT_AUDIO_INPUT_CHANNELS_N > 0
if (port < DATA_PRODUCT_AUDIO_INPUT_CHANNELS_N) { if (port < DATA_PRODUCT_AUDIO_INPUT_CHANNELS_N) {
@ -291,8 +338,24 @@ static void connect_port(LV2_Handle instance, uint32_t port, void * data_locatio
} }
port -= DATA_PRODUCT_MIDI_OUTPUTS_N; port -= DATA_PRODUCT_MIDI_OUTPUTS_N;
#endif #endif
#if (DATA_PRODUCT_CONTROL_INPUTS_N + DATA_PRODUCT_CONTROL_OUTPUTS_N) > 0
#if DATA_PRODUCT_USE_PARAMETERS
# if DATA_PRODUCT_IPM
if (port0 == DATA_PRODUCT_IPM) {
i->controlIn = (const LV2_Atom_Sequence*) data_location;
return;
}
# endif
# if DATA_PRODUCT_OPM
if (port0 == DATA_PRODUCT_OPM) {
i->controlOut = (const LV2_Atom_Sequence*) data_location;
return;
}
# endif
#else
# if (DATA_PRODUCT_CONTROL_INPUTS_N + DATA_PRODUCT_CONTROL_OUTPUTS_N) > 0
i->c[port] = data_location; i->c[port] = data_location;
# endif
#endif #endif
} }
@ -300,7 +363,11 @@ static void activate(LV2_Handle instance) {
plugin_instance * i = (plugin_instance *)instance; plugin_instance * i = (plugin_instance *)instance;
#if DATA_PRODUCT_CONTROL_INPUTS_N > 0 #if DATA_PRODUCT_CONTROL_INPUTS_N > 0
for (uint32_t j = 0; j < DATA_PRODUCT_CONTROL_INPUTS_N; j++) { for (uint32_t j = 0; j < DATA_PRODUCT_CONTROL_INPUTS_N; j++) {
# if DATA_PRODUCT_USE_PARAMETERS
i->params[j] = param_data[j].def;
# else
i->params[j] = i->c[j] != NULL ? *i->c[j] : param_data[j].def; i->params[j] = i->c[j] != NULL ? *i->c[j] : param_data[j].def;
# endif
plugin_set_parameter(&i->p, param_data[j].index, i->params[j]); plugin_set_parameter(&i->p, param_data[j].index, i->params[j]);
} }
# ifdef DATA_STATE_DSP_CUSTOM # ifdef DATA_STATE_DSP_CUSTOM
@ -316,9 +383,32 @@ static void activate(LV2_Handle instance) {
plugin_reset(&i->p); plugin_reset(&i->p);
} }
#if DATA_PRODUCT_USE_PARAMETERS
static inline int getParamIndexByURI(plugin_instance *instance, LV2_URID uri) {
for (int i = 0; i < DATA_PRODUCT_CONTROL_INPUTS_N + DATA_PRODUCT_CONTROL_OUTPUTS_N; i++)
if (instance->uri_parameters[i] == uri)
return i;
return -1;
}
static LV2_State_Status write_param_to_forge(LV2_State_Handle handle, uint32_t key, const void *value, size_t size, uint32_t type) {
LV2_Atom_Forge* forge = (LV2_Atom_Forge*)handle;
if (!lv2_atom_forge_key(forge, key) || !lv2_atom_forge_atom(forge, size, type) || !lv2_atom_forge_write(forge, value, size))
return LV2_STATE_ERR_UNKNOWN;
return LV2_STATE_SUCCESS;
}
#endif
static void run(LV2_Handle instance, uint32_t sample_count) { static void run(LV2_Handle instance, uint32_t sample_count) {
plugin_instance * i = (plugin_instance *)instance; plugin_instance * i = (plugin_instance *)instance;
#if DATA_PRODUCT_USE_PARAMETERS
const uint32_t out_capacity = i->controlOut->atom.size;
lv2_atom_forge_set_buffer(&i->forge, (uint8_t*)i->controlOut, out_capacity);
LV2_Atom_Forge_Frame out_frame;
lv2_atom_forge_sequence_head(&i->forge, &out_frame, 0);
#endif
#if defined(__aarch64__) #if defined(__aarch64__)
uint64_t fpcr; uint64_t fpcr;
__asm__ __volatile__ ("mrs %0, fpcr" : "=r"(fpcr)); __asm__ __volatile__ ("mrs %0, fpcr" : "=r"(fpcr));
@ -354,23 +444,93 @@ static void run(LV2_Handle instance, uint32_t sample_count) {
} }
# endif # endif
# if DATA_PRODUCT_USE_PARAMETERS
if (i->controlIn && i->map) {
LV2_ATOM_SEQUENCE_FOREACH (i->controlIn, ev) {
if (ev->body.type != i->uri_atom_Object) {
continue;
}
const LV2_Atom_Object *obj = (LV2_Atom_Object*)&ev->body;
if (obj->body.otype == i->uri_patch_Set) {
const LV2_Atom* property = NULL;
lv2_atom_object_get (obj, i->uri_patch_property, &property, 0);
if (!property || property->type != i->uri_atom_URID)
continue;
const LV2_Atom* val = NULL;
lv2_atom_object_get (obj, i->uri_patch_value, &val, 0);
if (!val)
continue;
int index = getParamIndexByURI(i, ((LV2_Atom_URID*)property)->body);
if (index < 0)
continue;
float v = adjust_param(index, *((float*)(val + 1)));
if (v != i->params[index]) {
i->params[index] = v;
# ifdef DATA_STATE_DSP_CUSTOM
if (locked) {
i->params_sync[index] = i->params[index];
# endif
plugin_set_parameter(&i->p, param_data[index].index, v);
# ifdef DATA_STATE_DSP_CUSTOM
}
# endif
}
}
else if (obj->body.otype == i->uri_patch_Get) {
const LV2_Atom_URID *property = NULL;
lv2_atom_object_get(obj, i->uri_patch_property, (const LV2_Atom**)&property, 0);
if (!property || property->atom.type != i->uri_atom_URID)
continue;
const LV2_URID key = property->body;
const int index = getParamIndexByURI(i, key);
if (index < 0)
continue;
int outIndex = -1;
for (int p = 0; p < DATA_PRODUCT_CONTROL_OUTPUTS_N; p++) {
if (param_out_index[p] == (uint32_t) index)
outIndex = p;
}
if (outIndex == -1)
continue;
const LV2_Atom* value = &i->output_parameter_atoms[outIndex].atom;
LV2_Atom_Forge_Frame frame;
lv2_atom_forge_frame_time(&i->forge, ev->time.frames);
lv2_atom_forge_object( &i->forge, &frame, 0, i->uri_patch_Set);
lv2_atom_forge_key( &i->forge, i->uri_patch_property);
lv2_atom_forge_urid( &i->forge, property->body);
write_param_to_forge( &i->forge, i->uri_patch_value, value + 1, value->size, value->type);
lv2_atom_forge_pop( &i->forge, &frame);
}
}
}
# else
for (uint32_t j = 0; j < DATA_PRODUCT_CONTROL_INPUTS_N; j++) { for (uint32_t j = 0; j < DATA_PRODUCT_CONTROL_INPUTS_N; j++) {
if (i->c[j] == NULL) if (i->c[j] == NULL)
continue; continue;
float v = adjust_param(j, *i->c[j]); float v = adjust_param(j, *i->c[j]);
if (v != i->params[j]) { if (v != i->params[j]) {
i->params[j] = v; i->params[j] = v;
# ifdef DATA_STATE_DSP_CUSTOM # ifdef DATA_STATE_DSP_CUSTOM
if (locked) { if (locked) {
i->params_sync[j] = i->params[j]; i->params_sync[j] = i->params[j];
# endif # endif
plugin_set_parameter(&i->p, param_data[j].index, v); plugin_set_parameter(&i->p, param_data[j].index, v);
# ifdef DATA_STATE_DSP_CUSTOM # ifdef DATA_STATE_DSP_CUSTOM
} }
# endif # endif
} }
} }
# endif
# ifdef DATA_STATE_DSP_CUSTOM # ifdef DATA_STATE_DSP_CUSTOM
if (locked) if (locked)
atomic_flag_clear(&i->sync_lock_flag); atomic_flag_clear(&i->sync_lock_flag);
@ -406,11 +566,31 @@ static void run(LV2_Handle instance, uint32_t sample_count) {
plugin_process(&i->p, x, y, sample_count); plugin_process(&i->p, x, y, sample_count);
#if DATA_PRODUCT_CONTROL_OUTPUTS_N > 0 #if DATA_PRODUCT_CONTROL_OUTPUTS_N > 0
# if DATA_PRODUCT_USE_PARAMETERS
for (uint32_t j = 0; j < DATA_PRODUCT_CONTROL_OUTPUTS_N; j++) {
float v = plugin_get_parameter(&i->p, param_out_index[j]);
i->output_parameter_atoms[j].body = v;
lv2_atom_forge_frame_time(&i->forge, 0);
LV2_Atom_Forge_Frame frame;
lv2_atom_forge_object(&i->forge, &frame, 0, i->uri_patch_Set);
lv2_atom_forge_key( &i->forge, i->uri_patch_property);
lv2_atom_forge_urid( &i->forge, i->uri_parameters[param_out_index[j]]);
lv2_atom_forge_key( &i->forge, i->uri_patch_value);
lv2_atom_forge_float( &i->forge, i->output_parameter_atoms[j].body);
lv2_atom_forge_pop( &i->forge, &frame);
}
lv2_atom_forge_pop(&i->forge, &out_frame);
# else
for (uint32_t j = 0; j < DATA_PRODUCT_CONTROL_OUTPUTS_N; j++) { for (uint32_t j = 0; j < DATA_PRODUCT_CONTROL_OUTPUTS_N; j++) {
uint32_t k = param_out_index[j]; uint32_t k = param_out_index[j];
if (i->c[k] != NULL) if (i->c[k] != NULL)
*i->c[k] = plugin_get_parameter(&i->p, k); *i->c[k] = plugin_get_parameter(&i->p, k);
} }
# endif
#else #else
(void)plugin_get_parameter; (void)plugin_get_parameter;
#endif #endif
@ -421,6 +601,7 @@ static void run(LV2_Handle instance, uint32_t sample_count) {
_MM_SET_FLUSH_ZERO_MODE(flush_zero_mode); _MM_SET_FLUSH_ZERO_MODE(flush_zero_mode);
_MM_SET_DENORMALS_ZERO_MODE(denormals_zero_mode); _MM_SET_DENORMALS_ZERO_MODE(denormals_zero_mode);
#endif #endif
} }
static void cleanup(LV2_Handle instance) { static void cleanup(LV2_Handle instance) {
@ -453,7 +634,7 @@ static LV2_State_Status state_save(LV2_Handle instance, LV2_State_Store_Function
/* .set_parameter = */ NULL /* .set_parameter = */ NULL
# endif # endif
}; };
return plugin_state_save(&i->p, &cbs, i->sample_rate) == 0 ? LV2_STATE_SUCCESS : LV2_STATE_ERR_UNKNOWN; return plugin_state_save(&i->p, &cbs) == 0 ? LV2_STATE_SUCCESS : LV2_STATE_ERR_UNKNOWN;
} }
static LV2_State_Status state_restore(LV2_Handle instance, LV2_State_Retrieve_Function retrieve, LV2_State_Handle handle, uint32_t flags, const LV2_Feature * const * features) { static LV2_State_Status state_restore(LV2_Handle instance, LV2_State_Retrieve_Function retrieve, LV2_State_Handle handle, uint32_t flags, const LV2_Feature * const * features) {
@ -481,7 +662,7 @@ static LV2_State_Status state_restore(LV2_Handle instance, LV2_State_Retrieve_Fu
/* .set_parameter = */ state_set_parameter_cb /* .set_parameter = */ state_set_parameter_cb
# endif # endif
}; };
return plugin_state_load(&cbs, i->sample_rate, data, length) == 0 ? LV2_STATE_SUCCESS : LV2_STATE_ERR_UNKNOWN; return plugin_state_load(&cbs, data, length) == 0 ? LV2_STATE_SUCCESS : LV2_STATE_ERR_UNKNOWN;
} }
static const void * extension_data(const char * uri) { static const void * extension_data(const char * uri) {

View File

@ -37,7 +37,8 @@ module.exports = function (data, api, outputCommon, outputData) {
{ id: "state", uri: "http://lv2plug.in/ns/extensions/state#" }, { id: "state", uri: "http://lv2plug.in/ns/extensions/state#" },
{ id: "ui", uri: "http://lv2plug.in/ns/extensions/ui#" }, { id: "ui", uri: "http://lv2plug.in/ns/extensions/ui#" },
{ id: "units", uri: "http://lv2plug.in/ns/extensions/units#" }, { id: "units", uri: "http://lv2plug.in/ns/extensions/units#" },
{ id: "urid", uri: "http://lv2plug.in/ns/ext/urid#" } { id: "urid", uri: "http://lv2plug.in/ns/ext/urid#" },
{ id: "patch", uri: "http://lv2plug.in/ns/ext/patch#"}
], ],
units: { units: {
"bar": "@units:bar", "bar": "@units:bar",
@ -115,16 +116,38 @@ module.exports = function (data, api, outputCommon, outputData) {
data.tibia.lv2.ports.push.apply(data.tibia.lv2.ports, audioPorts); data.tibia.lv2.ports.push.apply(data.tibia.lv2.ports, audioPorts);
data.tibia.lv2.ports.push.apply(data.tibia.lv2.ports, midiPorts); data.tibia.lv2.ports.push.apply(data.tibia.lv2.ports, midiPorts);
var ports = []; if (data.lv2.use_parameters) {
for (var i = 0; i < data.product.parameters.length; i++) { let parameters = [];
var p = data.product.parameters[i]; for (var i = 0; i < data.product.parameters.length; i++) {
var e = Object.create(p); let e = Object.create(data.product.parameters[i]);
e.type = "control"; e.paramIndex = i;
e.paramIndex = i; parameters.push(e);
ports.push(e); }
data.tibia.lv2.parameters = parameters;
if (data.product.parameters.find(p => p.direction == "input")) {
data.tibia.lv2.ports.push({
isInputParameterMessage: true
});
}
if (data.product.parameters.find(p => p.direction == "output")) {
data.tibia.lv2.ports.push({
isOutputParameterMessage: true
});
}
}
else {
var ports = [];
for (var i = 0; i < data.product.parameters.length; i++) {
var p = data.product.parameters[i];
var e = Object.create(p);
e.type = "control";
e.paramIndex = i;
ports.push(e);
}
ports.sort((a, b) => a.direction != b.direction ? (a.direction == "input" ? -1 : 1) : 0);
data.tibia.lv2.ports.push.apply(data.tibia.lv2.ports, ports);
} }
ports.sort((a, b) => a.direction != b.direction ? (a.direction == "input" ? -1 : 1) : 0);
data.tibia.lv2.ports.push.apply(data.tibia.lv2.ports, ports);
} }
api.generateFileFromTemplateFile(`data${sep}manifest.ttl.in`, `data${sep}manifest.ttl.in`, data); api.generateFileFromTemplateFile(`data${sep}manifest.ttl.in`, `data${sep}manifest.ttl.in`, data);

View File

@ -31,33 +31,12 @@ MKINC_DIR ?= $(COMMON_DIR)
BUNDLE_DIR := $(BUNDLE_NAME).vst3 BUNDLE_DIR := $(BUNDLE_NAME).vst3
ifeq ($(OS), Windows_NT) ifeq ($(OS), Windows_NT)
DLL_SUFFIX := .vst3 VST3_PLATFORM := x86_64-win
VST3DIR := $(subst \,/,$(COMMONPROGRAMFILES))/VST3
VST3DIR_USER := $(subst \,/,$(LOCALAPPDATA))/Programs/Common/VST3
CC := gcc
CXX := g++
MACHINE := $(shell $(CC) -dumpmachine | sed 's:-.*::g')
ifeq ($(MACHINE), x86_64)
VST3_PLATFORM := x86_64-win
endif
ifeq ($(MACHINE), aarch64)
VST3_PLATFORM := arm64-win
endif
else else
UNAME_S := $(shell uname -s) UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Darwin) ifeq ($(UNAME_S), Darwin)
DLL_SUFFIX :=
VST3DIR := /Library/Audio/Plug-Ins/VST3
VST3DIR_USER := $(HOME)/Library/Audio/Plug-Ins/VST3
CC := clang
CXX := clang++
VST3_PLATFORM := MacOS VST3_PLATFORM := MacOS
else else
DLL_SUFFIX := .so
VST3DIR := /usr/local/lib/vst3
VST3DIR_USER := $(HOME)/.vst3
CC := gcc
CXX := g++
VST3_PLATFORM := $(shell uname -m)-linux VST3_PLATFORM := $(shell uname -m)-linux
endif endif
endif endif
@ -68,6 +47,29 @@ BUILD_DATA_DIR := build/$(BUNDLE_DIR)/Contents/Resources
-include $(MKINC_DIR)/vars-pre.mk -include $(MKINC_DIR)/vars-pre.mk
ifeq ($(OS), Windows_NT)
DLL_SUFFIX := .vst3
VST3DIR := $(shell echo '$(COMMONPROGRAMFILES)' | sed 's:\\:/:g')/VST3
VST3DIR_USER := $(shell echo '$(LOCALAPPDATA)' | sed 's:\\:/:g')/Programs/Common/VST3
CC := gcc
CXX := g++
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Darwin)
DLL_SUFFIX :=
VST3DIR := /Library/Audio/Plug-Ins/VST3
VST3DIR_USER := $(HOME)/Library/Audio/Plug-Ins/VST3
CC := clang
CXX := clang++
else
DLL_SUFFIX := .so
VST3DIR := /usr/local/lib/vst3
VST3DIR_USER := $(HOME)/.vst3
CC := gcc
CXX := g++
endif
endif
CFLAGS := -O3 -Wall -Wpedantic -Wextra CFLAGS := -O3 -Wall -Wpedantic -Wextra
CFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) -I$(API_DIR) -fPIC $(CFLAGS_EXTRA) $(CFLAGS) CFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) -I$(API_DIR) -fPIC $(CFLAGS_EXTRA) $(CFLAGS)

View File

@ -271,9 +271,7 @@ typedef struct pluginInstance {
Steinberg_uint32 refs; Steinberg_uint32 refs;
Steinberg_FUnknown * context; Steinberg_FUnknown * context;
plugin p; plugin p;
float lastSampleRate; float sampleRate;
float curSampleRate;
float nextSampleRate;
#if DATA_PRODUCT_PARAMETERS_IN_N > 0 #if DATA_PRODUCT_PARAMETERS_IN_N > 0
float parametersIn[DATA_PRODUCT_PARAMETERS_IN_N]; float parametersIn[DATA_PRODUCT_PARAMETERS_IN_N];
float parametersInSync[DATA_PRODUCT_PARAMETERS_IN_N]; float parametersInSync[DATA_PRODUCT_PARAMETERS_IN_N];
@ -414,9 +412,6 @@ static Steinberg_tresult pluginInitialize(void *thisInterface, struct Steinberg_
if (p->context != NULL) if (p->context != NULL)
return Steinberg_kResultFalse; return Steinberg_kResultFalse;
p->context = context; p->context = context;
p->lastSampleRate = 0.f;
p->curSampleRate = 0.f;
p->nextSampleRate = 0.f;
plugin_callbacks cbs = { plugin_callbacks cbs = {
/* .handle = */ (void *)p, /* .handle = */ (void *)p,
@ -633,7 +628,7 @@ static Steinberg_tresult pluginSetActive(void* thisInterface, Steinberg_TBool st
p->neededBusesActive = 0; p->neededBusesActive = 0;
# endif # endif
#endif #endif
plugin_set_sample_rate(&p->p, p->nextSampleRate); plugin_set_sample_rate(&p->p, p->sampleRate);
size_t req = plugin_mem_req(&p->p); size_t req = plugin_mem_req(&p->p);
if (req != 0) { if (req != 0) {
p->mem = malloc(req); p->mem = malloc(req);
@ -641,11 +636,8 @@ static Steinberg_tresult pluginSetActive(void* thisInterface, Steinberg_TBool st
return Steinberg_kOutOfMemory; return Steinberg_kOutOfMemory;
plugin_mem_set(&p->p, p->mem); plugin_mem_set(&p->p, p->mem);
} }
p->curSampleRate = p->nextSampleRate;
p->lastSampleRate = p->nextSampleRate;
plugin_reset(&p->p); plugin_reset(&p->p);
} else }
p->curSampleRate = 0.f;
return Steinberg_kResultOk; return Steinberg_kResultOk;
} }
@ -675,7 +667,7 @@ static Steinberg_tresult pluginSetState(void* thisInterface, struct Steinberg_IB
/* .set_parameter = */ pluginStateSetParameterCb /* .set_parameter = */ pluginStateSetParameterCb
# endif # endif
}; };
int err = plugin_state_load(&cbs, p->curSampleRate, data, length); int err = plugin_state_load(&cbs, data, length);
#else #else
// we need to provide a default implementation because of certain hosts (e.g. Ardour) // we need to provide a default implementation because of certain hosts (e.g. Ardour)
int err = 0; int err = 0;
@ -709,7 +701,7 @@ static Steinberg_tresult pluginSetState(void* thisInterface, struct Steinberg_IB
if (data) if (data)
free(data); free(data);
TRACE(err == 0 ? " ok\n" : " err\n"); TRACE(err == 0 ? " ok" : " err");
return err == 0 ? Steinberg_kResultOk : Steinberg_kResultFalse; return err == 0 ? Steinberg_kResultOk : Steinberg_kResultFalse;
} }
@ -731,7 +723,7 @@ static Steinberg_tresult pluginGetState(void* thisInterface, struct Steinberg_IB
/* .set_parameter = */ NULL /* .set_parameter = */ NULL
# endif # endif
}; };
int err = plugin_state_save(&p->p, &cbs, p->lastSampleRate); int err = plugin_state_save(&p->p, &cbs);
#else #else
// we need to provide a default implementation because of certain hosts (e.g. Ardour) // we need to provide a default implementation because of certain hosts (e.g. Ardour)
int err = 0; int err = 0;
@ -863,7 +855,7 @@ static Steinberg_uint32 pluginGetLatencySamples(void* thisInterface) {
static Steinberg_tresult pluginSetupProcessing(void* thisInterface, struct Steinberg_Vst_ProcessSetup* setup) { static Steinberg_tresult pluginSetupProcessing(void* thisInterface, struct Steinberg_Vst_ProcessSetup* setup) {
TRACE("plugin IAudioProcessor setup processing\n"); TRACE("plugin IAudioProcessor setup processing\n");
pluginInstance *p = (pluginInstance *)((char *)thisInterface - offsetof(pluginInstance, vtblIAudioProcessor)); pluginInstance *p = (pluginInstance *)((char *)thisInterface - offsetof(pluginInstance, vtblIAudioProcessor));
p->nextSampleRate = (float)setup->sampleRate; p->sampleRate = (float)setup->sampleRate;
return Steinberg_kResultOk; return Steinberg_kResultOk;
} }
@ -1380,20 +1372,20 @@ static Steinberg_tresult plugViewIsPlatformTypeSupported(void* thisInterface, St
# if DATA_PRODUCT_PARAMETERS_N > 0 # if DATA_PRODUCT_PARAMETERS_N > 0
# if DATA_PRODUCT_PARAMETERS_IN_N > 0 # if DATA_PRODUCT_PARAMETERS_IN_N > 0
static void plugViewUpdateParameterIn(plugView *view, size_t index) { static void plugViewUpdateParameterIn(plugView *view, size_t index) {
if (view && view->ui) if (view->ui)
plugin_ui_set_parameter(view->ui, parameterInData[index].index, view->ctrl->parametersIn[index]); plugin_ui_set_parameter(view->ui, parameterInData[index].index, view->ctrl->parametersIn[index]);
} }
# endif # endif
# if DATA_PRODUCT_PARAMETERS_OUT_N > 0 # if DATA_PRODUCT_PARAMETERS_OUT_N > 0
static void plugViewUpdateParameterOut(plugView *view, size_t index) { static void plugViewUpdateParameterOut(plugView *view, size_t index) {
if (view && view->ui) if (view->ui)
plugin_ui_set_parameter(view->ui, parameterOutData[index].index, view->ctrl->parametersOut[index]); plugin_ui_set_parameter(view->ui, parameterOutData[index].index, view->ctrl->parametersOut[index]);
} }
# endif # endif
static void plugViewUpdateAllParameters(plugView *view) { static void plugViewUpdateAllParameters(plugView *view) {
if (view == NULL || view->ui == NULL) if (view->ui == NULL)
return; return;
# if DATA_PRODUCT_PARAMETERS_IN_N > 0 # if DATA_PRODUCT_PARAMETERS_IN_N > 0
for (size_t i = 0; i < DATA_PRODUCT_PARAMETERS_IN_N; i++) for (size_t i = 0; i < DATA_PRODUCT_PARAMETERS_IN_N; i++)
@ -1866,7 +1858,7 @@ static Steinberg_tresult controllerSetComponentState(void* thisInterface, struct
/* .set_parameter = */ controllerStateSetParameterCb /* .set_parameter = */ controllerStateSetParameterCb
# endif # endif
}; };
int err = plugin_state_load(&cbs, -1.f, data, length); // -1.f means "does not apply" int err = plugin_state_load(&cbs, data, length);
#else #else
// we need to provide a default implementation because of certain hosts (e.g. Reaper) // we need to provide a default implementation because of certain hosts (e.g. Reaper)
int err = 0; int err = 0;

View File

@ -1,6 +1,5 @@
{ {
"android": { "android": {
"javaPackageName": "com.example.tibia_test", "javaPackageName": "com.example.tibia_test"
"androidVersion": "36"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"ios_make": { "ios_make": {
"headerSearchPaths": [ "../../../../../miniaudio" ], "headerSearchPaths": [ "../../../../../miniaudio" ],
"deploymentTarget": "16.6" "deploymentTarget": 16.6
} }
} }

View File

@ -6,6 +6,8 @@
"uri": "@example:tibia_test", "uri": "@example:tibia_test",
"project": "@example:project", "project": "@example:project",
"types": [ "@lv2:AmplifierPlugin" ], "types": [ "@lv2:AmplifierPlugin" ],
"version": "1.0" "version": "1.0",
"use_parameters": true
} }
} }

View File

@ -138,8 +138,7 @@ static float parse_float(const uint8_t *data) {
return v.f; return v.f;
} }
static int plugin_state_save(plugin *instance, const plugin_state_callbacks *cbs, float last_sample_rate) { static int plugin_state_save(plugin *instance, const plugin_state_callbacks *cbs) {
(void)last_sample_rate;
uint8_t data[13]; uint8_t data[13];
cbs->lock(cbs->handle); cbs->lock(cbs->handle);
const float gain = instance->gain; const float gain = instance->gain;
@ -160,8 +159,7 @@ static char x_isnan(float x) {
return ((v.u & 0x7f800000) == 0x7f800000) && (v.u & 0x7fffff); return ((v.u & 0x7f800000) == 0x7f800000) && (v.u & 0x7fffff);
} }
static int plugin_state_load(const plugin_state_callbacks *cbs, float cur_sample_rate, const char *data, size_t length) { static int plugin_state_load(const plugin_state_callbacks *cbs, const char *data, size_t length) {
(void)cur_sample_rate;
if (length != 13) if (length != 13)
return -1; return -1;
const uint8_t *d = (const uint8_t *)data; const uint8_t *d = (const uint8_t *)data;

View File

@ -1,7 +1,7 @@
/* /*
* Tibia * Tibia
* *
* Copyright (C) 2024, 2025 Orastron Srl unipersonale * Copyright (C) 2024 Orastron Srl unipersonale
* *
* Tibia is free software: you can redistribute it and/or modify * Tibia is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -18,230 +18,303 @@
* File author: Stefano D'Angelo, Paolo Marrone * File author: Stefano D'Angelo, Paolo Marrone
*/ */
#include "vinci.h" #include <pugl/pugl.h>
#include <stdio.h> #include <pugl/cairo.h>
#include <string.h> #include <cairo.h>
typedef struct { typedef struct {
void *widget; void * widget;
PuglWorld * world;
PuglView * view;
vinci *vinci; double fw;
window *window; double fh;
int param_down; double x;
double y;
double w;
double h;
float gain; float gain;
float delay; float delay;
float cutoff; float cutoff;
char bypass; char bypass;
float y_z1; float y_z1;
int param_down;
plugin_ui_callbacks cbs; plugin_ui_callbacks cbs;
} plugin_ui; } plugin_ui;
#define WIDTH 600.0 #define WIDTH 600.0
#define HEIGHT 400.0 #define HEIGHT 400.0
#define RATIO (WIDTH / HEIGHT)
#define INV_RATIO (HEIGHT / WIDTH)
static void plugin_ui_get_default_size(uint32_t *width, uint32_t *height) { static void plugin_ui_get_default_size(uint32_t *width, uint32_t *height) {
*width = WIDTH; *width = WIDTH;
*height = HEIGHT; *height = HEIGHT;
} }
static void draw_rect(window *w, uint32_t x, uint32_t y, uint32_t width, uint32_t height, uint32_t color) { static void plugin_ui_update_geometry(plugin_ui *instance) {
uint32_t *data = (uint32_t*) malloc(width * height * 4); PuglRect frame = puglGetFrame(instance->view);
uint32_t p = 0; instance->fw = frame.width;
for (uint32_t i = 0; i < height; i++) instance->fh = frame.height;
for (uint32_t j = 0; j < width; j++, p++) if (frame.width == 0 || frame.height == 0)
data[p] = color; return;
window_draw(w, (unsigned char*)data, 0, 0, width, height, x, y, width, height);
free(data);
}
static void draw_slider(plugin_ui *pui, int id, float value) { if (instance->fw / instance->fh > RATIO) {
const int w = window_get_width(pui->window); instance->w = RATIO * instance->fh;
const int h = window_get_height(pui->window); instance->h = instance->fh;
draw_rect(pui->window, 0.1 * w, 0.15 * (id + 1) * h, 0.8 * w * value, 0.1 * h, 0x6789ab); instance->x = 0.5 * (instance->fw - instance->w);
draw_rect(pui->window, 0.1 * w + 0.8 * w * value, 0.15 * (id + 1) * h, 0.8 * w * (1.f - value), 0.1 * h, 0x1223bc); instance->y = 0.0;
} } else {
instance->w = instance->fw;
static void draw_button(plugin_ui *pui, int id, char value) { instance->h = INV_RATIO * instance->fw;
const int w = window_get_width(pui->window); instance->x = 0.0;
const int h = window_get_height(pui->window); instance->y = 0.5 * (instance->fh - instance->h);
draw_rect(pui->window, 0.4 * w, 0.15 * (id + 1) * h, 0.2 * w, 0.1 * h, value ? 0x6789ab : 0x1223bc);
}
static void on_close(window *w) {
printf("on_close %p \n", (void*)w); fflush(stdout);
}
static void on_mouse_press (window *win, int32_t x, int32_t y, uint32_t state) {
(void) state;
plugin_ui *pui = (plugin_ui*) window_get_data(win);
const int w = window_get_width(win);
const int h = window_get_height(win);
if (x >= 0.1 * w && x <= 0.9 * w && y >= 0.15 * h && y <= 0.25 * h) {
pui->param_down = 0;
pui->gain = (float)((x - (0.1 * w)) / (0.8 * w));
pui->cbs.set_parameter_begin(pui->cbs.handle, 0, -60.f + 80.f * pui->gain);
draw_slider(pui, 0, pui->gain);
} else if (x >= 0.1 * w && x <= 0.9 * w && y >= 0.3 * h && y <= 0.4 * h) {
pui->param_down = 1;
pui->delay = (float)((x - (0.1 * w)) / (0.8 * w));
pui->cbs.set_parameter_begin(pui->cbs.handle, 1, 1000.f * pui->delay);
draw_slider(pui, 1, pui->delay);
} else if (x >= 0.1 * w && x <= 0.9 * w && y >= 0.45 * h && y <= 0.55 * h) {
pui->param_down = 2;
pui->cutoff = (float)((x - (0.1 * w)) / (0.8 * w));
pui->cbs.set_parameter_begin(pui->cbs.handle, 2, (632.4555320336746f * pui->cutoff + 20.653108640674372f) / (1.0326554320337158f - pui->cutoff));
draw_slider(pui, 2, pui->cutoff);
} else if (x >= 0.4 * w && x <= 0.6 * w && y >= 0.6 * h && y <= 0.7 * h) {
pui->param_down = 4;
} }
} }
static void on_mouse_release (window *win, int32_t x, int32_t y, uint32_t state) { static void plugin_ui_draw(plugin_ui *instance) {
(void) state; cairo_t *cr = (cairo_t *)puglGetContext(instance->view);
double x = instance->x;
double y = instance->y;
double w = instance->w;
double h = instance->h;
plugin_ui *pui = (plugin_ui*) window_get_data(win); cairo_set_line_width(cr, 0.005 * h);
const int w = window_get_width(win);
const int h = window_get_height(win);
if (pui->param_down == 4) cairo_set_source_rgb(cr, 0, 0, 0);
if (x >= 0.4 * w && x <= 0.6 * w && y >= 0.6 * h && y <= 0.7 * h) { cairo_paint(cr);
pui->bypass = !pui->bypass;
pui->cbs.set_parameter(pui->cbs.handle, 3, pui->bypass ? 1.f : 0.f); cairo_set_source_rgb(cr, 0.2, 0.2, 0.2);
draw_button(pui, 3, pui->bypass); cairo_rectangle(cr, x, y, w, h);
cairo_fill(cr);
cairo_set_source_rgb(cr, 0.1, 0.1, 0.1);
cairo_rectangle(cr, x + 0.1 * w, y + 0.15 * h, 0.8 * w, 0.1 * h);
cairo_fill(cr);
cairo_set_source_rgb(cr, 0.5, 0.5, 0.5);
cairo_rectangle(cr, x + 0.1 * w, y + 0.15 * h, 0.8 * w * instance->gain, 0.1 * h);
cairo_fill(cr);
cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
cairo_rectangle(cr, x + 0.1 * w, y + 0.15 * h, 0.8 * w, 0.1 * h);
cairo_stroke(cr);
cairo_set_source_rgb(cr, 0.1, 0.1, 0.1);
cairo_rectangle(cr, x + 0.1 * w, y + 0.3 * h, 0.8 * w, 0.1 * h);
cairo_fill(cr);
cairo_set_source_rgb(cr, 0.5, 0.5, 0.5);
cairo_rectangle(cr, x + 0.1 * w, y + 0.3 * h, 0.8 * w * instance->delay, 0.1 * h);
cairo_fill(cr);
cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
cairo_rectangle(cr, x + 0.1 * w, y + 0.3 * h, 0.8 * w, 0.1 * h);
cairo_stroke(cr);
cairo_set_source_rgb(cr, 0.1, 0.1, 0.1);
cairo_rectangle(cr, x + 0.1 * w, y + 0.45 * h, 0.8 * w, 0.1 * h);
cairo_fill(cr);
cairo_set_source_rgb(cr, 0.5, 0.5, 0.5);
cairo_rectangle(cr, x + 0.1 * w, y + 0.45 * h, 0.8 * w * instance->cutoff, 0.1 * h);
cairo_fill(cr);
cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
cairo_rectangle(cr, x + 0.1 * w, y + 0.45 * h, 0.8 * w, 0.1 * h);
cairo_stroke(cr);
if (instance->bypass)
cairo_set_source_rgb(cr, 1.0, 0, 0);
else
cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
cairo_rectangle(cr, x + 0.4 * w, y + 0.6 * h, 0.2 * w, 0.1 * h);
cairo_fill(cr);
cairo_set_source_rgb(cr, 0.1, 0.1, 0.1);
cairo_rectangle(cr, x + 0.1 * w, y + 0.75 * h, 0.8 * w, 0.1 * h);
cairo_fill(cr);
cairo_set_source_rgb(cr, 0.5, 0.5, 0.5);
cairo_rectangle(cr, x + 0.1 * w, y + 0.75 * h, 0.8 * w * instance->y_z1, 0.1 * h);
cairo_fill(cr);
}
static PuglStatus plugin_ui_on_event(PuglView *view, const PuglEvent *event) {
switch (event->type) {
case PUGL_CONFIGURE:
{
plugin_ui *instance = (plugin_ui *)puglGetHandle(view);
plugin_ui_update_geometry(instance);
puglPostRedisplay(instance->view);
} }
break;
case PUGL_BUTTON_PRESS:
{
plugin_ui *instance = (plugin_ui *)puglGetHandle(view);
const PuglButtonEvent *ev = (const PuglButtonEvent *)event;
double x = instance->x;
double y = instance->y;
double w = instance->w;
double h = instance->h;
if (pui->param_down != -1) { if (ev->x >= x + 0.1 * w && ev->x <= x + 0.9 * w
float v = x < 0.1 * w ? 0.f : (x > 0.9 * w ? 1.f : (float)((x - (0.1 * w)) / (0.8 * w))); && ev->y >= y + 0.15 * h && ev->y <= y + 0.25 * h) {
switch (pui->param_down) { instance->param_down = 0;
case 0: instance->gain = (float)((ev->x - (x + 0.1 * w)) / (0.8 * w));
pui->gain = v; instance->cbs.set_parameter_begin(instance->cbs.handle, 0, -60.f + 80.f * instance->gain);
pui->cbs.set_parameter_end(pui->cbs.handle, 0, -60.f + 80.f * pui->gain); puglPostRedisplay(instance->view);
draw_slider(pui, 0, pui->gain); } else if (ev->x >= x + 0.1 * w && ev->x <= x + 0.9 * w
break; && ev->y >= y + 0.3 * h && ev->y <= y + 0.4 * h) {
case 1: instance->param_down = 1;
pui->delay = v; instance->delay = (float)((ev->x - (x + 0.1 * w)) / (0.8 * w));
pui->cbs.set_parameter_end(pui->cbs.handle, 1, 1000.f * pui->delay); instance->cbs.set_parameter_begin(instance->cbs.handle, 1, 1000.f * instance->delay);
draw_slider(pui, 1, pui->delay); puglPostRedisplay(instance->view);
break; } else if (ev->x >= x + 0.1 * w && ev->x <= x + 0.9 * w
case 2: && ev->y >= y + 0.45 * h && ev->y <= y + 0.55 * h) {
pui->cutoff = v; instance->param_down = 2;
pui->cbs.set_parameter_end(pui->cbs.handle, 2, (632.4555320336746f * pui->cutoff + 20.653108640674372f) / (1.0326554320337158f - pui->cutoff)); instance->cutoff = (float)((ev->x - (x + 0.1 * w)) / (0.8 * w));
draw_slider(pui, 2, pui->cutoff); instance->cbs.set_parameter_begin(instance->cbs.handle, 2, (632.4555320336746f * instance->cutoff + 20.653108640674372f) / (1.0326554320337158f - instance->cutoff));
break; puglPostRedisplay(instance->view);
} else if (ev->x >= x + 0.4 * w && ev->x <= x + 0.6 * w
&& ev->y >= y + 0.6 * h && ev->y <= y + 0.7 * h) {
instance->param_down = 3;
}
} }
pui->param_down = -1; break;
case PUGL_MOTION:
{
plugin_ui *instance = (plugin_ui *)puglGetHandle(view);
const PuglMotionEvent *ev = (const PuglMotionEvent *)event;
double x = instance->x;
double w = instance->w;
float v = ev->x < x + 0.1 * w ? 0.f : (ev->x > x + 0.9 * w ? 1.f : (float)((ev->x - (x + 0.1 * w)) / (0.8 * w)));
switch (instance->param_down) {
case 0:
instance->gain = v;
instance->cbs.set_parameter(instance->cbs.handle, 0, -60.f + 80.f * instance->gain);
puglPostRedisplay(instance->view);
break;
case 1:
instance->delay = v;
instance->cbs.set_parameter(instance->cbs.handle, 1, 1000.f * instance->delay);
puglPostRedisplay(instance->view);
break;
case 2:
instance->cutoff = v;
instance->cbs.set_parameter(instance->cbs.handle, 2, (632.4555320336746f * instance->cutoff + 20.653108640674372f) / (1.0326554320337158f - instance->cutoff));
puglPostRedisplay(instance->view);
break;
}
}
break;
case PUGL_BUTTON_RELEASE:
{
plugin_ui *instance = (plugin_ui *)puglGetHandle(view);
const PuglButtonEvent *ev = (const PuglButtonEvent *)event;
double x = instance->x;
double y = instance->y;
double w = instance->w;
double h = instance->h;
if (instance->param_down == 3)
if (ev->x >= x + 0.4 * w && ev->x <= x + 0.6 * w
&& ev->y >= y + 0.6 * h && ev->y <= y + 0.7 * h) {
instance->bypass = !instance->bypass;
instance->cbs.set_parameter(instance->cbs.handle, 3, instance->bypass ? 1.f : 0.f);
puglPostRedisplay(instance->view);
}
if (instance->param_down != -1) {
float v = ev->x < x + 0.1 * w ? 0.f : (ev->x > x + 0.9 * w ? 1.f : (float)((ev->x - (x + 0.1 * w)) / (0.8 * w)));
switch (instance->param_down) {
case 0:
instance->gain = v;
instance->cbs.set_parameter_end(instance->cbs.handle, 0, -60.f + 80.f * instance->gain);
puglPostRedisplay(instance->view);
break;
case 1:
instance->delay = v;
instance->cbs.set_parameter_end(instance->cbs.handle, 1, 1000.f * instance->delay);
puglPostRedisplay(instance->view);
break;
case 2:
instance->cutoff = v;
instance->cbs.set_parameter_end(instance->cbs.handle, 2, (632.4555320336746f * instance->cutoff + 20.653108640674372f) / (1.0326554320337158f - instance->cutoff));
puglPostRedisplay(instance->view);
break;
}
instance->param_down = -1;
}
}
break;
case PUGL_EXPOSE:
{
plugin_ui *instance = (plugin_ui *)puglGetHandle(view);
plugin_ui_update_geometry(instance); // I didn't expect this was needed here for X11 to work decently when resizing
plugin_ui_draw(instance);
}
break;
default:
break;
} }
} return PUGL_SUCCESS;
static void on_mouse_move (window *win, int32_t x, int32_t y, uint32_t state) {
(void) y;
(void) state;
plugin_ui *pui = (plugin_ui*) window_get_data(win);
const int w = window_get_width(win);
float v = x < 0.1 * w ? 0.f : (x > 0.9 * w ? 1.f : (float)((x - (0.1 * w)) / (0.8 * w)));
switch (pui->param_down) {
case 0:
pui->gain = v;
pui->cbs.set_parameter(pui->cbs.handle, 0, -60.f + 80.f * pui->gain);
draw_slider(pui, 0, pui->gain);
break;
case 1:
pui->delay = v;
pui->cbs.set_parameter(pui->cbs.handle, 1, 1000.f * pui->delay);
draw_slider(pui, 1, pui->delay);
break;
case 2:
pui->cutoff = v;
pui->cbs.set_parameter(pui->cbs.handle, 2, (632.4555320336746f * pui->cutoff + 20.653108640674372f) / (1.0326554320337158f - pui->cutoff));
draw_slider(pui, 2, pui->cutoff);
break;
}
}
static void on_window_resize (window *w, int32_t width, int32_t height) {
draw_rect(w, 0, 0, width, height, 0xff9999);
plugin_ui *pui = (plugin_ui*) window_get_data(w);
draw_slider(pui, 0, pui->gain);
draw_slider(pui, 1, pui->delay);
draw_slider(pui, 2, pui->cutoff);
draw_button(pui, 3, pui->bypass);
draw_slider(pui, 4, pui->y_z1);
} }
static plugin_ui *plugin_ui_create(char has_parent, void *parent, plugin_ui_callbacks *cbs) { static plugin_ui *plugin_ui_create(char has_parent, void *parent, plugin_ui_callbacks *cbs) {
plugin_ui *instance = malloc(sizeof(plugin_ui)); plugin_ui *instance = malloc(sizeof(plugin_ui));
if (instance == NULL) if (instance == NULL)
return NULL; return NULL;
struct window_cbs wcbs;
memset(&wcbs, 0, sizeof(window_cbs));
wcbs.on_window_close = on_close;
wcbs.on_mouse_press = on_mouse_press;
wcbs.on_mouse_release = on_mouse_release;
wcbs.on_mouse_move = on_mouse_move;
wcbs.on_window_resize = on_window_resize;
instance->param_down = -1; instance->param_down = -1;
instance->vinci = vinci_new(); instance->world = puglNewWorld(PUGL_MODULE, 0);
instance->window = window_new(instance->vinci, has_parent ? parent : NULL, WIDTH, HEIGHT, &wcbs); instance->view = puglNewView(instance->world);
instance->widget = window_get_handle(instance->window); puglSetSizeHint(instance->view, PUGL_DEFAULT_SIZE, WIDTH, HEIGHT);
window_set_data(instance->window, (void*) instance); puglSetViewHint(instance->view, PUGL_RESIZABLE, PUGL_TRUE);
window_show(instance->window); puglSetHandle(instance->view, instance);
puglSetBackend(instance->view, puglCairoBackend());
// just some valid values to allow drawing PuglRect frame = { 0, 0, WIDTH, HEIGHT };
instance->gain = 0.f; puglSetFrame(instance->view, frame);
instance->delay = 0.f; puglSetEventFunc(instance->view, plugin_ui_on_event);
instance->cutoff = 0.f; if (has_parent)
instance->bypass = 0; puglSetParentWindow(instance->view, (PuglNativeView)parent);
instance->y_z1 = 0.f; if (puglRealize(instance->view)) {
puglFreeView(instance->view);
on_window_resize(instance->window, window_get_width(instance->window), window_get_height(instance->window)); puglFreeWorld(instance->world);
return NULL;
}
instance->widget = (void *)puglGetNativeView(instance->view);
instance->cbs = *cbs; instance->cbs = *cbs;
puglSetFrame(instance->view, frame); // Intentionally duplicated because of ardour/lv2/mac strange event order call
puglShow(instance->view, PUGL_SHOW_RAISE); // Cocoa calls events at this so it's better this happens late
return instance; return instance;
} }
static void plugin_ui_free(plugin_ui *instance) { static void plugin_ui_free(plugin_ui *instance) {
window_free(instance->window); puglFreeView(instance->view);
vinci_destroy(instance->vinci); puglFreeWorld(instance->world);
free(instance); free(instance);
} }
static void plugin_ui_idle(plugin_ui *instance) { static void plugin_ui_idle(plugin_ui *instance) {
vinci_idle(instance->vinci); puglUpdate(instance->world, 0);
} }
static void plugin_ui_set_parameter(plugin_ui *instance, size_t index, float value) { static void plugin_ui_set_parameter(plugin_ui *instance, size_t index, float value) {
switch (index) { switch (index) {
case 0: case 0:
instance->gain = 0.0125f * value + 0.75f; instance->gain = 0.0125f * value + 0.75f;
draw_slider(instance, 0, instance->gain);
break; break;
case 1: case 1:
instance->delay = 0.001f * value; instance->delay = 0.001f * value;
draw_slider(instance, 1, instance->delay);
break; break;
case 2: case 2:
// (bad) approx log unmap // (bad) approx log unmap
instance->cutoff = (1.0326554320337176f * value - 20.65310864067435f) / (value + 632.4555320336754f); instance->cutoff = (1.0326554320337176f * value - 20.65310864067435f) / (value + 632.4555320336754f);
draw_slider(instance, 2, instance->cutoff);
break; break;
case 3: case 3:
instance->bypass = value >= 0.5f; instance->bypass = value >= 0.5f;
draw_button(instance, 3, instance->bypass);
break; break;
case 4: case 4:
instance->y_z1 = 0.5f * value + 0.5f; instance->y_z1 = 0.5f * value + 0.5f;
draw_slider(instance, 4, instance->y_z1);
break; break;
} }
puglPostRedisplay(instance->view);
} }

View File

@ -1,45 +1,19 @@
API_DIR := ../api API_DIR := ../api
VINCI_DIR := ../../../vinci
ifeq ($(TEMPLATE), cmd) ifeq ($(TEMPLATE), cmd)
TINYWAV_DIR := ../../../tinywav TINYWAV_DIR := ../../../tinywav
MIDI_PARSER_DIR := ../../../midi-parser MIDI_PARSER_DIR := ../../../midi-parser
endif endif
ifeq ($(TEMPLATE), lv2) ifeq ($(TEMPLATE), lv2)
ifeq ($(OS), Windows_NT) CFLAGS_EXTRA := $(shell pkg-config --cflags pugl-cairo-0 pugl-0 cairo)
C_SRCS_EXTRA := $(VINCI_DIR)/vinci-win32.c LDFLAGS_EXTRA := $(shell pkg-config --libs pugl-cairo-0 pugl-0 cairo) -Wl,-rpath,$(shell pkg-config --variable=libdir pugl-cairo-0),-rpath,$(shell pkg-config --variable=libdir pugl-0),-rpath,$(shell pkg-config --variable=libdir cairo)
LDFLAGS_EXTRA := -mwindows
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Darwin)
M_SRCS_EXTRA := $(VINCI_DIR)/vinci-cocoa.m
LDFLAGS_EXTRA := -framework Cocoa -lobjc
else
C_SRCS_EXTRA := $(VINCI_DIR)/vinci-xcb.c
LDFLAGS_EXTRA := -lxcb
endif
endif
CFLAGS_EXTRA := $(CFLAGS_EXTRA) -I${VINCI_DIR}
endif endif
ifeq ($(TEMPLATE), vst3) ifeq ($(TEMPLATE), vst3)
ifeq ($(OS), Windows_NT) RUTEX_DIR := ../../../rutex
C_SRCS_EXTRA := $(VINCI_DIR)/vinci-win32.c CFLAGS_EXTRA := -I../../../vst3_c_api $(shell pkg-config --cflags pugl-cairo-0)
LDFLAGS_EXTRA := -mwindows LDFLAGS_EXTRA := $(shell pkg-config --libs pugl-cairo-0 pugl-0 cairo) -Wl,-rpath,$(shell pkg-config --variable=libdir pugl-cairo-0),-rpath,$(shell pkg-config --variable=libdir pugl-0),-rpath,$(shell pkg-config --variable=libdir cairo)
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Darwin)
M_SRCS_EXTRA := $(VINCI_DIR)/vinci-cocoa.m
LDFLAGS_EXTRA := -framework Cocoa -lobjc
else
C_SRCS_EXTRA := $(VINCI_DIR)/vinci-xcb.c
LDFLAGS_EXTRA := -lxcb
endif
endif
CFLAGS_EXTRA := $(CFLAGS_EXTRA) -I../../../vst3_c_api
CFLAGS_EXTRA := $(CFLAGS_EXTRA) -I${VINCI_DIR}
endif endif
ifeq ($(TEMPLATE), daisy-seed) ifeq ($(TEMPLATE), daisy-seed)
@ -55,12 +29,13 @@ ifeq ($(TEMPLATE), android)
SDK_DIR := $(HOME)/Android/Sdk SDK_DIR := $(HOME)/Android/Sdk
ANDROIDX_DIR := $(HOME)/Android/androidx ANDROIDX_DIR := $(HOME)/Android/androidx
KOTLIN_DIR := $(HOME)/Android/kotlin KOTLIN_DIR := $(HOME)/Android/kotlin
NDK_VERSION := 28.0.13004108 NDK_VERSION := 28.0.12674087
BUILD_TOOLS_VERSION := 36.0.0 BUILD_TOOLS_VERSION := 35.0.0
ANDROIDX_CORE_VERSION := 1.16.0 ANDROID_VERSION := 35
ANDROIDX_CORE_VERSION := 1.15.0
ANDROIDX_LIFECYCLE_COMMON_VERSION := 2.8.7 ANDROIDX_LIFECYCLE_COMMON_VERSION := 2.8.7
ANDROIDX_VERSIONEDPARCELABLE_VERSION := 1.2.1 ANDROIDX_VERSIONEDPARCELABLE_VERSION := 1.2.1
KOTLIN_STDLIB_VERSION := 2.1.20 KOTLIN_STDLIB_VERSION := 2.1.10
KOTLINX_COROUTINES_CORE_VERSION := 1.10.2 KOTLINX_COROUTINES_CORE_VERSION := 1.10.1
KOTLINX_COROUTINES_CORE_JVM_VERSION := 1.10.2 KOTLINX_COROUTINES_CORE_JVM_VERSION := 1.10.1
endif endif