@@ -84,6 +84,7 @@ typedef unsigned int uint;
8484#include <lv2/uri-map/uri-map.h>
8585#include <lv2/worker/worker.h>
8686#include "lv2/control-input-port-change-request.h"
87+ #include "lv2/kxstudio-properties.h"
8788#include "lv2/lv2-hmi.h"
8889#include "lv2/mod-license.h"
8990
@@ -147,8 +148,6 @@ typedef struct {
147148
148149#define LILV_NS_MOD "http://moddevices.com/ns/mod#"
149150
150- #define KX_TIME__TicksPerBeat "http://kxstudio.sf.net/ns/lv2ext/props#TimePositionTicksPerBeat"
151-
152151// custom jack flag used for cv
153152// needed because we prefer jack2 which doesn't have metadata yet
154153#define JackPortIsControlVoltage 0x100
@@ -413,6 +412,7 @@ typedef struct EFFECT_T {
413412 int32_t control_index ; // control/event input
414413 int32_t enabled_index ;
415414 int32_t freewheel_index ;
415+ int32_t reset_index ;
416416 int32_t bpb_index ;
417417 int32_t bpm_index ;
418418 int32_t speed_index ;
@@ -504,6 +504,7 @@ typedef struct LILV_NODES_T {
504504 LilvNode * preset ;
505505 LilvNode * rawMIDIClockAccess ;
506506 LilvNode * rdfs_range ;
507+ LilvNode * reset ;
507508 LilvNode * sample_rate ;
508509 LilvNode * state_interface ;
509510 LilvNode * state_load_default_state ;
@@ -4149,6 +4150,7 @@ int effects_init(void* client)
41494150 effect -> control_index = -1 ;
41504151 effect -> enabled_index = -1 ;
41514152 effect -> freewheel_index = -1 ;
4153+ effect -> reset_index = -1 ;
41524154 effect -> bpb_index = -1 ;
41534155 effect -> bpm_index = -1 ;
41544156 effect -> speed_index = -1 ;
@@ -4255,6 +4257,7 @@ int effects_init(void* client)
42554257 g_lilv_nodes .preset = lilv_new_uri (g_lv2_data , LV2_PRESETS__Preset );
42564258 g_lilv_nodes .rawMIDIClockAccess = lilv_new_uri (g_lv2_data , LILV_NS_MOD "rawMIDIClockAccess" );
42574259 g_lilv_nodes .rdfs_range = lilv_new_uri (g_lv2_data , LILV_NS_RDFS "range" );
4260+ g_lilv_nodes .reset = lilv_new_uri (g_lv2_data , LV2_KXSTUDIO_PROPERTIES__Reset );
42584261 g_lilv_nodes .sample_rate = lilv_new_uri (g_lv2_data , LV2_CORE__sampleRate );
42594262 g_lilv_nodes .state_interface = lilv_new_uri (g_lv2_data , LV2_STATE__interface );
42604263 g_lilv_nodes .state_load_default_state = lilv_new_uri (g_lv2_data , LV2_STATE__loadDefaultState );
@@ -4320,7 +4323,7 @@ int effects_init(void* client)
43204323 g_urids .time_beatUnit = urid_to_id (g_symap , LV2_TIME__beatUnit );
43214324 g_urids .time_beatsPerBar = urid_to_id (g_symap , LV2_TIME__beatsPerBar );
43224325 g_urids .time_beatsPerMinute = urid_to_id (g_symap , LV2_TIME__beatsPerMinute );
4323- g_urids .time_ticksPerBeat = urid_to_id (g_symap , KX_TIME__TicksPerBeat );
4326+ g_urids .time_ticksPerBeat = urid_to_id (g_symap , LV2_KXSTUDIO_PROPERTIES__TimePositionTicksPerBeat );
43244327 g_urids .time_frame = urid_to_id (g_symap , LV2_TIME__frame );
43254328 g_urids .time_speed = urid_to_id (g_symap , LV2_TIME__speed );
43264329
@@ -4601,6 +4604,7 @@ int effects_finish(int close_client)
46014604 lilv_node_free (g_lilv_nodes .preset );
46024605 lilv_node_free (g_lilv_nodes .rawMIDIClockAccess );
46034606 lilv_node_free (g_lilv_nodes .rdfs_range );
4607+ lilv_node_free (g_lilv_nodes .reset );
46044608 lilv_node_free (g_lilv_nodes .sample_rate );
46054609 lilv_node_free (g_lilv_nodes .state_interface );
46064610 lilv_node_free (g_lilv_nodes .state_load_default_state );
@@ -5207,7 +5211,9 @@ int effects_add(const char *uri, int instance, int activate)
52075211
52085212 // special ports
52095213 {
5210- const LilvPort * enabled_port = lilv_plugin_get_port_by_designation (plugin , g_lilv_nodes .input , g_lilv_nodes .enabled );
5214+ const LilvPort * enabled_port = lilv_plugin_get_port_by_designation (plugin ,
5215+ g_lilv_nodes .input ,
5216+ g_lilv_nodes .enabled );
52115217 if (enabled_port )
52125218 {
52135219 effect -> enabled_index = lilv_port_get_index (plugin , enabled_port );
@@ -5218,7 +5224,9 @@ int effects_add(const char *uri, int instance, int activate)
52185224 effect -> enabled_index = -1 ;
52195225 }
52205226
5221- const LilvPort * freewheel_port = lilv_plugin_get_port_by_designation (plugin , g_lilv_nodes .input , g_lilv_nodes .freeWheeling );
5227+ const LilvPort * freewheel_port = lilv_plugin_get_port_by_designation (plugin ,
5228+ g_lilv_nodes .input ,
5229+ g_lilv_nodes .freeWheeling );
52225230 if (freewheel_port )
52235231 {
52245232 effect -> freewheel_index = lilv_port_get_index (plugin , freewheel_port );
@@ -5229,7 +5237,22 @@ int effects_add(const char *uri, int instance, int activate)
52295237 effect -> freewheel_index = -1 ;
52305238 }
52315239
5232- const LilvPort * bpb_port = lilv_plugin_get_port_by_designation (plugin , g_lilv_nodes .input , g_lilv_nodes .timeBeatsPerBar );
5240+ const LilvPort * reset_port = lilv_plugin_get_port_by_designation (plugin ,
5241+ g_lilv_nodes .input ,
5242+ g_lilv_nodes .reset );
5243+ if (reset_port )
5244+ {
5245+ effect -> reset_index = lilv_port_get_index (plugin , reset_port );
5246+ * (effect -> ports [effect -> reset_index ]-> buffer ) = 0.0f ;
5247+ }
5248+ else
5249+ {
5250+ effect -> reset_index = -1 ;
5251+ }
5252+
5253+ const LilvPort * bpb_port = lilv_plugin_get_port_by_designation (plugin ,
5254+ g_lilv_nodes .input ,
5255+ g_lilv_nodes .timeBeatsPerBar );
52335256 if (bpb_port )
52345257 {
52355258 effect -> bpb_index = lilv_port_get_index (plugin , bpb_port );
@@ -5240,7 +5263,9 @@ int effects_add(const char *uri, int instance, int activate)
52405263 effect -> bpb_index = -1 ;
52415264 }
52425265
5243- const LilvPort * bpm_port = lilv_plugin_get_port_by_designation (plugin , g_lilv_nodes .input , g_lilv_nodes .timeBeatsPerMinute );
5266+ const LilvPort * bpm_port = lilv_plugin_get_port_by_designation (plugin ,
5267+ g_lilv_nodes .input ,
5268+ g_lilv_nodes .timeBeatsPerMinute );
52445269 if (bpm_port )
52455270 {
52465271 effect -> bpm_index = lilv_port_get_index (plugin , bpm_port );
@@ -5251,7 +5276,9 @@ int effects_add(const char *uri, int instance, int activate)
52515276 effect -> bpm_index = -1 ;
52525277 }
52535278
5254- const LilvPort * speed_port = lilv_plugin_get_port_by_designation (plugin , g_lilv_nodes .input , g_lilv_nodes .timeSpeed );
5279+ const LilvPort * speed_port = lilv_plugin_get_port_by_designation (plugin ,
5280+ g_lilv_nodes .input ,
5281+ g_lilv_nodes .timeSpeed );
52555282 if (speed_port )
52565283 {
52575284 effect -> speed_index = lilv_port_get_index (plugin , speed_port );
@@ -5597,6 +5624,10 @@ int effects_preset_load(int effect_id, const char *uri)
55975624 {
55985625 * (effect -> ports [effect -> freewheel_index ]-> buffer ) = 0.0f ;
55995626 }
5627+ if (effect -> reset_index >= 0 )
5628+ {
5629+ * (effect -> ports [effect -> reset_index ]-> buffer ) = 0.0f ;
5630+ }
56005631 if (effect -> bpb_index >= 0 )
56015632 {
56025633 * (effect -> ports [effect -> bpb_index ]-> buffer ) = g_transport_bpb ;
0 commit comments