aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2017-09-22 23:19:59 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2017-09-22 23:19:59 +0200
commitafb8d1cbaea4ef4d2bd7de73a10731ea1d8de276 (patch)
tree31fa7b4dc4726fc2f55b4b574b8cc844794114f4
parent70701b0e4717e78d225d06369355ac8dc3990a2b (diff)
downloadsynthpod-afb8d1cbaea4ef4d2bd7de73a10731ea1d8de276.tar.xz
discriminate between src/snk automations.
-rw-r--r--VERSION2
-rw-r--r--app/synthpod_app.c19
-rw-r--r--app/synthpod_app_private.h3
-rw-r--r--app/synthpod_app_state.c16
-rw-r--r--app/synthpod_app_ui.c26
-rw-r--r--include/synthpod_private.h9
-rw-r--r--plugins/synthpod_common_nk.c37
7 files changed, 102 insertions, 10 deletions
diff --git a/VERSION b/VERSION
index bb76cbfc..7b24812c 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.5279
+0.1.5281
diff --git a/app/synthpod_app.c b/app/synthpod_app.c
index 58476d36..06b89d2a 100644
--- a/app/synthpod_app.c
+++ b/app/synthpod_app.c
@@ -206,14 +206,17 @@ _sp_app_automate(sp_app_t *app, mod_t *mod, auto_t *automation, double value, ui
}
__realtime static inline bool
-_sp_app_has_automations(mod_t *mod)
+_sp_app_has_source_automations(mod_t *mod)
{
for(unsigned i = 0; i < MAX_AUTOMATIONS; i++)
{
auto_t *automation = &mod->automations[i];
- if(automation->type != AUTO_TYPE_NONE)
+ if( (automation->type != AUTO_TYPE_NONE)
+ && automation->src_enabled )
+ {
return true; // has automations
+ }
}
return false; // has no automations
@@ -378,7 +381,8 @@ _sp_app_process_single_run(mod_t *mod, uint32_t nsamples)
{
auto_t *automation = &mod->automations[i];
- if(automation->type == AUTO_TYPE_MIDI)
+ if( (automation->type == AUTO_TYPE_MIDI)
+ && automation->snk_enabled )
{
midi_auto_t *mauto = &automation->midi;
@@ -461,7 +465,8 @@ _sp_app_process_single_run(mod_t *mod, uint32_t nsamples)
{
auto_t *automation = &mod->automations[i];
- if(automation->type == AUTO_TYPE_OSC)
+ if( (automation->type == AUTO_TYPE_OSC)
+ && automation->snk_enabled )
{
osc_auto_t *oauto = &automation->osc;
@@ -497,7 +502,7 @@ _sp_app_process_single_run(mod_t *mod, uint32_t nsamples)
lv2_atom_forge_set_buffer(&forge, (uint8_t *)seq, capacity);
LV2_Atom_Forge_Ref ref = lv2_atom_forge_sequence_head(&forge, &frame, 0);
- if(_sp_app_has_automations(mod)) //FIXME discriminate between input/output automations
+ if(_sp_app_has_source_automations(mod))
{
uint32_t t0 = 0;
@@ -516,7 +521,7 @@ _sp_app_process_single_run(mod_t *mod, uint32_t nsamples)
{
auto_t *automation = _sp_app_find_automation_for_port(mod, p);
- if(automation)
+ if(automation && automation->src_enabled)
{
const double value = (*val - automation->add) / automation->mul;
@@ -549,7 +554,7 @@ _sp_app_process_single_run(mod_t *mod, uint32_t nsamples)
continue;
auto_t *automation = _sp_app_find_automation_for_property(mod, patch_property->body);
- if(automation && (patch_value->type == automation->range))
+ if(automation && automation->src_enabled && (patch_value->type == automation->range))
{
double val = 0.0;
diff --git a/app/synthpod_app_private.h b/app/synthpod_app_private.h
index 1f2bad6d..1ff93589 100644
--- a/app/synthpod_app_private.h
+++ b/app/synthpod_app_private.h
@@ -225,6 +225,9 @@ struct _auto_t {
LV2_URID property;
LV2_URID range;
+ int src_enabled;
+ int snk_enabled;
+
double a;
double b;
double c;
diff --git a/app/synthpod_app_state.c b/app/synthpod_app_state.c
index 5be24ef3..9fab4289 100644
--- a/app/synthpod_app_state.c
+++ b/app/synthpod_app_state.c
@@ -1178,7 +1178,13 @@ sp_app_save(sp_app_t *app, LV2_State_Store_Function store,
&& lv2_atom_forge_double(forge, automation->c)
&& lv2_atom_forge_key(forge, app->regs.synthpod.sink_max.urid)
- && lv2_atom_forge_double(forge, automation->d);
+ && lv2_atom_forge_double(forge, automation->d)
+
+ && lv2_atom_forge_key(forge, app->regs.synthpod.source_enabled.urid)
+ && lv2_atom_forge_bool(forge, automation->src_enabled)
+
+ && lv2_atom_forge_key(forge, app->regs.synthpod.sink_enabled.urid)
+ && lv2_atom_forge_bool(forge, automation->snk_enabled);
if(ref)
{
@@ -1224,7 +1230,13 @@ sp_app_save(sp_app_t *app, LV2_State_Store_Function store,
&& lv2_atom_forge_double(forge, automation->c)
&& lv2_atom_forge_key(forge, app->regs.synthpod.sink_max.urid)
- && lv2_atom_forge_double(forge, automation->d);
+ && lv2_atom_forge_double(forge, automation->d)
+
+ && lv2_atom_forge_key(forge, app->regs.synthpod.source_enabled.urid)
+ && lv2_atom_forge_bool(forge, automation->src_enabled)
+
+ && lv2_atom_forge_key(forge, app->regs.synthpod.sink_enabled.urid)
+ && lv2_atom_forge_bool(forge, automation->snk_enabled);
if(ref)
{
diff --git a/app/synthpod_app_ui.c b/app/synthpod_app_ui.c
index 70f0116b..efaf66e7 100644
--- a/app/synthpod_app_ui.c
+++ b/app/synthpod_app_ui.c
@@ -432,6 +432,16 @@ _sp_app_from_ui_patch_get(sp_app_t *app, const LV2_Atom *atom)
ref = lv2_atom_forge_key(&app->forge, app->regs.synthpod.sink_max.urid);
if(ref)
ref = lv2_atom_forge_double(&app->forge, automation->d);
+
+ if(ref)
+ ref = lv2_atom_forge_key(&app->forge, app->regs.synthpod.source_enabled.urid);
+ if(ref)
+ ref = lv2_atom_forge_bool(&app->forge, automation->src_enabled);
+
+ if(ref)
+ ref = lv2_atom_forge_key(&app->forge, app->regs.synthpod.sink_enabled.urid);
+ if(ref)
+ ref = lv2_atom_forge_bool(&app->forge, automation->snk_enabled);
}
if(ref)
lv2_atom_forge_pop(&app->forge, &frame[2]);
@@ -491,6 +501,16 @@ _sp_app_from_ui_patch_get(sp_app_t *app, const LV2_Atom *atom)
ref = lv2_atom_forge_key(&app->forge, app->regs.synthpod.sink_max.urid);
if(ref)
ref = lv2_atom_forge_double(&app->forge, automation->d);
+
+ if(ref)
+ ref = lv2_atom_forge_key(&app->forge, app->regs.synthpod.source_enabled.urid);
+ if(ref)
+ ref = lv2_atom_forge_bool(&app->forge, automation->src_enabled);
+
+ if(ref)
+ ref = lv2_atom_forge_key(&app->forge, app->regs.synthpod.sink_enabled.urid);
+ if(ref)
+ ref = lv2_atom_forge_bool(&app->forge, automation->snk_enabled);
}
if(ref)
lv2_atom_forge_pop(&app->forge, &frame[2]);
@@ -1302,6 +1322,8 @@ _automation_list_add(sp_app_t *app, const LV2_Atom_Object *obj)
const LV2_Atom_Double *src_max = NULL;
const LV2_Atom_Double *snk_min = NULL;
const LV2_Atom_Double *snk_max = NULL;
+ const LV2_Atom_Bool *src_enabled = NULL;
+ const LV2_Atom_Bool *snk_enabled = NULL;
lv2_atom_object_get(obj,
app->regs.synthpod.sink_module.urid, &src_module,
@@ -1315,6 +1337,8 @@ _automation_list_add(sp_app_t *app, const LV2_Atom_Object *obj)
app->regs.synthpod.source_max.urid, &src_max,
app->regs.synthpod.sink_min.urid, &snk_min,
app->regs.synthpod.sink_max.urid, &snk_max,
+ app->regs.synthpod.source_enabled.urid, &src_enabled,
+ app->regs.synthpod.sink_enabled.urid, &snk_enabled,
0);
const LV2_URID src_urn = src_module
@@ -1350,6 +1374,8 @@ _automation_list_add(sp_app_t *app, const LV2_Atom_Object *obj)
automation->b = src_max ? src_max->body : 0.0;
automation->c = snk_min ? snk_min->body : 0.0;
automation->d = snk_max ? snk_max->body : 0.0;
+ automation->src_enabled = src_enabled ? src_enabled->body : false;
+ automation->snk_enabled = snk_enabled ? snk_enabled->body : false;
const double div = automation->b - automation->a;
automation->mul = div
diff --git a/include/synthpod_private.h b/include/synthpod_private.h
index 1be70eac..45f67d7f 100644
--- a/include/synthpod_private.h
+++ b/include/synthpod_private.h
@@ -387,6 +387,9 @@ struct _reg_t {
reg_item_t source_max;
reg_item_t sink_min;
reg_item_t sink_max;
+
+ reg_item_t source_enabled;
+ reg_item_t sink_enabled;
} synthpod;
struct {
@@ -664,6 +667,9 @@ sp_regs_init(reg_t *regs, LilvWorld *world, LV2_URID_Map *map)
_register(&regs->synthpod.sink_min, world, map, SYNTHPOD_PREFIX"sinkMinimum");
_register(&regs->synthpod.sink_max, world, map, SYNTHPOD_PREFIX"sinkMaximum");
+ _register(&regs->synthpod.source_enabled, world, map, SYNTHPOD_PREFIX"sourceEnabled");
+ _register(&regs->synthpod.sink_enabled, world, map, SYNTHPOD_PREFIX"sinkEnabled");
+
_register(&regs->midi.Controller, world, map, LV2_MIDI__Controller);
_register(&regs->midi.channel, world, map, LV2_MIDI__channel);
_register(&regs->midi.controller_number, world, map, LV2_MIDI__controllerNumber);
@@ -904,6 +910,9 @@ sp_regs_deinit(reg_t *regs)
_unregister(&regs->synthpod.sink_min);
_unregister(&regs->synthpod.sink_max);
+ _unregister(&regs->synthpod.source_enabled);
+ _unregister(&regs->synthpod.sink_enabled);
+
_unregister(&regs->midi.Controller);
_unregister(&regs->midi.channel);
_unregister(&regs->midi.controller_number);
diff --git a/plugins/synthpod_common_nk.c b/plugins/synthpod_common_nk.c
index 3c8b6cb2..1fa49b6b 100644
--- a/plugins/synthpod_common_nk.c
+++ b/plugins/synthpod_common_nk.c
@@ -177,6 +177,8 @@ struct _osc_auto_t {
struct _auto_t {
auto_type_t type;
+ int src_enabled;
+ int snk_enabled;
double c;
double d;
@@ -1216,6 +1218,16 @@ _patch_midi_automation_internal(plughandle_t *handle, auto_t *automation)
if(ref)
ref = lv2_atom_forge_double(&handle->forge, automation->d);
+ if(ref)
+ ref = lv2_atom_forge_key(&handle->forge, handle->regs.synthpod.source_enabled.urid);
+ if(ref)
+ ref = lv2_atom_forge_bool(&handle->forge, automation->src_enabled);
+
+ if(ref)
+ ref = lv2_atom_forge_key(&handle->forge, handle->regs.synthpod.sink_enabled.urid);
+ if(ref)
+ ref = lv2_atom_forge_bool(&handle->forge, automation->snk_enabled);
+
return ref;
}
@@ -1246,6 +1258,16 @@ _patch_osc_automation_internal(plughandle_t *handle, auto_t *automation)
if(ref)
ref = lv2_atom_forge_double(&handle->forge, automation->d);
+ if(ref)
+ ref = lv2_atom_forge_key(&handle->forge, handle->regs.synthpod.source_enabled.urid);
+ if(ref)
+ ref = lv2_atom_forge_bool(&handle->forge, automation->src_enabled);
+
+ if(ref)
+ ref = lv2_atom_forge_key(&handle->forge, handle->regs.synthpod.sink_enabled.urid);
+ if(ref)
+ ref = lv2_atom_forge_bool(&handle->forge, automation->snk_enabled);
+
return ref;
}
@@ -5991,6 +6013,8 @@ _expose_main_body(plughandle_t *handle, struct nk_context *ctx, float dh, float
automation->midi.b = 0x7f;
automation->c = c;
automation->d = d;
+ automation->src_enabled = false;
+ automation->snk_enabled = false;
}
else if(automation->type == AUTO_OSC)
{
@@ -6023,6 +6047,8 @@ _expose_main_body(plughandle_t *handle, struct nk_context *ctx, float dh, float
automation->osc.b = 1.0;
automation->c = c;
automation->d = d;
+ automation->src_enabled = false;
+ automation->snk_enabled = false;
}
}
}
@@ -6036,6 +6062,8 @@ _expose_main_body(plughandle_t *handle, struct nk_context *ctx, float dh, float
const double inc = 1.0; //FIXME
const float ipp = 1.f; //FIXME
+ nk_checkbox_label(ctx,"Source Enabled", &automation->src_enabled); //FIXME only valid for writables
+ nk_checkbox_label(ctx,"Sink Enabled", &automation->snk_enabled); //FIXME onl valid for readables
nk_property_int(ctx, "MIDI Channel", -1, &automation->midi.channel, 0xf, 1, ipp);
nk_property_int(ctx, "MIDI Controller", -1, &automation->midi.controller, 0x7f, 1, ipp);
nk_property_int(ctx, "MIDI Minimum", 0, &automation->midi.a, 0x7f, 1, ipp);
@@ -6052,6 +6080,9 @@ _expose_main_body(plughandle_t *handle, struct nk_context *ctx, float dh, float
const double inc = 1.0; //FIXME
const float ipp = 1.f; //FIXME
+ nk_checkbox_label(ctx,"Source Enabled", &automation->src_enabled); //FIXME only valid for writables
+ nk_checkbox_label(ctx,"Sink Enabled", &automation->snk_enabled); //FIXME onl valid for readables
+
const nk_flags res = nk_edit_string_zero_terminated(ctx, NK_EDIT_FIELD,
automation->osc.path, 128, _osc_path_filter);
(void)res;
@@ -6755,6 +6786,8 @@ _add_automation(plughandle_t *handle, const LV2_Atom_Object *obj)
const LV2_Atom_Double *src_max = NULL;
const LV2_Atom_Double *snk_min = NULL;
const LV2_Atom_Double *snk_max = NULL;
+ const LV2_Atom_Bool *src_enabled = NULL;
+ const LV2_Atom_Bool *snk_enabled = NULL;
lv2_atom_object_get(obj,
handle->regs.synthpod.sink_module.urid, &src_module,
@@ -6767,6 +6800,8 @@ _add_automation(plughandle_t *handle, const LV2_Atom_Object *obj)
handle->regs.synthpod.source_max.urid, &src_max,
handle->regs.synthpod.sink_min.urid, &snk_min,
handle->regs.synthpod.sink_max.urid, &snk_max,
+ handle->regs.synthpod.source_enabled.urid, &src_enabled,
+ handle->regs.synthpod.sink_enabled.urid, &snk_enabled,
0);
const LV2_URID src_urn = src_module
@@ -6812,6 +6847,8 @@ _add_automation(plughandle_t *handle, const LV2_Atom_Object *obj)
if(!automation)
return;
+ automation->src_enabled = src_enabled ? src_enabled->body : false;
+ automation->snk_enabled= snk_enabled ? snk_enabled->body : false;
automation->c = snk_min ? snk_min->body : 0.0; //FIXME
automation->d = snk_max ? snk_max->body : 0.0; //FIXME