aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2016-05-17 15:32:52 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2016-05-17 15:32:52 +0200
commit346f8c3407d711c19822f9d3fb2c10e24348df84 (patch)
treebe642d3169885c29d01f8713404db2ba0ad821a8
parentf7b07b9ea2fa9088882490d89dcbfb7e4399a062 (diff)
downloadsherlock.lv2-346f8c3407d711c19822f9d3fb2c10e24348df84.tar.xz
remove test plugin, move headers, fix funcnames.
-rw-r--r--CMakeLists.txt16
-rw-r--r--osc.lv2/forge.h (renamed from forge.h)12
-rw-r--r--osc.lv2/osc.h (renamed from osc.h)3
-rw-r--r--osc.lv2/reader.h (renamed from reader.h)174
-rw-r--r--osc.lv2/util.h (renamed from util.h)54
-rw-r--r--osc.lv2/writer.h (renamed from writer.h)176
-rw-r--r--osc_test.c110
-rw-r--r--test/manifest.ttl.in27
-rw-r--r--test/osc.c180
-rw-r--r--test/osc.ttl83
10 files changed, 289 insertions, 546 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index db71d43..64ce73b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,22 +7,6 @@ include_directories(${PROJECT_SOURCE_DIR})
set(CMAKE_C_FLAGS "-std=gnu11 -Wextra -Wno-unused-parameter -ffast-math -fvisibility=hidden ${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "-Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes ${CMAKE_C_FLAGS}")
-set(OSC_MAJOR_VERSION 0)
-set(OSC_MINOR_VERSION 1)
-set(OSC_MICRO_VERSION 1)
-set(OSC_VERSION "${OSC_MAJOR_VERSION}.${OSC_MINOR_VERSION}.${OSC_MICRO_VERSION}")
-
-set(DEST lib/lv2/osc.lv2)
-
-add_library(osc MODULE
- test/osc.c)
-set_target_properties(osc PROPERTIES PREFIX "")
-install(TARGETS osc DESTINATION ${DEST})
-
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/manifest.ttl.in ${PROJECT_BINARY_DIR}/manifest.ttl)
-install(FILES ${PROJECT_BINARY_DIR}/manifest.ttl DESTINATION ${DEST})
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/test/osc.ttl DESTINATION ${DEST})
-
include(CTest)
if(${BUILD_TESTING})
diff --git a/forge.h b/osc.lv2/forge.h
index 817d5cb..d46121f 100644
--- a/forge.h
+++ b/osc.lv2/forge.h
@@ -18,9 +18,9 @@
#ifndef LV2_OSC_FORGE_H
#define LV2_OSC_FORGE_H
-#include <osc.h>
-#include <util.h>
-#include <reader.h>
+#include <osc.lv2/osc.h>
+#include <osc.lv2/util.h>
+#include <osc.lv2/reader.h>
#include <lv2/lv2plug.in/ns/ext/atom/forge.h>
@@ -328,9 +328,9 @@ lv2_osc_forge_packet(LV2_Atom_Forge *forge, LV2_OSC_URID *osc_urid,
LV2_Atom_Forge_Frame frame [2];
LV2_Atom_Forge_Ref ref;
- osc_reader_initialize(&reader, buf, size);
+ lv2_osc_reader_initialize(&reader, buf, size);
- if(osc_reader_is_bundle(&reader))
+ if(lv2_osc_reader_is_bundle(&reader))
{
LV2_OSC_Item *itm = OSC_READER_BUNDLE_BEGIN(&reader, size);
@@ -348,7 +348,7 @@ lv2_osc_forge_packet(LV2_Atom_Forge *forge, LV2_OSC_URID *osc_urid,
return ref;
}
}
- else if(osc_reader_is_message(&reader))
+ else if(lv2_osc_reader_is_message(&reader))
{
LV2_OSC_Arg *arg = OSC_READER_MESSAGE_BEGIN(&reader, size);
diff --git a/osc.h b/osc.lv2/osc.h
index 4a9342d..3b36a19 100644
--- a/osc.h
+++ b/osc.lv2/osc.h
@@ -31,7 +31,6 @@
#define LV2_OSC__schedule LV2_OSC_PREFIX "schedule" // feature
#define LV2_OSC__Packet LV2_OSC_PREFIX "Packet" // atom object type
-#define LV2_OSC__packetBody LV2_OSC_PREFIX "packetBody" // atom object property
#define LV2_OSC__Bundle LV2_OSC_PREFIX "Bundle" // atom object type
#define LV2_OSC__bundleTimetag LV2_OSC_PREFIX "bundleTimetag" // atom object property
@@ -115,7 +114,6 @@ typedef struct _LV2_OSC_Timetag {
typedef struct _LV2_OSC_URID {
LV2_URID OSC_Packet;
- LV2_URID OSC_packetBody;
LV2_URID OSC_Bundle;
LV2_URID OSC_bundleTimetag;
@@ -151,7 +149,6 @@ static inline void
lv2_osc_urid_init(LV2_OSC_URID *osc_urid, LV2_URID_Map *map)
{
osc_urid->OSC_Packet = map->map(map->handle, LV2_OSC__Packet);
- osc_urid->OSC_packetBody = map->map(map->handle, LV2_OSC__packetBody);
osc_urid->OSC_Bundle = map->map(map->handle, LV2_OSC__Bundle);
osc_urid->OSC_bundleTimetag = map->map(map->handle, LV2_OSC__bundleTimetag);
diff --git a/reader.h b/osc.lv2/reader.h
index 6e609f2..2f5def9 100644
--- a/reader.h
+++ b/osc.lv2/reader.h
@@ -22,7 +22,7 @@
#include <string.h>
#include <endian.h>
-#include <osc.h>
+#include <osc.lv2/osc.h>
#ifdef __cplusplus
extern "C" {
@@ -75,7 +75,7 @@ struct _LV2_OSC_Arg {
};
static inline void
-osc_reader_initialize(LV2_OSC_Reader *reader, const uint8_t *buf, size_t size)
+lv2_osc_reader_initialize(LV2_OSC_Reader *reader, const uint8_t *buf, size_t size)
{
reader->buf = buf;
reader->ptr = buf;
@@ -83,15 +83,15 @@ osc_reader_initialize(LV2_OSC_Reader *reader, const uint8_t *buf, size_t size)
}
static inline bool
-osc_reader_overflow(LV2_OSC_Reader *reader, size_t size)
+lv2_osc_reader_overflow(LV2_OSC_Reader *reader, size_t size)
{
return reader->ptr + size > reader->end;
}
static inline bool
-osc_reader_be32toh(LV2_OSC_Reader *reader, union swap32_t *s32)
+lv2_osc_reader_be32toh(LV2_OSC_Reader *reader, union swap32_t *s32)
{
- if(osc_reader_overflow(reader, 4))
+ if(lv2_osc_reader_overflow(reader, 4))
return false;
s32->u = *(const uint32_t *)reader->ptr;
@@ -102,9 +102,9 @@ osc_reader_be32toh(LV2_OSC_Reader *reader, union swap32_t *s32)
}
static inline bool
-osc_reader_be64toh(LV2_OSC_Reader *reader, union swap64_t *s64)
+lv2_osc_reader_be64toh(LV2_OSC_Reader *reader, union swap64_t *s64)
{
- if(osc_reader_overflow(reader, 8))
+ if(lv2_osc_reader_overflow(reader, 8))
return false;
s64->u = *(const uint64_t *)reader->ptr;
@@ -115,10 +115,10 @@ osc_reader_be64toh(LV2_OSC_Reader *reader, union swap64_t *s64)
}
static inline bool
-osc_reader_get_int32(LV2_OSC_Reader *reader, int32_t *i)
+lv2_osc_reader_get_int32(LV2_OSC_Reader *reader, int32_t *i)
{
union swap32_t s32;
- if(!osc_reader_be32toh(reader, &s32))
+ if(!lv2_osc_reader_be32toh(reader, &s32))
return false;
*i = s32.i;
@@ -127,10 +127,10 @@ osc_reader_get_int32(LV2_OSC_Reader *reader, int32_t *i)
}
static inline bool
-osc_reader_get_float(LV2_OSC_Reader *reader, float *f)
+lv2_osc_reader_get_float(LV2_OSC_Reader *reader, float *f)
{
union swap32_t s32;
- if(!osc_reader_be32toh(reader, &s32))
+ if(!lv2_osc_reader_be32toh(reader, &s32))
return false;
*f = s32.f;
@@ -139,10 +139,10 @@ osc_reader_get_float(LV2_OSC_Reader *reader, float *f)
}
static inline bool
-osc_reader_get_int64(LV2_OSC_Reader *reader, int64_t *h)
+lv2_osc_reader_get_int64(LV2_OSC_Reader *reader, int64_t *h)
{
union swap64_t s64;
- if(!osc_reader_be64toh(reader, &s64))
+ if(!lv2_osc_reader_be64toh(reader, &s64))
return false;
*h = s64.h;
@@ -151,10 +151,10 @@ osc_reader_get_int64(LV2_OSC_Reader *reader, int64_t *h)
}
static inline bool
-osc_reader_get_timetag(LV2_OSC_Reader *reader, uint64_t *t)
+lv2_osc_reader_get_timetag(LV2_OSC_Reader *reader, uint64_t *t)
{
union swap64_t s64;
- if(!osc_reader_be64toh(reader, &s64))
+ if(!lv2_osc_reader_be64toh(reader, &s64))
return false;
*t = s64.u;
@@ -163,10 +163,10 @@ osc_reader_get_timetag(LV2_OSC_Reader *reader, uint64_t *t)
}
static inline bool
-osc_reader_get_double(LV2_OSC_Reader *reader, double *d)
+lv2_osc_reader_get_double(LV2_OSC_Reader *reader, double *d)
{
union swap64_t s64;
- if(!osc_reader_be64toh(reader, &s64))
+ if(!lv2_osc_reader_be64toh(reader, &s64))
return false;
*d = s64.d;
@@ -175,11 +175,11 @@ osc_reader_get_double(LV2_OSC_Reader *reader, double *d)
}
static inline bool
-osc_reader_get_string(LV2_OSC_Reader *reader, const char **s)
+lv2_osc_reader_get_string(LV2_OSC_Reader *reader, const char **s)
{
const char *str = (const char *)reader->ptr;
const size_t padded = LV2_OSC_PADDED_SIZE(strlen(str) + 1);
- if(osc_reader_overflow(reader, padded ))
+ if(lv2_osc_reader_overflow(reader, padded ))
return false;
*s = str;
@@ -189,15 +189,15 @@ osc_reader_get_string(LV2_OSC_Reader *reader, const char **s)
}
static inline bool
-osc_reader_get_symbol(LV2_OSC_Reader *reader, const char **S)
+lv2_osc_reader_get_symbol(LV2_OSC_Reader *reader, const char **S)
{
- return osc_reader_get_string(reader, S);
+ return lv2_osc_reader_get_string(reader, S);
}
static inline bool
-osc_reader_get_midi(LV2_OSC_Reader *reader, const uint8_t **m)
+lv2_osc_reader_get_midi(LV2_OSC_Reader *reader, const uint8_t **m)
{
- if(osc_reader_overflow(reader, 4))
+ if(lv2_osc_reader_overflow(reader, 4))
return false;
*m = reader->ptr;
@@ -207,13 +207,13 @@ osc_reader_get_midi(LV2_OSC_Reader *reader, const uint8_t **m)
}
static inline bool
-osc_reader_get_blob(LV2_OSC_Reader *reader, int32_t *len, const uint8_t **body)
+lv2_osc_reader_get_blob(LV2_OSC_Reader *reader, int32_t *len, const uint8_t **body)
{
- if(!osc_reader_get_int32(reader, len))
+ if(!lv2_osc_reader_get_int32(reader, len))
return false;
const size_t padded = LV2_OSC_PADDED_SIZE(*len);
- if(osc_reader_overflow(reader, padded))
+ if(lv2_osc_reader_overflow(reader, padded))
return false;
*body = reader->ptr;
@@ -223,9 +223,9 @@ osc_reader_get_blob(LV2_OSC_Reader *reader, int32_t *len, const uint8_t **body)
}
static inline bool
-osc_reader_get_rgba(LV2_OSC_Reader *reader, uint8_t *r, uint8_t *g, uint8_t *b, uint8_t *a)
+lv2_osc_reader_get_rgba(LV2_OSC_Reader *reader, uint8_t *r, uint8_t *g, uint8_t *b, uint8_t *a)
{
- if(osc_reader_overflow(reader, 4))
+ if(lv2_osc_reader_overflow(reader, 4))
return false;
*r = reader->ptr[0];
@@ -238,10 +238,10 @@ osc_reader_get_rgba(LV2_OSC_Reader *reader, uint8_t *r, uint8_t *g, uint8_t *b,
}
static inline bool
-osc_reader_get_char(LV2_OSC_Reader *reader, char *c)
+lv2_osc_reader_get_char(LV2_OSC_Reader *reader, char *c)
{
int32_t i;
- if(!osc_reader_get_int32(reader, &i))
+ if(!lv2_osc_reader_get_int32(reader, &i))
return false;
*c = i;
@@ -250,12 +250,12 @@ osc_reader_get_char(LV2_OSC_Reader *reader, char *c)
}
static inline LV2_OSC_Item *
-osc_reader_item_raw(LV2_OSC_Reader *reader, LV2_OSC_Item *itm)
+lv2_osc_reader_item_raw(LV2_OSC_Reader *reader, LV2_OSC_Item *itm)
{
- if(!osc_reader_get_int32(reader, &itm->size))
+ if(!lv2_osc_reader_get_int32(reader, &itm->size))
return NULL;
- if(osc_reader_overflow(reader, itm->size))
+ if(lv2_osc_reader_overflow(reader, itm->size))
return NULL;
itm->body = reader->ptr;
@@ -264,64 +264,64 @@ osc_reader_item_raw(LV2_OSC_Reader *reader, LV2_OSC_Item *itm)
}
static inline LV2_OSC_Item *
-osc_reader_item_begin(LV2_OSC_Reader *reader, LV2_OSC_Item *itm, size_t len)
+lv2_osc_reader_item_begin(LV2_OSC_Reader *reader, LV2_OSC_Item *itm, size_t len)
{
- if(osc_reader_overflow(reader, len))
+ if(lv2_osc_reader_overflow(reader, len))
return NULL;
itm->end = reader->ptr + len;
- if(osc_reader_overflow(reader, 16))
+ if(lv2_osc_reader_overflow(reader, 16))
return NULL;
if(strncmp((const char *)reader->ptr, "#bundle", 8))
return NULL;
reader->ptr += 8;
- if(!osc_reader_get_timetag(reader, &itm->timetag))
+ if(!lv2_osc_reader_get_timetag(reader, &itm->timetag))
return NULL;
- return osc_reader_item_raw(reader, itm);
+ return lv2_osc_reader_item_raw(reader, itm);
}
static inline bool
-osc_reader_item_is_end(LV2_OSC_Reader *reader, LV2_OSC_Item *itm)
+lv2_osc_reader_item_is_end(LV2_OSC_Reader *reader, LV2_OSC_Item *itm)
{
return reader->ptr > itm->end;
}
static inline LV2_OSC_Item *
-osc_reader_item_next(LV2_OSC_Reader *reader, LV2_OSC_Item *itm)
+lv2_osc_reader_item_next(LV2_OSC_Reader *reader, LV2_OSC_Item *itm)
{
reader->ptr += itm->size;
- return osc_reader_item_raw(reader, itm);
+ return lv2_osc_reader_item_raw(reader, itm);
}
#define OSC_READER_BUNDLE_BEGIN(reader, len) \
- osc_reader_item_begin( \
+ lv2_osc_reader_item_begin( \
(reader), \
&(LV2_OSC_Item){ .size = 0, .body = NULL, .timetag = 1ULL, .end = NULL }, \
len)
#define OSC_READER_BUNDLE_ITERATE(reader, itm) \
for(itm = itm; \
- itm && !osc_reader_item_is_end((reader), (itm)); \
- itm = osc_reader_item_next((reader), (itm)))
+ itm && !lv2_osc_reader_item_is_end((reader), (itm)); \
+ itm = lv2_osc_reader_item_next((reader), (itm)))
#define OSC_READER_BUNDLE_FOREACH(reader, itm, len) \
for(LV2_OSC_Item *(itm) = OSC_READER_BUNDLE_BEGIN((reader), (len)); \
- itm && !osc_reader_item_is_end((reader), (itm)); \
- itm = osc_reader_item_next((reader), (itm)))
+ itm && !lv2_osc_reader_item_is_end((reader), (itm)); \
+ itm = lv2_osc_reader_item_next((reader), (itm)))
static inline LV2_OSC_Arg *
-osc_reader_arg_raw(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg)
+lv2_osc_reader_arg_raw(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg)
{
switch( (LV2_OSC_Type)*arg->type)
{
case LV2_OSC_INT32:
{
- if(!osc_reader_get_int32(reader, &arg->i))
+ if(!lv2_osc_reader_get_int32(reader, &arg->i))
return NULL;
arg->size = 4;
@@ -329,7 +329,7 @@ osc_reader_arg_raw(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg)
}
case LV2_OSC_FLOAT:
{
- if(!osc_reader_get_float(reader, &arg->f))
+ if(!lv2_osc_reader_get_float(reader, &arg->f))
return NULL;
arg->size = 4;
@@ -337,7 +337,7 @@ osc_reader_arg_raw(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg)
}
case LV2_OSC_STRING:
{
- if(!osc_reader_get_string(reader, &arg->s))
+ if(!lv2_osc_reader_get_string(reader, &arg->s))
return NULL;
arg->size = strlen(arg->s) + 1;
@@ -345,7 +345,7 @@ osc_reader_arg_raw(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg)
}
case LV2_OSC_BLOB:
{
- if(!osc_reader_get_blob(reader, &arg->size, &arg->b))
+ if(!lv2_osc_reader_get_blob(reader, &arg->size, &arg->b))
return NULL;
//arg->size = arg->size;
@@ -360,7 +360,7 @@ osc_reader_arg_raw(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg)
case LV2_OSC_INT64:
{
- if(!osc_reader_get_int64(reader, &arg->h))
+ if(!lv2_osc_reader_get_int64(reader, &arg->h))
return NULL;
arg->size = 8;
@@ -368,7 +368,7 @@ osc_reader_arg_raw(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg)
}
case LV2_OSC_DOUBLE:
{
- if(!osc_reader_get_double(reader, &arg->d))
+ if(!lv2_osc_reader_get_double(reader, &arg->d))
return NULL;
arg->size = 8;
@@ -376,7 +376,7 @@ osc_reader_arg_raw(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg)
}
case LV2_OSC_TIMETAG:
{
- if(!osc_reader_get_timetag(reader, &arg->t))
+ if(!lv2_osc_reader_get_timetag(reader, &arg->t))
return NULL;
arg->size = 8;
@@ -385,7 +385,7 @@ osc_reader_arg_raw(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg)
case LV2_OSC_MIDI:
{
- if(!osc_reader_get_midi(reader, &arg->m))
+ if(!lv2_osc_reader_get_midi(reader, &arg->m))
return NULL;
arg->size = 4;
@@ -393,7 +393,7 @@ osc_reader_arg_raw(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg)
}
case LV2_OSC_SYMBOL:
{
- if(!osc_reader_get_symbol(reader, &arg->S))
+ if(!lv2_osc_reader_get_symbol(reader, &arg->S))
return NULL;
arg->size = strlen(arg->S) + 1;
@@ -401,7 +401,7 @@ osc_reader_arg_raw(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg)
}
case LV2_OSC_CHAR:
{
- if(!osc_reader_get_char(reader, &arg->c))
+ if(!lv2_osc_reader_get_char(reader, &arg->c))
return NULL;
arg->size = 4;
@@ -409,7 +409,7 @@ osc_reader_arg_raw(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg)
}
case LV2_OSC_RGBA:
{
- if(!osc_reader_get_rgba(reader, &arg->R, &arg->G, &arg->B, &arg->A))
+ if(!lv2_osc_reader_get_rgba(reader, &arg->R, &arg->G, &arg->B, &arg->A))
return NULL;
arg->size = 4;
@@ -421,17 +421,17 @@ osc_reader_arg_raw(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg)
}
static inline LV2_OSC_Arg *
-osc_reader_arg_begin(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg, size_t len)
+lv2_osc_reader_arg_begin(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg, size_t len)
{
- if(osc_reader_overflow(reader, len))
+ if(lv2_osc_reader_overflow(reader, len))
return NULL;
arg->end = reader->ptr + len;
- if(!osc_reader_get_string(reader, &arg->path)) //TODO check for validity
+ if(!lv2_osc_reader_get_string(reader, &arg->path)) //TODO check for validity
return NULL;
- if(!osc_reader_get_string(reader, &arg->type)) //TODO check for validity
+ if(!lv2_osc_reader_get_string(reader, &arg->type)) //TODO check for validity
return NULL;
if(*arg->type != ',')
@@ -439,60 +439,60 @@ osc_reader_arg_begin(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg, size_t len)
arg->type++; // skip ','
- return osc_reader_arg_raw(reader, arg);
+ return lv2_osc_reader_arg_raw(reader, arg);
}
static inline bool
-osc_reader_arg_is_end(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg)
+lv2_osc_reader_arg_is_end(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg)
{
return (*arg->type == '\0') || (reader->ptr > arg->end);
}
static inline LV2_OSC_Arg *
-osc_reader_arg_next(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg)
+lv2_osc_reader_arg_next(LV2_OSC_Reader *reader, LV2_OSC_Arg *arg)
{
arg->type++;
- return osc_reader_arg_raw(reader, arg);
+ return lv2_osc_reader_arg_raw(reader, arg);
}
#define OSC_READER_MESSAGE_BEGIN(reader, len) \
- osc_reader_arg_begin( \
+ lv2_osc_reader_arg_begin( \
(reader), \
&(LV2_OSC_Arg){ .type = NULL, .size = 0, .path = NULL, .end = NULL }, \
len)
#define OSC_READER_MESSAGE_ITERATE(reader, arg) \
for(arg = arg; \
- arg && !osc_reader_arg_is_end((reader), (arg)); \
- arg = osc_reader_arg_next((reader), (arg)))
+ arg && !lv2_osc_reader_arg_is_end((reader), (arg)); \
+ arg = lv2_osc_reader_arg_next((reader), (arg)))
#define OSC_READER_MESSAGE_FOREACH(reader, arg, len) \
for(LV2_OSC_Arg *(arg) = OSC_READER_MESSAGE_BEGIN((reader), (len)); \
- arg && !osc_reader_arg_is_end((reader), (arg)); \
- arg = osc_reader_arg_next((reader), (arg)))
+ arg && !lv2_osc_reader_arg_is_end((reader), (arg)); \
+ arg = lv2_osc_reader_arg_next((reader), (arg)))
static inline bool
-osc_reader_arg_varlist(LV2_OSC_Reader *reader, const char *fmt, va_list args)
+lv2_osc_reader_arg_varlist(LV2_OSC_Reader *reader, const char *fmt, va_list args)
{
for(const char *type = fmt; *type; type++)
{
switch( (LV2_OSC_Type)*type)
{
case LV2_OSC_INT32:
- if(!osc_reader_get_int32(reader, va_arg(args, int32_t *)))
+ if(!lv2_osc_reader_get_int32(reader, va_arg(args, int32_t *)))
return false;
break;
case LV2_OSC_FLOAT:
- if(!osc_reader_get_float(reader, va_arg(args, float *)))
+ if(!lv2_osc_reader_get_float(reader, va_arg(args, float *)))
return false;
break;
case LV2_OSC_STRING:
- if(!osc_reader_get_string(reader, va_arg(args, const char **)))
+ if(!lv2_osc_reader_get_string(reader, va_arg(args, const char **)))
return false;
break;
case LV2_OSC_BLOB:
- if(!osc_reader_get_blob(reader, va_arg(args, int32_t *), va_arg(args, const uint8_t **)))
+ if(!lv2_osc_reader_get_blob(reader, va_arg(args, int32_t *), va_arg(args, const uint8_t **)))
return false;
break;
@@ -503,32 +503,32 @@ osc_reader_arg_varlist(LV2_OSC_Reader *reader, const char *fmt, va_list args)
break;
case LV2_OSC_INT64:
- if(!osc_reader_get_int64(reader, va_arg(args, int64_t *)))
+ if(!lv2_osc_reader_get_int64(reader, va_arg(args, int64_t *)))
return false;
break;
case LV2_OSC_DOUBLE:
- if(!osc_reader_get_double(reader, va_arg(args, double *)))
+ if(!lv2_osc_reader_get_double(reader, va_arg(args, double *)))
return false;
break;
case LV2_OSC_TIMETAG:
- if(!osc_reader_get_timetag(reader, va_arg(args, uint64_t *)))
+ if(!lv2_osc_reader_get_timetag(reader, va_arg(args, uint64_t *)))
return false;
break;
case LV2_OSC_MIDI:
- if(!osc_reader_get_midi(reader, va_arg(args, const uint8_t **)))
+ if(!lv2_osc_reader_get_midi(reader, va_arg(args, const uint8_t **)))
return false;
break;
case LV2_OSC_SYMBOL:
- if(!osc_reader_get_symbol(reader, va_arg(args, const char **)))
+ if(!lv2_osc_reader_get_symbol(reader, va_arg(args, const char **)))
return false;
break;
case LV2_OSC_CHAR:
- if(!osc_reader_get_char(reader, va_arg(args, char *)))
+ if(!lv2_osc_reader_get_char(reader, va_arg(args, char *)))
return false;
break;
case LV2_OSC_RGBA:
- if(!osc_reader_get_rgba(reader, va_arg(args, uint8_t *), va_arg(args, uint8_t *),
+ if(!lv2_osc_reader_get_rgba(reader, va_arg(args, uint8_t *), va_arg(args, uint8_t *),
va_arg(args, uint8_t *), va_arg(args, uint8_t *)))
return false;
break;
@@ -539,12 +539,12 @@ osc_reader_arg_varlist(LV2_OSC_Reader *reader, const char *fmt, va_list args)
}
static inline bool
-osc_reader_arg_vararg(LV2_OSC_Reader *reader, const char *fmt, ...)
+lv2_osc_reader_arg_vararg(LV2_OSC_Reader *reader, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
- const bool res = osc_reader_arg_varlist(reader, fmt, args);
+ const bool res = lv2_osc_reader_arg_varlist(reader, fmt, args);
va_end(args);
@@ -552,13 +552,13 @@ osc_reader_arg_vararg(LV2_OSC_Reader *reader, const char *fmt, ...)
}
static inline bool
-osc_reader_is_bundle(LV2_OSC_Reader *reader)
+lv2_osc_reader_is_bundle(LV2_OSC_Reader *reader)
{
return strncmp((const char *)reader->ptr, "#bundle", 8) == 0;
}
static inline bool
-osc_reader_is_message(LV2_OSC_Reader *reader)
+lv2_osc_reader_is_message(LV2_OSC_Reader *reader)
{
return reader->ptr[0] == '/'; //FIXME check path
}
diff --git a/util.h b/osc.lv2/util.h
index 616bc6a..d1cb762 100644
--- a/util.h
+++ b/osc.lv2/util.h
@@ -21,7 +21,7 @@
#include <assert.h>
#include <ctype.h>
-#include <osc.h>
+#include <osc.lv2/osc.h>
#include <lv2/lv2plug.in/ns/ext/atom/util.h>
@@ -29,6 +29,9 @@
extern "C" {
#endif
+typedef void (*LV2_OSC_Method)(const char *path,
+ const LV2_Atom_Tuple *arguments, void *data);
+
// characters not allowed in OSC path string
static const char invalid_path_chars [] = {
' ', '#',
@@ -290,6 +293,55 @@ lv2_osc_message_get(LV2_OSC_URID *osc_urid, const LV2_Atom_Object *obj,
path, arguments);
}
+static inline bool
+lv2_osc_body_unroll(LV2_OSC_URID *osc_urid, uint32_t size, const LV2_Atom_Object_Body *body,
+ LV2_OSC_Method method, void *data)
+{
+ if(body->otype == osc_urid->OSC_Bundle)
+ {
+ const LV2_Atom_Object *timetag = NULL;
+ const LV2_Atom_Tuple *items = NULL;
+
+ if(!lv2_osc_bundle_body_get(osc_urid, size, body, &timetag, &items))
+ return false;
+
+ LV2_OSC_Timetag tt;
+ lv2_osc_timetag_get(osc_urid, timetag, &tt);
+
+ LV2_ATOM_TUPLE_FOREACH(items, atom)
+ {
+ const LV2_Atom_Object *obj= (const LV2_Atom_Object *)atom;
+
+ if(!lv2_osc_body_unroll(osc_urid, obj->atom.size, &obj->body, method, data))
+ return false;
+ }
+
+ return true;
+ }
+ else if(body->otype == osc_urid->OSC_Message)
+ {
+ const LV2_Atom_String *path = NULL;
+ const LV2_Atom_Tuple *arguments = NULL;
+
+ if(!lv2_osc_message_body_get(osc_urid, size, body, &path, &arguments))
+ return false;
+
+ if(method)
+ method(LV2_ATOM_BODY_CONST(path), arguments, data);
+
+ return true;
+ }
+
+ return false;
+}
+
+static inline bool
+lv2_osc_unroll(LV2_OSC_URID *osc_urid, const LV2_Atom_Object *obj,
+ LV2_OSC_Method method, void *data)
+{
+ return lv2_osc_body_unroll(osc_urid, obj->atom.size, &obj->body, method, data);
+}
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/writer.h b/osc.lv2/writer.h
index 32be35d..2cc89bb 100644
--- a/writer.h
+++ b/osc.lv2/writer.h
@@ -22,8 +22,8 @@
#include <string.h>
#include <endian.h>
-#include <osc.h>
-#include <util.h>
+#include <osc.lv2/osc.h>
+#include <osc.lv2/util.h>
#include <lv2/lv2plug.in/ns/ext/atom/util.h>
@@ -45,7 +45,7 @@ struct _LV2_OSC_Writer_Frame {
};
static inline void
-osc_writer_initialize(LV2_OSC_Writer *writer, uint8_t *buf, size_t size)
+lv2_osc_writer_initialize(LV2_OSC_Writer *writer, uint8_t *buf, size_t size)
{
writer->buf = buf;
writer->ptr = buf;
@@ -53,7 +53,7 @@ osc_writer_initialize(LV2_OSC_Writer *writer, uint8_t *buf, size_t size)
}
static inline size_t
-osc_writer_get_size(LV2_OSC_Writer *writer)
+lv2_osc_writer_get_size(LV2_OSC_Writer *writer)
{
if(writer->ptr > writer->buf)
return writer->ptr - writer->buf;
@@ -62,9 +62,9 @@ osc_writer_get_size(LV2_OSC_Writer *writer)
}
static inline uint8_t *
-osc_writer_finalize(LV2_OSC_Writer *writer, size_t *size)
+lv2_osc_writer_finalize(LV2_OSC_Writer *writer, size_t *size)
{
- *size = osc_writer_get_size(writer);
+ *size = lv2_osc_writer_get_size(writer);
if(*size)
return writer->buf;
@@ -73,15 +73,15 @@ osc_writer_finalize(LV2_OSC_Writer *writer, size_t *size)
}
static inline bool
-osc_writer_overflow(LV2_OSC_Writer *writer, size_t size)
+lv2_osc_writer_overflow(LV2_OSC_Writer *writer, size_t size)
{
return writer->ptr + size >= writer->end;
}
static inline bool
-osc_writer_htobe32(LV2_OSC_Writer *writer, union swap32_t *s32)
+lv2_osc_writer_htobe32(LV2_OSC_Writer *writer, union swap32_t *s32)
{
- if(osc_writer_overflow(writer, 4))
+ if(lv2_osc_writer_overflow(writer, 4))
return false;
s32->u = htobe32(s32->u);
@@ -92,9 +92,9 @@ osc_writer_htobe32(LV2_OSC_Writer *writer, union swap32_t *s32)
}
static inline bool
-osc_writer_htobe64(LV2_OSC_Writer *writer, union swap64_t *s64)
+lv2_osc_writer_htobe64(LV2_OSC_Writer *writer, union swap64_t *s64)
{
- if(osc_writer_overflow(writer, 8))
+ if(lv2_osc_writer_overflow(writer, 8))
return false;
s64->u = htobe64(s64->u);
@@ -105,22 +105,22 @@ osc_writer_htobe64(LV2_OSC_Writer *writer, union swap64_t *s64)
}
static inline bool
-osc_writer_add_int32(LV2_OSC_Writer *writer, int32_t i)
+lv2_osc_writer_add_int32(LV2_OSC_Writer *writer, int32_t i)
{
- return osc_writer_htobe32(writer, &(union swap32_t){ .i = i });
+ return lv2_osc_writer_htobe32(writer, &(union swap32_t){ .i = i });
}
static inline bool
-osc_writer_add_float(LV2_OSC_Writer *writer, float f)
+lv2_osc_writer_add_float(LV2_OSC_Writer *writer, float f)
{
- return osc_writer_htobe32(writer, &(union swap32_t){ .f = f });
+ return lv2_osc_writer_htobe32(writer, &(union swap32_t){ .f = f });
}
static inline bool
-osc_writer_add_string(LV2_OSC_Writer *writer, const char *s)
+lv2_osc_writer_add_string(LV2_OSC_Writer *writer, const char *s)
{
const size_t padded = LV2_OSC_PADDED_SIZE(strlen(s) + 1);
- if(osc_writer_overflow(writer, padded))
+ if(lv2_osc_writer_overflow(writer, padded))
return false;
strncpy((char *)writer->ptr, s, padded);
@@ -130,38 +130,38 @@ osc_writer_add_string(LV2_OSC_Writer *writer, const char *s)
}
static inline bool
-osc_writer_add_symbol(LV2_OSC_Writer *writer, const char *S)
+lv2_osc_writer_add_symbol(LV2_OSC_Writer *writer, const char *S)
{
- return osc_writer_add_string(writer, S);
+ return lv2_osc_writer_add_string(writer, S);
}
static inline bool
-osc_writer_add_int64(LV2_OSC_Writer *writer, int64_t h)
+lv2_osc_writer_add_int64(LV2_OSC_Writer *writer, int64_t h)
{
- return osc_writer_htobe64(writer, &(union swap64_t){ .h = h });
+ return lv2_osc_writer_htobe64(writer, &(union swap64_t){ .h = h });
}
static inline bool
-osc_writer_add_double(LV2_OSC_Writer *writer, double d)
+lv2_osc_writer_add_double(LV2_OSC_Writer *writer, double d)
{
- return osc_writer_htobe64(writer, &(union swap64_t){ .d = d });
+ return lv2_osc_writer_htobe64(writer, &(union swap64_t){ .d = d });
}
static inline bool
-osc_writer_add_timetag(LV2_OSC_Writer *writer, uint64_t u)
+lv2_osc_writer_add_timetag(LV2_OSC_Writer *writer, uint64_t u)
{
- return osc_writer_htobe64(writer, &(union swap64_t){ .u = u });
+ return lv2_osc_writer_htobe64(writer, &(union swap64_t){ .u = u });
}
static inline bool
-osc_writer_add_blob_inline(LV2_OSC_Writer *writer, int32_t len, uint8_t **body)
+lv2_osc_writer_add_blob_inline(LV2_OSC_Writer *writer, int32_t len, uint8_t **body)
{
const size_t len_padded = LV2_OSC_PADDED_SIZE(len);
const size_t size = 4 + len_padded;
- if(osc_writer_overflow(writer, size))
+ if(lv2_osc_writer_overflow(writer, size))
return false;
- if(!osc_writer_add_int32(writer, len))
+ if(!lv2_osc_writer_add_int32(writer, len))
return false;
*body = writer->ptr;
@@ -172,10 +172,10 @@ osc_writer_add_blob_inline(LV2_OSC_Writer *writer, int32_t len, uint8_t **body)
}
static inline bool
-osc_writer_add_blob(LV2_OSC_Writer *writer, int32_t len, const uint8_t *body)
+lv2_osc_writer_add_blob(LV2_OSC_Writer *writer, int32_t len, const uint8_t *body)
{
uint8_t *dst;
- if(!osc_writer_add_blob_inline(writer, len, &dst))
+ if(!lv2_osc_writer_add_blob_inline(writer, len, &dst))
return false;
memcpy(dst, body, len);
@@ -184,9 +184,9 @@ osc_writer_add_blob(LV2_OSC_Writer *writer, int32_t len, const uint8_t *body)
}
static inline bool
-osc_writer_add_midi_inline(LV2_OSC_Writer *writer, int32_t len, uint8_t **m)
+lv2_osc_writer_add_midi_inline(LV2_OSC_Writer *writer, int32_t len, uint8_t **m)
{
- if( (len > 4) || osc_writer_overflow(writer, 4))
+ if( (len > 4) || lv2_osc_writer_overflow(writer, 4))
return false;
*m = writer->ptr;
@@ -197,10 +197,10 @@ osc_writer_add_midi_inline(LV2_OSC_Writer *writer, int32_t len, uint8_t **m)
}
static inline bool
-osc_writer_add_midi(LV2_OSC_Writer *writer, int32_t len, const uint8_t *m)
+lv2_osc_writer_add_midi(LV2_OSC_Writer *writer, int32_t len, const uint8_t *m)
{
uint8_t *dst;
- if(!osc_writer_add_midi_inline(writer, len, &dst))
+ if(!lv2_osc_writer_add_midi_inline(writer, len, &dst))
return false;
memcpy(dst, m, len);
@@ -209,9 +209,9 @@ osc_writer_add_midi(LV2_OSC_Writer *writer, int32_t len, const uint8_t *m)
}
static inline bool
-osc_writer_add_rgba(LV2_OSC_Writer *writer, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
+lv2_osc_writer_add_rgba(LV2_OSC_Writer *writer, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
{
- if(osc_writer_overflow(writer, 4))
+ if(lv2_osc_writer_overflow(writer, 4))
return false;
writer->ptr[0] = r;
@@ -224,15 +224,15 @@ osc_writer_add_rgba(LV2_OSC_Writer *writer, uint8_t r, uint8_t g, uint8_t b, uin
}
static inline bool
-osc_writer_add_char(LV2_OSC_Writer *writer, char c)
+lv2_osc_writer_add_char(LV2_OSC_Writer *writer, char c)
{
- return osc_writer_add_int32(writer, (int32_t)c);
+ return lv2_osc_writer_add_int32(writer, (int32_t)c);
}
static inline bool
-osc_writer_push_bundle(LV2_OSC_Writer *writer, LV2_OSC_Writer_Frame *frame, uint64_t t)
+lv2_osc_writer_push_bundle(LV2_OSC_Writer *writer, LV2_OSC_Writer_Frame *frame, uint64_t t)
{
- if(osc_writer_overflow(writer, 16))
+ if(lv2_osc_writer_overflow(writer, 16))
return false;
frame->ref = writer->ptr;
@@ -240,11 +240,11 @@ osc_writer_push_bundle(LV2_OSC_Writer *writer, LV2_OSC_Writer_Frame *frame, uint
strncpy((char *)writer->ptr, "#bundle", 8);
writer->ptr += 8;
- return osc_writer_add_timetag(writer, t);
+ return lv2_osc_writer_add_timetag(writer, t);
}
static inline bool
-osc_writer_pop_bundle(LV2_OSC_Writer *writer, LV2_OSC_Writer_Frame *frame)
+lv2_osc_writer_pop_bundle(LV2_OSC_Writer *writer, LV2_OSC_Writer_Frame *frame)
{
union swap32_t s32 = { .i = writer->ptr - frame->ref - 16};
@@ -258,9 +258,9 @@ osc_writer_pop_bundle(LV2_OSC_Writer *writer, LV2_OSC_Writer_Frame *frame)
}
static inline bool
-osc_writer_push_item(LV2_OSC_Writer *writer, LV2_OSC_Writer_Frame *frame)
+lv2_osc_writer_push_item(LV2_OSC_Writer *writer, LV2_OSC_Writer_Frame *frame)
{
- if(osc_writer_overflow(writer, 4))
+ if(lv2_osc_writer_overflow(writer, 4))
return false;
frame->ref = writer->ptr;
@@ -270,7 +270,7 @@ osc_writer_push_item(LV2_OSC_Writer *writer, LV2_OSC_Writer_Frame *frame)
}
static inline bool
-osc_writer_pop_item(LV2_OSC_Writer *writer, LV2_OSC_Writer_Frame *frame)
+lv2_osc_writer_pop_item(LV2_OSC_Writer *writer, LV2_OSC_Writer_Frame *frame)
{
union swap32_t s32 = { .i = writer->ptr - frame->ref - 4};
@@ -287,16 +287,16 @@ osc_writer_pop_item(LV2_OSC_Writer *writer, LV2_OSC_Writer_Frame *frame)
}
static inline bool
-osc_writer_add_path(LV2_OSC_Writer *writer, const char *path)
+lv2_osc_writer_add_path(LV2_OSC_Writer *writer, const char *path)
{
- return osc_writer_add_string(writer, path);
+ return lv2_osc_writer_add_string(writer, path);
}
static inline bool
-osc_writer_add_format(LV2_OSC_Writer *writer, const char *fmt)
+lv2_osc_writer_add_format(LV2_OSC_Writer *writer, const char *fmt)
{
const size_t padded = LV2_OSC_PADDED_SIZE(strlen(fmt) + 2);
- if(osc_writer_overflow(writer, padded))
+ if(lv2_osc_writer_overflow(writer, padded))
return false;
*writer->ptr++ = ',';
@@ -307,26 +307,26 @@ osc_writer_add_format(LV2_OSC_Writer *writer, const char *fmt)
}
static inline bool
-osc_writer_arg_varlist(LV2_OSC_Writer *writer, const char *fmt, va_list args)
+lv2_osc_writer_arg_varlist(LV2_OSC_Writer *writer, const char *fmt, va_list args)
{
for(const char *type = fmt; *type; type++)
{
switch( (LV2_OSC_Type)*type)
{
case LV2_OSC_INT32:
- if(!osc_writer_add_int32(writer, va_arg(args, int32_t)))
+ if(!lv2_osc_writer_add_int32(writer, va_arg(args, int32_t)))
return false;
break;
case LV2_OSC_FLOAT:
- if(!osc_writer_add_float(writer, (float)va_arg(args, double)))
+ if(!lv2_osc_writer_add_float(writer, (float)va_arg(args, double)))
return false;
break;
case LV2_OSC_STRING:
- if(!osc_writer_add_string(writer, va_arg(args, const char *)))
+ if(!lv2_osc_writer_add_string(writer, va_arg(args, const char *)))
return false;
break;
case LV2_OSC_BLOB:
- if(!osc_writer_add_blob(writer, va_arg(args, int32_t), va_arg(args, const uint8_t *)))
+ if(!lv2_osc_writer_add_blob(writer, va_arg(args, int32_t), va_arg(args, const uint8_t *)))
return false;
break;
@@ -337,32 +337,32 @@ osc_writer_arg_varlist(LV2_OSC_Writer *writer, const char *fmt, va_list args)
break;
case LV2_OSC_INT64:
- if(!osc_writer_add_int64(writer, va_arg(args, int64_t)))
+ if(!lv2_osc_writer_add_int64(writer, va_arg(args, int64_t)))
return false;
break;
case LV2_OSC_DOUBLE:
- if(!osc_writer_add_double(writer, va_arg(args, double)))
+ if(!lv2_osc_writer_add_double(writer, va_arg(args, double)))
return false;
break;
case LV2_OSC_TIMETAG:
- if(!osc_writer_add_timetag(writer, va_arg(args, uint64_t)))
+ if(!lv2_osc_writer_add_timetag(writer, va_arg(args, uint64_t)))
return false;
break;
case LV2_OSC_MIDI:
- if(!osc_writer_add_midi(writer, va_arg(args, int32_t), va_arg(args, const uint8_t *)))
+ if(!lv2_osc_writer_add_midi(writer, va_arg(args, int32_t), va_arg(args, const uint8_t *)))
return false;
break;
case LV2_OSC_SYMBOL:
- if(!osc_writer_add_symbol(writer, va_arg(args, const char *)))
+ if(!lv2_osc_writer_add_symbol(writer, va_arg(args, const char *)))
return false;
break;
case LV2_OSC_CHAR:
- if(!osc_writer_add_char(writer, va_arg(args, int)))
+ if(!lv2_osc_writer_add_char(writer, va_arg(args, int)))
return false;
break;
case LV2_OSC_RGBA:
- if(!osc_writer_add_rgba(writer, va_arg(args, unsigned), va_arg(args, unsigned),
+ if(!lv2_osc_writer_add_rgba(writer, va_arg(args, unsigned), va_arg(args, unsigned),
va_arg(args, unsigned), va_arg(args, unsigned)))
return false;
break;
@@ -373,12 +373,12 @@ osc_writer_arg_varlist(LV2_OSC_Writer *writer, const char *fmt, va_list args)
}
static inline bool
-osc_writer_arg_vararg(LV2_OSC_Writer *writer, const char *fmt, ...)
+lv2_osc_writer_arg_vararg(LV2_OSC_Writer *writer, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
- const bool res = osc_writer_arg_varlist(writer, fmt, args);
+ const bool res = lv2_osc_writer_arg_varlist(writer, fmt, args);
va_end(args);
@@ -386,24 +386,24 @@ osc_writer_arg_vararg(LV2_OSC_Writer *writer, const char *fmt, ...)
}
static inline bool
-osc_writer_message_varlist(LV2_OSC_Writer *writer, const char *path, const char *fmt, va_list args)
+lv2_osc_writer_message_varlist(LV2_OSC_Writer *writer, const char *path, const char *fmt, va_list args)
{
- if(!osc_writer_add_path(writer, path))
+ if(!lv2_osc_writer_add_path(writer, path))
return false;
- if(!osc_writer_add_format(writer, fmt))
+ if(!lv2_osc_writer_add_format(writer, fmt))
return false;
- return osc_writer_arg_varlist(writer, fmt, args);
+ return lv2_osc_writer_arg_varlist(writer, fmt, args);
}
static inline bool
-osc_writer_message_vararg(LV2_OSC_Writer *writer, const char *path, const char *fmt, ...)
+lv2_osc_writer_message_vararg(LV2_OSC_Writer *writer, const char *path, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
- const bool res = osc_writer_message_varlist(writer, path, fmt, args);
+ const bool res = lv2_osc_writer_message_varlist(writer, path, fmt, args);
va_end(args);
@@ -411,7 +411,7 @@ osc_writer_message_vararg(LV2_OSC_Writer *writer, const char *path, const char *
}
static inline bool
-osc_writer_packet(LV2_OSC_Writer *writer, LV2_OSC_URID *osc_urid,
+lv2_osc_writer_packet(LV2_OSC_Writer *writer, LV2_OSC_URID *osc_urid,
LV2_URID_Unmap *unmap, uint32_t size, const LV2_Atom_Object_Body *body)
{
if(body->otype == osc_urid->OSC_Bundle)
@@ -426,7 +426,7 @@ osc_writer_packet(LV2_OSC_Writer *writer, LV2_OSC_URID *osc_urid,
LV2_OSC_Writer_Frame bndl;
lv2_osc_timetag_get(osc_urid, timetag, &tt);
- if(!osc_writer_push_bundle(writer, &bndl, lv2_osc_timetag_parse(&tt)))
+ if(!lv2_osc_writer_push_bundle(writer, &bndl, lv2_osc_timetag_parse(&tt)))
return false;
LV2_ATOM_TUPLE_FOREACH(items, atom)
@@ -434,15 +434,15 @@ osc_writer_packet(LV2_OSC_Writer *writer, LV2_OSC_URID *osc_urid,
const LV2_Atom_Object *obj= (const LV2_Atom_Object *)atom;
LV2_OSC_Writer_Frame itm;
- if( !osc_writer_push_item(writer, &itm)
- || !osc_writer_packet(writer, osc_urid, unmap, obj->atom.size, &obj->body)
- || !osc_writer_pop_item(writer, &itm) )
+ if( !lv2_osc_writer_push_item(writer, &itm)
+ || !lv2_osc_writer_packet(writer, osc_urid, unmap, obj->atom.size, &obj->body)
+ || !lv2_osc_writer_pop_item(writer, &itm) )
{
return false;
}
}
- return osc_writer_pop_bundle(writer, &bndl);
+ return lv2_osc_writer_pop_bundle(writer, &bndl);
}
else if(body->otype == osc_urid->OSC_Message)
{
@@ -451,7 +451,7 @@ osc_writer_packet(LV2_OSC_Writer *writer, LV2_OSC_URID *osc_urid,
if(lv2_osc_message_body_get(osc_urid, size, body, &path, &arguments))
{
- if(!osc_writer_add_path(writer, LV2_ATOM_BODY_CONST(path)))
+ if(!lv2_osc_writer_add_path(writer, LV2_ATOM_BODY_CONST(path)))
return false;
char fmt [128]; //TODO how big?
@@ -461,7 +461,7 @@ osc_writer_packet(LV2_OSC_Writer *writer, LV2_OSC_URID *osc_urid,
*ptr++ = lv2_osc_argument_type(osc_urid, atom);
}
*ptr = '\0';
- if(!osc_writer_add_format(writer, fmt))
+ if(!lv2_osc_writer_add_format(writer, fmt))
return false;
LV2_ATOM_TUPLE_FOREACH(arguments, atom)
@@ -470,40 +470,40 @@ osc_writer_packet(LV2_OSC_Writer *writer, LV2_OSC_URID *osc_urid,
if(atom->type == osc_urid->ATOM_Int)
{
- if(!osc_writer_add_int32(writer, ((const LV2_Atom_Int *)atom)->body))
+ if(!lv2_osc_writer_add_int32(writer, ((const LV2_Atom_Int *)atom)->body))
return false;
}
else if(atom->type == osc_urid->ATOM_Float)
{
- if(!osc_writer_add_float(writer, ((const LV2_Atom_Float *)atom)->body))
+ if(!lv2_osc_writer_add_float(writer, ((const LV2_Atom_Float *)atom)->body))
return false;
}
else if(atom->type == osc_urid->ATOM_String)
{
- if(!osc_writer_add_string(writer, LV2_ATOM_BODY_CONST(atom)))
+ if(!lv2_osc_writer_add_string(writer, LV2_ATOM_BODY_CONST(atom)))
return false;
}
else if(atom->type == osc_urid->ATOM_Chunk)
{
- if(!osc_writer_add_blob(writer, atom->size, LV2_ATOM_BODY_CONST(atom)))
+ if(!lv2_osc_writer_add_blob(writer, atom->size, LV2_ATOM_BODY_CONST(atom)))
return false;
}
else if(atom->type == osc_urid->ATOM_Long)
{
- if(!osc_writer_add_int64(writer, ((const LV2_Atom_Long *)atom)->body))
+ if(!lv2_osc_writer_add_int64(writer, ((const LV2_Atom_Long *)atom)->body))
return false;
}
else if(atom->type == osc_urid->ATOM_Double)
{
- if(!osc_writer_add_double(writer, ((const LV2_Atom_Double *)atom)->body))
+ if(!lv2_osc_writer_add_double(writer, ((const LV2_Atom_Double *)atom)->body))
return false;
}
else if( (atom->type == osc_urid->ATOM_Object) && (obj->body.otype == osc_urid->OSC_Timetag) )
{
LV2_OSC_Timetag tt;
lv2_osc_timetag_get(osc_urid, obj, &tt);
- if(!osc_writer_add_timetag(writer, lv2_osc_timetag_parse(&tt)))
+ if(!lv2_osc_writer_add_timetag(writer, lv2_osc_timetag_parse(&tt)))
return false;
}
@@ -512,13 +512,13 @@ osc_writer_packet(LV2_OSC_Writer *writer, LV2_OSC_URID *osc_urid,
else if(atom->type == osc_urid->ATOM_URID)
{
const char *symbol = unmap->unmap(unmap->handle, ((const LV2_Atom_URID *)atom)->body);
- if(!symbol || !osc_writer_add_symbol(writer, symbol))
+ if(!symbol || !lv2_osc_writer_add_symbol(writer, symbol))
return false;
}
else if(atom->type == osc_urid->MIDI_MidiEvent)
{
uint8_t *m = NULL;
- if(!osc_writer_add_midi_inline(writer, atom->size + 1, &m))
+ if(!lv2_osc_writer_add_midi_inline(writer, atom->size + 1, &m))
return false;
m[0] = 0x0; // port
memcpy(&m[1], LV2_ATOM_BODY_CONST(atom), atom->size);
@@ -526,13 +526,13 @@ osc_writer_packet(LV2_OSC_Writer *writer, LV2_OSC_URID *osc_urid,
else if(atom->type == osc_urid->OSC_Char)
{
const char c = *(const char *)LV2_ATOM_BODY_CONST(atom);
- if(!osc_writer_add_char(writer, c))
+ if(!lv2_osc_writer_add_char(writer, c))
return false;
}
else if(atom->type == osc_urid->OSC_RGBA)
{
const uint8_t *rgba = LV2_ATOM_BODY_CONST(atom);
- if(!osc_writer_add_rgba(writer, rgba[0], rgba[1], rgba[2], rgba[3]))
+ if(!lv2_osc_writer_add_rgba(writer, rgba[0], rgba[1], rgba[2], rgba[3]))
return false;
}
}
diff --git a/osc_test.c b/osc_test.c
index f131bb8..1280fc0 100644
--- a/osc_test.c
+++ b/osc_test.c
@@ -2,10 +2,10 @@
#include <string.h>
#include <stdio.h>
-#include <osc.h>
-#include <reader.h>
-#include <writer.h>
-#include <forge.h>
+#include <osc.lv2/osc.h>
+#include <osc.lv2/reader.h>
+#include <osc.lv2/writer.h>
+#include <osc.lv2/forge.h>
#define BUF_SIZE 8192
#define MAX_URIDS 512
@@ -175,60 +175,60 @@ _dump(const uint8_t *src, const uint8_t *dst, size_t size)
static void
_clone(LV2_OSC_Reader *reader, LV2_OSC_Writer *writer, size_t size)
{
- if(osc_reader_is_bundle(reader))
+ if(lv2_osc_reader_is_bundle(reader))
{
LV2_OSC_Item *itm = OSC_READER_BUNDLE_BEGIN(reader, size);
assert(itm);
LV2_OSC_Writer_Frame frame_bndl;
- assert(osc_writer_push_bundle(writer, &frame_bndl, itm->timetag));
+ assert(lv2_osc_writer_push_bundle(writer, &frame_bndl, itm->timetag));
OSC_READER_BUNDLE_ITERATE(reader, itm)
{
LV2_OSC_Reader reader2;
- osc_reader_initialize(&reader2, itm->body, itm->size);
+ lv2_osc_reader_initialize(&reader2, itm->body, itm->size);
LV2_OSC_Writer_Frame frame_itm;
- assert(osc_writer_push_item(writer, &frame_itm));
+ assert(lv2_osc_writer_push_item(writer, &frame_itm));
_clone(&reader2, writer, itm->size);
- assert(osc_writer_pop_item(writer, &frame_itm));
+ assert(lv2_osc_writer_pop_item(writer, &frame_itm));
}
- assert(osc_writer_pop_bundle(writer, &frame_bndl));
+ assert(lv2_osc_writer_pop_bundle(writer, &frame_bndl));
}
- else if(osc_reader_is_message(reader))
+ else if(lv2_osc_reader_is_message(reader))
{
LV2_OSC_Arg *arg = OSC_READER_MESSAGE_BEGIN(reader, size);
assert(arg);
- assert(osc_writer_add_path(writer, arg->path));
- assert(osc_writer_add_format(writer, arg->type));
+ assert(lv2_osc_writer_add_path(writer, arg->path));
+ assert(lv2_osc_writer_add_format(writer, arg->type));
OSC_READER_MESSAGE_ITERATE(reader, arg)
{
switch((LV2_OSC_Type)*arg->type)
{
case LV2_OSC_INT32:
- assert(osc_writer_add_int32(writer, arg->i));
+ assert(lv2_osc_writer_add_int32(writer, arg->i));
break;
case LV2_OSC_FLOAT:
- assert(osc_writer_add_float(writer, arg->f));
+ assert(lv2_osc_writer_add_float(writer, arg->f));
break;
case LV2_OSC_STRING:
- assert(osc_writer_add_string(writer, arg->s));
+ assert(lv2_osc_writer_add_string(writer, arg->s));
break;
case LV2_OSC_BLOB:
- assert(osc_writer_add_blob(writer, arg->size, arg->b));
+ assert(lv2_osc_writer_add_blob(writer, arg->size, arg->b));
break;
case LV2_OSC_INT64:
- assert(osc_writer_add_int64(writer, arg->h));
+ assert(lv2_osc_writer_add_int64(writer, arg->h));
break;
case LV2_OSC_DOUBLE:
- assert(osc_writer_add_double(writer, arg->d));
+ assert(lv2_osc_writer_add_double(writer, arg->d));
break;
case LV2_OSC_TIMETAG:
- assert(osc_writer_add_timetag(writer, arg->t));
+ assert(lv2_osc_writer_add_timetag(writer, arg->t));
break;
case LV2_OSC_TRUE:
@@ -238,16 +238,16 @@ _clone(LV2_OSC_Reader *reader, LV2_OSC_Writer *writer, size_t size)
break;
case LV2_OSC_MIDI:
- assert(osc_writer_add_midi(writer, arg->size, arg->m));
+ assert(lv2_osc_writer_add_midi(writer, arg->size, arg->m));
break;
case LV2_OSC_SYMBOL:
- assert(osc_writer_add_symbol(writer, arg->S));
+ assert(lv2_osc_writer_add_symbol(writer, arg->S));
break;
case LV2_OSC_CHAR:
- assert(osc_writer_add_char(writer, arg->c));
+ assert(lv2_osc_writer_add_char(writer, arg->c));
break;
case LV2_OSC_RGBA:
- assert(osc_writer_add_rgba(writer, arg->R, arg->G, arg->B, arg->A));
+ assert(lv2_osc_writer_add_rgba(writer, arg->R, arg->G, arg->B, arg->A));
break;
}
}
@@ -262,18 +262,18 @@ _test_a(LV2_OSC_Writer *writer, const uint8_t *raw, size_t size)
// check writer against raw bytes
size_t len;
- assert(osc_writer_finalize(writer, &len) == buf0);
+ assert(lv2_osc_writer_finalize(writer, &len) == buf0);
assert(len == size);
assert(memcmp(raw, buf0, size) == 0);
// check reader & writer
LV2_OSC_Reader reader;
- osc_reader_initialize(&reader, buf0, size);
- osc_writer_initialize(writer, buf1, BUF_SIZE);
+ lv2_osc_reader_initialize(&reader, buf0, size);
+ lv2_osc_writer_initialize(writer, buf1, BUF_SIZE);
_clone(&reader, writer, size);
// check cloned against raw bytes
- assert(osc_writer_finalize(writer, &len) == buf1);
+ assert(lv2_osc_writer_finalize(writer, &len) == buf1);
assert(len == size);
assert(memcmp(raw, buf1, size) == 0);
@@ -284,11 +284,11 @@ _test_a(LV2_OSC_Writer *writer, const uint8_t *raw, size_t size)
assert(lv2_osc_forge_packet(&forge, &osc_urid, &map, buf0, size));
// check deforge
- osc_writer_initialize(writer, buf1, BUF_SIZE);
- assert(osc_writer_packet(writer, &osc_urid, &unmap, obj2->atom.size, &obj2->body));
+ lv2_osc_writer_initialize(writer, buf1, BUF_SIZE);
+ assert(lv2_osc_writer_packet(writer, &osc_urid, &unmap, obj2->atom.size, &obj2->body));
// check deforged against raw bytes
- assert(osc_writer_finalize(writer, &len) == buf1);
+ assert(lv2_osc_writer_finalize(writer, &len) == buf1);
assert(len == size);
assert(memcmp(raw, buf1, size) == 0);
}
@@ -296,14 +296,14 @@ _test_a(LV2_OSC_Writer *writer, const uint8_t *raw, size_t size)
static void
test_0_a(LV2_OSC_Writer *writer)
{
- assert(osc_writer_message_vararg(writer, "/", ""));
+ assert(lv2_osc_writer_message_vararg(writer, "/", ""));
_test_a(writer, raw_0, sizeof(raw_0));
}
static void
test_1_a(LV2_OSC_Writer *writer)
{
- assert(osc_writer_message_vararg(writer, "/ping", "ifs",
+ assert(lv2_osc_writer_message_vararg(writer, "/ping", "ifs",
12, 3.4f, "world"));
_test_a(writer, raw_1, sizeof(raw_1));
}
@@ -311,7 +311,7 @@ test_1_a(LV2_OSC_Writer *writer)
static void
test_2_a(LV2_OSC_Writer *writer)
{
- assert(osc_writer_message_vararg(writer, "/ping", "hdS",
+ assert(lv2_osc_writer_message_vararg(writer, "/ping", "hdS",
12, 3.4, "http://example.com"));
_test_a(writer, raw_2, sizeof(raw_2));
}
@@ -319,7 +319,7 @@ test_2_a(LV2_OSC_Writer *writer)
static void
test_3_a(LV2_OSC_Writer *writer)
{
- assert(osc_writer_message_vararg(writer, "/ping", "TFNI"));
+ assert(lv2_osc_writer_message_vararg(writer, "/ping", "TFNI"));
_test_a(writer, raw_3, sizeof(raw_3));
}
@@ -327,7 +327,7 @@ static void
test_4_a(LV2_OSC_Writer *writer)
{
uint8_t m [] = {0x00, 0x90, 24, 0x7f};
- assert(osc_writer_message_vararg(writer, "/midi", "m", 4, m));
+ assert(lv2_osc_writer_message_vararg(writer, "/midi", "m", 4, m));
_test_a(writer, raw_4, sizeof(raw_4));
}
@@ -335,7 +335,7 @@ static void
test_5_a(LV2_OSC_Writer *writer)
{
uint8_t b [] = {0x1, 0x2, 0x3, 0x4, 0x5, 0x6};
- assert(osc_writer_message_vararg(writer, "/blob", "b", 6, b));
+ assert(lv2_osc_writer_message_vararg(writer, "/blob", "b", 6, b));
_test_a(writer, raw_5, sizeof(raw_5));
}
@@ -344,15 +344,15 @@ test_6_a(LV2_OSC_Writer *writer)
{
LV2_OSC_Writer_Frame frame_bndl, frame_itm;
- assert(osc_writer_push_bundle(writer, &frame_bndl, LV2_OSC_IMMEDIATE));
+ assert(lv2_osc_writer_push_bundle(writer, &frame_bndl, LV2_OSC_IMMEDIATE));
{
- assert(osc_writer_push_item(writer, &frame_itm));
+ assert(lv2_osc_writer_push_item(writer, &frame_itm));
{
- assert(osc_writer_message_vararg(writer, "/", ""));
+ assert(lv2_osc_writer_message_vararg(writer, "/", ""));
}
- assert(osc_writer_pop_item(writer, &frame_itm));
+ assert(lv2_osc_writer_pop_item(writer, &frame_itm));
}
- assert(osc_writer_pop_bundle(writer, &frame_bndl));
+ assert(lv2_osc_writer_pop_bundle(writer, &frame_bndl));
_test_a(writer, raw_6, sizeof(raw_6));
}
@@ -362,29 +362,29 @@ test_7_a(LV2_OSC_Writer *writer)
{
LV2_OSC_Writer_Frame frame_bndl[2], frame_itm[2];
- assert(osc_writer_push_bundle(writer, &frame_bndl[0], LV2_OSC_IMMEDIATE));
+ assert(lv2_osc_writer_push_bundle(writer, &frame_bndl[0], LV2_OSC_IMMEDIATE));
{
- assert(osc_writer_push_item(writer, &frame_itm[0]));
+ assert(lv2_osc_writer_push_item(writer, &frame_itm[0]));
{
- assert(osc_writer_push_bundle(writer, &frame_bndl[1], LV2_OSC_IMMEDIATE));
+ assert(lv2_osc_writer_push_bundle(writer, &frame_bndl[1], LV2_OSC_IMMEDIATE));
{
- assert(osc_writer_push_item(writer, &frame_itm[1]));
+ assert(lv2_osc_writer_push_item(writer, &frame_itm[1]));
{
- assert(osc_writer_message_vararg(writer, "/", ""));
+ assert(lv2_osc_writer_message_vararg(writer, "/", ""));
}
- assert(osc_writer_pop_item(writer, &frame_itm[1]));
+ assert(lv2_osc_writer_pop_item(writer, &frame_itm[1]));
}
- assert(osc_writer_pop_bundle(writer, &frame_bndl[1]));
+ assert(lv2_osc_writer_pop_bundle(writer, &frame_bndl[1]));
}
- assert(osc_writer_pop_item(writer, &frame_itm[0]));
+ assert(lv2_osc_writer_pop_item(writer, &frame_itm[0]));
- assert(osc_writer_push_item(writer, &frame_itm[0]));
+ assert(lv2_osc_writer_push_item(writer, &frame_itm[0]));
{
- assert(osc_writer_message_vararg(writer, "/", ""));
+ assert(lv2_osc_writer_message_vararg(writer, "/", ""));
}
- assert(osc_writer_pop_item(writer, &frame_itm[0]));
+ assert(lv2_osc_writer_pop_item(writer, &frame_itm[0]));
}
- assert(osc_writer_pop_bundle(writer, &frame_bndl[0]));
+ assert(lv2_osc_writer_pop_bundle(writer, &frame_bndl[0]));
_test_a(writer, raw_7, sizeof(raw_7));
}
@@ -414,7 +414,7 @@ main(int argc, char **argv)
memset(buf0, 0x0, BUF_SIZE);
memset(buf1, 0x0, BUF_SIZE);
- osc_writer_initialize(&writer, buf0, BUF_SIZE);
+ lv2_osc_writer_initialize(&writer, buf0, BUF_SIZE);
cb(&writer);
}
diff --git a/test/manifest.ttl.in b/test/manifest.ttl.in
deleted file mode 100644
index cb3328d..0000000
--- a/test/manifest.ttl.in
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (c) 2015-2016 Hanspeter Portner (dev@open-music-kontrollers.ch)
-#
-# This is free software: you can redistribute it and/or modify
-# it under the terms of the Artistic License 2.0 as published by
-# The Perl Foundation.
-#
-# This source is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# Artistic License 2.0 for more details.
-#
-# You should have received a copy of the Artistic License 2.0
-# along the source as a COPYING file. If not, obtain it from
-# http://www.perlfoundation.org/artistic_license_2_0.
-
-@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-
-@prefix osc: <http://open-music-kontrollers.ch/lv2/osc#> .
-
-# OSC Test
-osc:test
- a lv2:Plugin ;
- lv2:minorVersion @OSC_MINOR_VERSION@ ;
- lv2:microVersion @OSC_MICRO_VERSION@ ;
- lv2:binary <osc@CMAKE_SHARED_MODULE_SUFFIX@> ;
- rdfs:seeAlso <osc.ttl> .
diff --git a/test/osc.c b/test/osc.c
deleted file mode 100644
index 9316ed6..0000000
--- a/test/osc.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (c) 2015-2016 Hanspeter Portner (dev@open-music-kontrollers.ch)
- *
- * This is free software: you can redistribute it and/or modify
- * it under the terms of the Artistic License 2.0 as published by
- * The Perl Foundation.
- *
- * This source is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * Artistic License 2.0 for more details.
- *
- * You should have received a copy of the Artistic License 2.0
- * along the source as a COPYING file. If not, obtain it from
- * http://www.perlfoundation.org/artistic_license_2_0.
- */
-
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <osc.h>
-#include <writer.h>
-#include <reader.h>
-#include <forge.h>
-
-#include <lv2/lv2plug.in/ns/lv2core/lv2.h>
-#include <lv2/lv2plug.in/ns/ext/urid/urid.h>
-#include <lv2/lv2plug.in/ns/ext/atom/atom.h>
-#include <lv2/lv2plug.in/ns/ext/atom/forge.h>
-
-#define LV2_OSC_TEST_URI LV2_OSC_PREFIX"test"
-
-typedef struct _plughandle_t plughandle_t;
-
-struct _plughandle_t {
- LV2_URID_Map *map;
- LV2_Atom_Forge forge;
- LV2_Atom_Forge_Ref ref;
-
- LV2_OSC_Schedule *sched;
- LV2_URID osc_event;
-
- const LV2_Atom_Sequence *event_in;
- LV2_Atom_Sequence *event_out;
-};
-
-static LV2_Handle
-instantiate(const LV2_Descriptor* descriptor, double rate,
- const char *bundle_path, const LV2_Feature *const *features)
-{
- plughandle_t *handle = calloc(1, sizeof(plughandle_t));
- if(!handle)
- return NULL;
-
- for(unsigned i=0; features[i]; i++)
- {
- if(!strcmp(features[i]->URI, LV2_URID__map))
- handle->map = features[i]->data;
- else if(!strcmp(features[i]->URI, LV2_OSC__schedule))
- handle->sched= features[i]->data;
- }
-
- if(!handle->map)
- {
- fprintf(stderr,
- "%s: Host does not support urid:map\n", descriptor->URI);
- free(handle);
- return NULL;
- }
-
- handle->osc_event = handle->map->map(handle->map->handle, LV2_OSC__Event);
-
- lv2_atom_forge_init(&handle->forge, handle->map);
-
- return handle;
-}
-
-static void
-connect_port(LV2_Handle instance, uint32_t port, void *data)
-{
- plughandle_t *handle = (plughandle_t *)instance;
-
- switch(port)
- {
- case 0:
- handle->event_in = (const LV2_Atom_Sequence *)data;
- break;
- case 1:
- handle->event_out = (LV2_Atom_Sequence *)data;
- break;
- default:
- break;
- }
-}
-
-static inline void
-_osc_packet(plughandle_t *handle, LV2_OSC_Reader *reader, uint64_t timetag, int32_t size)
-{
- if(osc_reader_is_bundle(reader))
- {
- OSC_READER_BUNDLE_FOREACH(reader, itm, size)
- _osc_packet(handle, reader, itm->timetag, itm->size);
- }
- else if(osc_reader_is_message(reader))
- {
- OSC_READER_MESSAGE_FOREACH(reader, arg, size)
- printf("(%c %u) ", *arg->type, arg->size);
- printf("\n");
- }
-}
-
-static void
-run(LV2_Handle instance, uint32_t nsamples)
-{
- plughandle_t *handle = instance;
-
- uint32_t capacity = handle->event_out->atom.size;
- LV2_Atom_Forge_Frame frame;
- lv2_atom_forge_set_buffer(&handle->forge, (uint8_t *)handle->event_out, capacity);
- handle->ref = lv2_atom_forge_sequence_head(&handle->forge, &frame, 0);
-
- LV2_ATOM_SEQUENCE_FOREACH(handle->event_in, ev)
- {
- const LV2_Atom *atom = &ev->body;
-
- if(atom->type == handle->osc_event)
- {
- const uint8_t *body = LV2_ATOM_BODY_CONST(atom);
- LV2_OSC_Reader reader;
- osc_reader_initialize(&reader, body, atom->size);
-
- _osc_packet(handle, &reader, LV2_OSC_IMMEDIATE, atom->size);
- }
- }
-
- if(handle->ref)
- ;//FIXME handle->ref = osc_forge_message_vararg(&handle->forge, handle->osc_event, "/", "");
-
- if(handle->ref)
- lv2_atom_forge_pop(&handle->forge, &frame);
- else
- lv2_atom_sequence_clear(handle->event_out);
-}
-
-static void
-cleanup(LV2_Handle instance)
-{
- plughandle_t *handle = instance;
-
- free(handle);
-}
-
-const LV2_Descriptor osc_test = {
- .URI = LV2_OSC_TEST_URI,
- .instantiate = instantiate,
- .connect_port = connect_port,
- .activate = NULL,
- .run = run,
- .deactivate = NULL,
- .cleanup = cleanup,
- .extension_data = NULL
-};
-
-#ifdef _WIN32
-__declspec(dllexport)
-#else
-__attribute__((visibility("default")))
-#endif
-const LV2_Descriptor*
-lv2_descriptor(uint32_t index)
-{
- switch(index)
- {
- case 0:
- return &osc_test;
- default:
- return NULL;
- }
-}
diff --git a/test/osc.ttl b/test/osc.ttl
deleted file mode 100644
index 3e07146..0000000
--- a/test/osc.ttl
+++ /dev/null
@@ -1,83 +0,0 @@
-# Copyright (c) 2015-2016 Hanspeter Portner (dev@open-music-kontrollers.ch)
-#
-# This is free software: you can redistribute it and/or modify
-# it under the terms of the Artistic License 2.0 as published by
-# The Perl Foundation.
-#
-# This source is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# Artistic License 2.0 for more details.
-#
-# You should have received a copy of the Artistic License 2.0
-# along the source as a COPYING file. If not, obtain it from
-# http://www.perlfoundation.org/artistic_license_2_0.
-
-@prefix foaf: <http://xmlns.com/foaf/0.1/> .
-@prefix doap: <http://usefulinc.com/ns/doap#> .
-@prefix owl: <http://www.w3.org/2002/07/owl#> .
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
-@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
-@prefix atom: <http://lv2plug.in/ns/ext/atom#> .
-@prefix urid: <http://lv2plug.in/ns/ext/urid#> .
-
-@prefix lic: <http://opensource.org/licenses/> .
-@prefix omk: <http://open-music-kontrollers.ch/ventosus#> .
-@prefix proj: <http://open-music-kontrollers.ch/lv2/> .
-@prefix osc: <http://open-music-kontrollers.ch/lv2/osc#> .
-
-osc:schedule
- a lv2:Feature .
-
-osc:Event
- a rdfs:Class ,
- rdfs:Datatype ;
- rdfs:subClassOf atom:Atom ;
- owl:onDatatype xsd:hexBinary ;
- rdfs:label "OSC Event (Bundle or Message)" .
-
-# Maintainer
-omk:me
- a foaf:Person ;
- foaf:name "Hanspeter Portner" ;
- foaf:mbox <mailto:dev@open-music-kontrollers.ch> ;
- foaf:homepage <http://open-music-kontrollers.ch> .
-
-# Project
-proj:osc
- a doap:Project ;
- doap:maintainer omk:me ;
- doap:name "Props Bundle" .
-
-# OSC Test
-osc:test
- a lv2:Plugin ,
- lv2:ConverterPlugin ;
- doap:name "OSC Test" ;
- doap:license lic:Artistic-2.0 ;
- lv2:project proj:osc ;
- lv2:requiredFeature urid:map ;
- lv2:optionalFeature lv2:isLive, lv2:hardRTCapable, osc:schedule ;
-
- lv2:port [
- # sink event port
- a lv2:InputPort ,
- atom:AtomPort ;
- atom:bufferType atom:Sequence ;
- atom:supports osc:Event ;
- lv2:index 0 ;
- lv2:symbol "event_in" ;
- lv2:name "Event Input" ;
- lv2:designation lv2:control ;
- ] , [
- # source event port
- a lv2:OutputPort ,
- atom:AtomPort ;
- atom:bufferType atom:Sequence ;
- atom:supports osc:Event ;
- lv2:index 1 ;
- lv2:symbol "event_out" ;
- lv2:name "Event Output" ;
- lv2:designation lv2:control ;
- ] .