aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-01-05 17:15:23 +0100
committerDavid Robillard <d@drobilla.net>2019-12-12 12:57:07 +0100
commit721dffcd9b9c6d9df9e30b6f510f3aed5c0ac965 (patch)
treeed0794b33c0366012538e8f01597cc2d2ecf6613 /src
parent15f779a8603bc3f020e7000189900c52964771cd (diff)
downloadjalv-721dffcd9b9c6d9df9e30b6f510f3aed5c0ac965.tar.gz
jalv-721dffcd9b9c6d9df9e30b6f510f3aed5c0ac965.tar.bz2
jalv-721dffcd9b9c6d9df9e30b6f510f3aed5c0ac965.zip
WIP: Port to serd1
Diffstat (limited to 'src')
-rw-r--r--src/jack.c7
-rw-r--r--src/jalv.c30
-rw-r--r--src/jalv_internal.h4
3 files changed, 17 insertions, 24 deletions
diff --git a/src/jack.c b/src/jack.c
index 7a3d6dc..9a999ee 100644
--- a/src/jack.c
+++ b/src/jack.c
@@ -107,13 +107,12 @@ jack_process_cb(jack_nframes_t nframes, void* data)
}
if (jalv->opts.dump) {
- char* str = sratom_to_turtle(
- jalv->sratom, &jalv->unmap, "time:", NULL, NULL,
- lv2_pos->type, lv2_pos->size, LV2_ATOM_BODY(lv2_pos));
+ char* str = sratom_to_string(
+ jalv->sratom, jalv->env, lv2_pos, SRATOM_PRETTY_NUMBERS);
jalv_ansi_start(stdout, 36);
printf("\n## Position ##\n%s\n", str);
jalv_ansi_reset(stdout);
- free(str);
+ sratom_free(str);
}
}
diff --git a/src/jalv.c b/src/jalv.c
index adee072..84bdc69 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -482,13 +482,12 @@ jalv_ui_write(void* const jalv_handle,
if (jalv->opts.dump && protocol == jalv->urids.atom_eventTransfer) {
const LV2_Atom* atom = (const LV2_Atom*)buffer;
- char* str = sratom_to_turtle(
- jalv->sratom, &jalv->unmap, "jalv:", NULL, NULL,
- atom->type, atom->size, LV2_ATOM_BODY_CONST(atom));
+ char* str = sratom_to_string(
+ jalv->sratom, jalv->env, atom, SRATOM_PRETTY_NUMBERS);
jalv_ansi_start(stdout, 36);
printf("\n## UI => Plugin (%u bytes) ##\n%s\n", atom->size, str);
jalv_ansi_reset(stdout);
- free(str);
+ sratom_free(str);
}
char buf[sizeof(ControlChange) + buffer_size];
@@ -658,9 +657,8 @@ jalv_update(Jalv* jalv)
if (jalv->opts.dump && ev.protocol == jalv->urids.atom_eventTransfer) {
/* Dump event in Turtle to the console */
LV2_Atom* atom = (LV2_Atom*)buf;
- char* str = sratom_to_turtle(
- jalv->ui_sratom, &jalv->unmap, "jalv:", NULL, NULL,
- atom->type, atom->size, LV2_ATOM_BODY(atom));
+ char* str = sratom_to_string(
+ jalv->ui_sratom, jalv->env, atom, SRATOM_PRETTY_NUMBERS);
jalv_ansi_start(stdout, 35);
printf("\n## Plugin => UI (%u bytes) ##\n%s\n", atom->size, str);
jalv_ansi_reset(stdout);
@@ -772,17 +770,13 @@ jalv_open(Jalv* const jalv, int* argc, char*** argv)
lv2_atom_forge_init(&jalv->forge, &jalv->map);
jalv->env = serd_env_new(NULL);
- serd_env_set_prefix_from_strings(
- jalv->env, (const uint8_t*)"patch", (const uint8_t*)LV2_PATCH_PREFIX);
- serd_env_set_prefix_from_strings(
- jalv->env, (const uint8_t*)"time", (const uint8_t*)LV2_TIME_PREFIX);
- serd_env_set_prefix_from_strings(
- jalv->env, (const uint8_t*)"xsd", (const uint8_t*)NS_XSD);
-
- jalv->sratom = sratom_new(&jalv->map);
- jalv->ui_sratom = sratom_new(&jalv->map);
- sratom_set_env(jalv->sratom, jalv->env);
- sratom_set_env(jalv->ui_sratom, jalv->env);
+ serd_env_set_prefix_from_strings(jalv->env, "patch", LV2_PATCH_PREFIX);
+ serd_env_set_prefix_from_strings(jalv->env, "time", LV2_TIME_PREFIX);
+ serd_env_set_prefix_from_strings(jalv->env, "xsd", NS_XSD);
+
+ SerdWorld* serd_world = serd_world_new(); // FIXME
+ jalv->sratom = sratom_streamer_new(serd_world, &jalv->map, &jalv->unmap);
+ jalv->ui_sratom = sratom_streamer_new(serd_world, &jalv->map, &jalv->unmap);
jalv->urids.atom_Float = symap_map(jalv->symap, LV2_ATOM__Float);
jalv->urids.atom_Int = symap_map(jalv->symap, LV2_ATOM__Int);
diff --git a/src/jalv_internal.h b/src/jalv_internal.h
index 4d25109..827ac7e 100644
--- a/src/jalv_internal.h
+++ b/src/jalv_internal.h
@@ -291,8 +291,8 @@ struct Jalv {
LV2_URID_Map map; ///< URI => Int map
LV2_URID_Unmap unmap; ///< Int => URI map
SerdEnv* env; ///< Environment for RDF printing
- Sratom* sratom; ///< Atom serialiser
- Sratom* ui_sratom; ///< Atom serialiser for UI thread
+ SratomStreamer* sratom; ///< Atom serialiser
+ SratomStreamer* ui_sratom; ///< Atom serialiser for UI thread
Symap* symap; ///< URI map
ZixSem symap_lock; ///< Lock for URI map
JalvBackend* backend; ///< Audio system backend