aboutsummaryrefslogtreecommitdiff
path: root/props.lv2/test
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2017-03-19 18:58:34 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2017-03-19 18:58:34 +0100
commitde2d8fe72d62a8192a9c05d715924f308189e5e1 (patch)
treedae1cc2e85bd50031162bf6dfa650a72a90034fb /props.lv2/test
parenta9ee41bb3eb9d7a9021c4213c50cd1bed09c32c7 (diff)
parentd52738538423c10c1c5c4056d94daa89cf327625 (diff)
downloadsherlock.lv2-de2d8fe72d62a8192a9c05d715924f308189e5e1.tar.xz
Merge commit 'd52738538423c10c1c5c4056d94daa89cf327625'
Diffstat (limited to 'props.lv2/test')
-rw-r--r--props.lv2/test/props.c46
-rw-r--r--props.lv2/test/props.ttl5
2 files changed, 15 insertions, 36 deletions
diff --git a/props.lv2/test/props.c b/props.lv2/test/props.c
index e4b27d8..1883230 100644
--- a/props.lv2/test/props.c
+++ b/props.lv2/test/props.c
@@ -20,6 +20,7 @@
#include <props.h>
#include <lv2/lv2plug.in/ns/ext/log/log.h>
+#include <lv2/lv2plug.in/ns/ext/log/logger.h>
#define PROPS_PREFIX "http://open-music-kontrollers.ch/lv2/props#"
#define PROPS_TEST_URI PROPS_PREFIX"test"
@@ -43,12 +44,10 @@ struct _plugstate_t {
struct _plughandle_t {
LV2_URID_Map *map;
LV2_Log_Log *log;
+ LV2_Log_Logger logger;
LV2_Atom_Forge forge;
LV2_Atom_Forge_Ref ref;
- LV2_URID log_trace;
- LV2_URID log_note;
-
PROPS_T(props, MAX_NPROPS);
plugstate_t state;
plugstate_t stash;
@@ -62,26 +61,6 @@ struct _plughandle_t {
LV2_Atom_Sequence *event_out;
};
-static int
-_log_vprintf(plughandle_t *handle, LV2_URID type, const char *fmt, va_list args)
-{
- return handle->log->vprintf(handle->log->handle, type, fmt, args);
-}
-
-// non-rt || rt with LV2_LOG__Trace
-static int
-_log_printf(plughandle_t *handle, LV2_URID type, const char *fmt, ...)
-{
- va_list args;
- int ret;
-
- va_start (args, fmt);
- ret = _log_vprintf(handle, type, fmt, args);
- va_end(args);
-
- return ret;
-}
-
static void
_intercept(void *data, LV2_Atom_Forge *forge, int64_t frames,
props_event_t event, props_impl_t *impl)
@@ -92,27 +71,27 @@ _intercept(void *data, LV2_Atom_Forge *forge, int64_t frames,
{
case PROP_EVENT_GET:
{
- _log_printf(handle, handle->log_trace, "GET : %s", impl->def->property);
+ lv2_log_trace(&handle->logger, "GET : %s\n", impl->def->property);
break;
}
case PROP_EVENT_SET:
{
- _log_printf(handle, handle->log_trace, "SET : %s", impl->def->property);
+ lv2_log_trace(&handle->logger, "SET : %s\n", impl->def->property);
break;
}
case PROP_EVENT_REGISTER:
{
- _log_printf(handle, handle->log_trace, "REGISTER: %s", impl->def->property);
+ lv2_log_note(&handle->logger, "REGISTER: %s\n", impl->def->property);
break;
}
case PROP_EVENT_SAVE:
{
- _log_printf(handle, handle->log_note, "SAVE : %s", impl->def->property);
+ lv2_log_note(&handle->logger, "SAVE : %s\n", impl->def->property);
break;
}
case PROP_EVENT_RESTORE:
{
- _log_printf(handle, handle->log_note, "RESTORE : %s", impl->def->property);
+ lv2_log_note(&handle->logger, "RESTORE : %s\n", impl->def->property);
break;
}
}
@@ -259,20 +238,19 @@ instantiate(const LV2_Descriptor* descriptor, double rate,
return NULL;
}
- handle->log_trace = handle->map->map(handle->map->handle, LV2_LOG__Trace);
- handle->log_note = handle->map->map(handle->map->handle, LV2_LOG__Note);
-
+ lv2_log_logger_init(&handle->logger, handle->map, handle->log);
lv2_atom_forge_init(&handle->forge, handle->map);
+
if(!props_init(&handle->props, MAX_NPROPS, descriptor->URI, handle->map, handle))
{
- fprintf(stderr, "failed to initialize property structure\n");
+ lv2_log_error(&handle->logger, "failed to initialize property structure\n");
free(handle);
return NULL;
}
if(!props_register(&handle->props, defs, MAX_NPROPS, &handle->state, &handle->stash))
{
- _log_printf(handle, handle->log_trace, "ERR : registering");
+ lv2_log_error(&handle->logger, "ERR : registering\n");
free(handle);
return NULL;
}
@@ -374,7 +352,7 @@ _work_response(LV2_Handle instance, uint32_t size, const void *body)
return props_work_response(&handle->props, size, body);
}
-LV2_Worker_Interface work_iface = {
+static const LV2_Worker_Interface work_iface = {
.work = _work,
.work_response = _work_response,
.end_run = NULL
diff --git a/props.lv2/test/props.ttl b/props.lv2/test/props.ttl
index 3f6b188..68d6b43 100644
--- a/props.lv2/test/props.ttl
+++ b/props.lv2/test/props.ttl
@@ -24,6 +24,7 @@
@prefix state: <http://lv2plug.in/ns/ext/state#> .
@prefix patch: <http://lv2plug.in/ns/ext/patch#> .
@prefix log: <http://lv2plug.in/ns/ext/log#> .
+@prefix work: <http://lv2plug.in/ns/ext/worker#> .
@prefix units: <http://lv2plug.in/ns/extensions/units#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@@ -106,9 +107,9 @@ props:test
doap:name "Props Test" ;
doap:license lic:Artistic-2.0 ;
lv2:project proj:props ;
- lv2:extensionData state:interface ;
- lv2:requiredFeature urid:map, log:log, state:loadDefaultState ;
+ lv2:requiredFeature urid:map, log:log, state:loadDefaultState, work:schedule ;
lv2:optionalFeature lv2:isLive, lv2:hardRTCapable, state:threadSafeRestore ;
+ lv2:extensionData state:interface, work:interface ;
lv2:port [
# sink event port