aboutsummaryrefslogtreecommitdiffstats
path: root/src/jalv.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-11-08 01:44:25 +0000
committerDavid Robillard <d@drobilla.net>2015-11-08 01:44:25 +0000
commitadd42b10290e261aefa93dac2a1cef659a7c302f (patch)
treeaa194854548e0a18da4904d0a1cf9851ce93b2df /src/jalv.c
parent5537b613c517e258ed3209ac0f72e012fb314928 (diff)
downloadjalv-add42b10290e261aefa93dac2a1cef659a7c302f.tar.gz
jalv-add42b10290e261aefa93dac2a1cef659a7c302f.tar.bz2
jalv-add42b10290e261aefa93dac2a1cef659a7c302f.zip
Support numeric and string plugin properties
Also: * Print plugin/UI communication log in colour if supported * Update UI when internal plugin state is changed during preset load git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@5812 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/jalv.c')
-rw-r--r--src/jalv.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/jalv.c b/src/jalv.c
index 2af53a4..e445c64 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -1,5 +1,5 @@
/*
- Copyright 2007-2014 David Robillard <http://drobilla.net>
+ Copyright 2007-2015 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -530,6 +530,19 @@ jack_process_cb(jack_nframes_t nframes, void* data)
lv2_pos->type, lv2_pos->size, LV2_ATOM_BODY(lv2_pos));
}
+ if (jalv->state_changed) {
+ /* Plugin state has changed, request an update */
+ const LV2_Atom_Object get = {
+ { jalv->urids.atom_Object, sizeof(LV2_Atom_Object) },
+ { 0, jalv->urids.patch_Get } };
+
+ lv2_evbuf_write(
+ &iter, 0, 0,
+ get.atom.type, get.atom.size, LV2_ATOM_BODY(&get));
+
+ jalv->state_changed = false;
+ }
+
if (port->jack_port) {
/* Write Jack MIDI input */
void* buf = jack_port_get_buffer(port->jack_port, nframes);
@@ -836,7 +849,9 @@ jalv_ui_write(SuilController controller,
char* str = sratom_to_turtle(
jalv->sratom, &jalv->unmap, "jalv:", NULL, NULL,
atom->type, atom->size, LV2_ATOM_BODY_CONST(atom));
+ jalv_ansi_start(stdout, 36);
printf("\n## UI => Plugin (%u bytes) ##\n%s\n", atom->size, str);
+ jalv_ansi_reset(stdout);
free(str);
}
@@ -889,7 +904,9 @@ jalv_update(Jalv* jalv)
char* str = sratom_to_turtle(
jalv->ui_sratom, &jalv->unmap, "jalv:", NULL, NULL,
atom->type, atom->size, LV2_ATOM_BODY(atom));
+ jalv_ansi_start(stdout, 35);
printf("\n## Plugin => UI (%u bytes) ##\n%s\n", atom->size, str);
+ jalv_ansi_reset(stdout);
free(str);
}
@@ -975,6 +992,9 @@ main(int argc, char** argv)
jalv.urids.atom_Float = symap_map(jalv.symap, LV2_ATOM__Float);
jalv.urids.atom_Int = symap_map(jalv.symap, LV2_ATOM__Int);
+ jalv.urids.atom_Object = symap_map(jalv.symap, LV2_ATOM__Object);
+ jalv.urids.atom_Path = symap_map(jalv.symap, LV2_ATOM__Path);
+ jalv.urids.atom_String = symap_map(jalv.symap, LV2_ATOM__String);
jalv.urids.atom_eventTransfer = symap_map(jalv.symap, LV2_ATOM__eventTransfer);
jalv.urids.bufsz_maxBlockLength = symap_map(jalv.symap, LV2_BUF_SIZE__maxBlockLength);
jalv.urids.bufsz_minBlockLength = symap_map(jalv.symap, LV2_BUF_SIZE__minBlockLength);
@@ -982,6 +1002,8 @@ main(int argc, char** argv)
jalv.urids.log_Trace = symap_map(jalv.symap, LV2_LOG__Trace);
jalv.urids.midi_MidiEvent = symap_map(jalv.symap, LV2_MIDI__MidiEvent);
jalv.urids.param_sampleRate = symap_map(jalv.symap, LV2_PARAMETERS__sampleRate);
+ jalv.urids.patch_Get = symap_map(jalv.symap, LV2_PATCH__Get);
+ jalv.urids.patch_Put = symap_map(jalv.symap, LV2_PATCH__Put);
jalv.urids.patch_Set = symap_map(jalv.symap, LV2_PATCH__Set);
jalv.urids.patch_property = symap_map(jalv.symap, LV2_PATCH__property);
jalv.urids.patch_value = symap_map(jalv.symap, LV2_PATCH__value);
@@ -1159,7 +1181,7 @@ main(int argc, char** argv)
fprintf(stderr, "UI: %s\n",
lilv_node_as_uri(lilv_ui_get_uri(jalv.ui)));
} else {
- fprintf(stderr, "No appropriate UI found\n");
+ fprintf(stderr, "UI: None\n");
}
/* Create port structures (jalv.ports) */