aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--atom_inspector.c27
-rw-r--r--atom_inspector_ui.c25
-rw-r--r--sherlock.ttl63
3 files changed, 89 insertions, 26 deletions
diff --git a/atom_inspector.c b/atom_inspector.c
index 2bf358a..6c8174a 100644
--- a/atom_inspector.c
+++ b/atom_inspector.c
@@ -26,6 +26,8 @@ struct _handle_t {
LV2_URID_Map *map;
const LV2_Atom_Sequence *control_in;
LV2_Atom_Sequence *control_out;
+ LV2_Atom_Sequence *notify;
+ LV2_Atom_Forge forge;
};
static LV2_Handle
@@ -48,6 +50,8 @@ instantiate(const LV2_Descriptor* descriptor, double rate,
return NULL;
}
+ lv2_atom_forge_init(&handle->forge, handle->map);
+
return handle;
}
@@ -64,6 +68,9 @@ connect_port(LV2_Handle instance, uint32_t port, void *data)
case 1:
handle->control_out = (LV2_Atom_Sequence *)data;
break;
+ case 2:
+ handle->notify = (LV2_Atom_Sequence *)data;
+ break;
default:
break;
}
@@ -81,9 +88,25 @@ run(LV2_Handle instance, uint32_t nsamples)
{
handle_t *handle = (handle_t *)instance;
+ // size of input sequence
+ size_t size = handle->control_in->atom.size;
+
// copy whole sequence
- size_t size = sizeof(LV2_Atom) + handle->control_in->atom.size;
- memcpy(handle->control_out, handle->control_in, size);
+ memcpy(handle->control_out, handle->control_in, sizeof(LV2_Atom) + size);
+
+ // forge whole sequence as single event
+ uint32_t capacity = handle->notify->atom.size;
+ LV2_Atom_Forge *forge = &handle->forge;
+ LV2_Atom_Forge_Frame frame;
+
+ lv2_atom_forge_set_buffer(forge, (uint8_t *)handle->notify, capacity);
+ lv2_atom_forge_sequence_head(forge, &frame, 0);
+
+ lv2_atom_forge_frame_time(forge, 0);
+ lv2_atom_forge_raw(forge, handle->control_in, sizeof(LV2_Atom) + size);
+ lv2_atom_forge_pad(forge, size);
+
+ lv2_atom_forge_pop(forge, &frame);
}
static void
diff --git a/atom_inspector_ui.c b/atom_inspector_ui.c
index 59db9ee..299dbc4 100644
--- a/atom_inspector_ui.c
+++ b/atom_inspector_ui.c
@@ -44,7 +44,7 @@ struct _UI {
LV2_URID_Unmap *unmap;
struct {
LV2_URID midi_MidiEvent;
- LV2_URID atom_transfer;
+ LV2_URID event_transfer;
} uris;
LV2_Atom_Forge forge;
@@ -62,9 +62,7 @@ struct _UI {
static inline int
_is_expandable(UI *ui, const uint32_t type)
{
- return (type == ui->forge.Object)
- || (type == ui->forge.Blank)
- || (type == ui->forge.Resource)
+ return lv2_atom_forge_is_object_type(&ui->forge, type)
|| (type == ui->forge.Tuple)
|| (type == ui->forge.Vector);
}
@@ -89,19 +87,18 @@ _atom_item_label_get(void *data, Evas_Object *obj, const char *part)
char buf [1024];
char *ptr = buf;
char *end = buf + 1024;
-
+
const char *type = ui->unmap->unmap(ui->unmap->handle, atom->type);
sprintf(ptr, URI("type ", "%s</br>"), type);
ptr += strlen(ptr);
- if( (atom->type == ui->forge.Object)
- || (atom->type == ui->forge.Blank)
- || (atom->type == ui->forge.Resource) )
+ if(lv2_atom_forge_is_object_type(&ui->forge, atom->type))
{
const LV2_Atom_Object *atom_object = data;
- const char *id = ui->unmap->unmap(ui->unmap->handle,
- atom_object->body.id);
+ const char *id = atom_object->body.id
+ ? ui->unmap->unmap(ui->unmap->handle, atom_object->body.id)
+ : "";
const char *otype = ui->unmap->unmap(ui->unmap->handle,
atom_object->body.otype);
@@ -393,9 +390,7 @@ _atom_expand(UI *ui, const void *data, Evas_Object *obj, Elm_Object_Item *itm)
{
const LV2_Atom *atom = data;
- if( (atom->type == ui->forge.Object)
- || (atom->type == ui->forge.Resource)
- || (atom->type == ui->forge.Blank) )
+ if(lv2_atom_forge_is_object_type(&ui->forge, atom->type))
{
const LV2_Atom_Object *atom_object = (const LV2_Atom_Object *)atom;
//const LV2_Atom_Property_Body *prop;
@@ -604,7 +599,7 @@ instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri,
}
ui->uris.midi_MidiEvent = ui->map->map(ui->map->handle, LV2_MIDI__MidiEvent);
- ui->uris.atom_transfer = ui->map->map(ui->map->handle, LV2_ATOM__atomTransfer);
+ ui->uris.event_transfer = ui->map->map(ui->map->handle, LV2_ATOM__eventTransfer);
lv2_atom_forge_init(&ui->forge, ui->map);
@@ -671,7 +666,7 @@ port_event(LV2UI_Handle handle, uint32_t i, uint32_t size, uint32_t urid,
{
UI *ui = handle;
- if( (i == 0) && (urid == ui->uris.atom_transfer) )
+ if( (i == 2) && (urid == ui->uris.event_transfer) )
{
const LV2_Atom_Sequence *seq = buf;
diff --git a/sherlock.ttl b/sherlock.ttl
index 1eac211..4b97198 100644
--- a/sherlock.ttl
+++ b/sherlock.ttl
@@ -22,7 +22,7 @@
@prefix ui: <http://lv2plug.in/ns/extensions/ui#> .
@prefix midi: <http://lv2plug.in/ns/ext/midi#> .
@prefix time: <http://lv2plug.in/ns/ext/time#> .
-@prefix kx: <http://kxstudio.sf.net/ns/lv2ext/external-ui#> .
+@prefix kx: <http://kxstudio.sf.net/ns/lv2ext/external-ui#> .
@prefix osc: <http://opensoundcontrol.org#> .
@prefix lic: <http://opensource.org/licenses/> .
@@ -49,15 +49,15 @@ sherlock:atom_inspector_eo
a ui:EoUI ;
ui:portNotification [
ui:plugin sherlock:atom_inspector ;
- lv2:symbol "control_in" ;
- ui:protocol atom:atomTransfer ;
+ lv2:symbol "notify" ;
+ ui:protocol atom:eventTransfer ;
] .
sherlock:atom_inspector_ui
a ui:UI ;
ui:portNotification [
ui:plugin sherlock:atom_inspector ;
- lv2:symbol "control_in" ;
- ui:protocol atom:atomTransfer ;
+ lv2:symbol "notify" ;
+ ui:protocol atom:eventTransfer ;
] ;
lv2:requiredFeature ui:idleInterface ;
lv2:extensionData ui:idleInterface, ui:showInterface .
@@ -65,8 +65,8 @@ sherlock:atom_inspector_x11
a ui:X11UI ;
ui:portNotification [
ui:plugin sherlock:atom_inspector ;
- lv2:symbol "control_in" ;
- ui:protocol atom:atomTransfer ;
+ lv2:symbol "notify" ;
+ ui:protocol atom:eventTransfer ;
] ;
lv2:requiredFeature ui:idleInterface ;
lv2:optionalFeature ui:resize ;
@@ -75,8 +75,8 @@ sherlock:atom_inspector_kx
a kx:Widget ;
ui:portNotification [
ui:plugin sherlock:atom_inspector ;
- lv2:symbol "control_in" ;
- ui:protocol atom:atomTransfer ;
+ lv2:symbol "notify" ;
+ ui:protocol atom:eventTransfer ;
] ;
lv2:requiredFeature kx:Host .
@@ -95,7 +95,25 @@ sherlock:atom_inspector
atom:AtomPort ;
atom:bufferType atom:Sequence ;
atom:supports midi:MidiEvent ;
+ atom:supports time:Position ;
+ atom:supports atom:Blank ;
+ atom:supports atom:Bool ;
+ atom:supports atom:Chunk ;
+ atom:supports atom:Double ;
+ atom:supports atom:Float ;
+ atom:supports atom:Int ;
+ atom:supports atom:Long ;
+ atom:supports atom:Literal ;
atom:supports atom:Object ;
+ atom:supports atom:Path ;
+ atom:supports atom:Property ;
+ atom:supports atom:Resource ;
+ atom:supports atom:Sequence ;
+ atom:supports atom:String ;
+ atom:supports atom:Tuple ;
+ atom:supports atom:URI ;
+ atom:supports atom:URID ;
+ atom:supports atom:Vector ;
lv2:index 0 ;
lv2:symbol "control_in" ;
lv2:name "Control In" ;
@@ -106,9 +124,36 @@ sherlock:atom_inspector
atom:AtomPort ;
atom:bufferType atom:Sequence ;
atom:supports midi:MidiEvent ;
+ atom:supports time:Position ;
+ atom:supports atom:Blank ;
+ atom:supports atom:Bool ;
+ atom:supports atom:Chunk ;
+ atom:supports atom:Double ;
+ atom:supports atom:Float ;
+ atom:supports atom:Int ;
+ atom:supports atom:Long ;
+ atom:supports atom:Literal ;
atom:supports atom:Object ;
+ atom:supports atom:Path ;
+ atom:supports atom:Property ;
+ atom:supports atom:Resource ;
+ atom:supports atom:Sequence ;
+ atom:supports atom:String ;
+ atom:supports atom:Tuple ;
+ atom:supports atom:URI ;
+ atom:supports atom:URID ;
+ atom:supports atom:Vector ;
lv2:index 1 ;
lv2:symbol "control_out" ;
lv2:name "Control Out" ;
lv2:designation lv2:control ;
+ ] , [
+ # output notify port
+ a lv2:OutputPort ,
+ atom:AtomPort ;
+ atom:bufferType atom:Sequence ;
+ atom:supports atom:Sequence ;
+ lv2:index 2 ;
+ lv2:symbol "notify" ;
+ lv2:name "Notify" ;
] .