aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2015-12-09 18:48:17 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2015-12-09 18:48:17 +0100
commitc1d38c9c81ab0a4fa5fc669ac7806271b72e0670 (patch)
tree500dbcd57176f0b23b6ecb31e01a0e1725fdca71
parent4149f55d01fa516f267c0fdca3ebaa766b5b09c3 (diff)
downloadsynthpod-c1d38c9c81ab0a4fa5fc669ac7806271b72e0670.tar.xz
patcher support subtypes (MIDI, OSC, Time, Patch).
* add support for atom subtypes (MIDI, OSC, Time, Patch) in patcher * this is based on atom:supports in plugins ttl.
-rw-r--r--.travis.yml3
-rw-r--r--bundle/synthpod_bundle.ttl10
-rw-r--r--data/CMakeLists.txt7
-rw-r--r--lib/patcher.c2
-rw-r--r--lib/synthpod_private.h19
-rw-r--r--lib/synthpod_ui.c85
-rw-r--r--plugins/synthpod.ttl8
7 files changed, 123 insertions, 11 deletions
diff --git a/.travis.yml b/.travis.yml
index d601ee23..892fba51 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,8 +21,7 @@ before_install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo add-apt-repository -y ppa:andykimpe/cmake
- sudo add-apt-repository -y ppa:enlightenment-git/ppa
- - sudo apt-get -q update
- - sudo apt-get -q dist-upgrade
+ - sudo apt-get update -qq
install:
- if [ "$CC" = "clang" ]; then sudo apt-get install -y clang-3.6 libstdc++-5-dev; fi
- if [ "$CC" = "gcc" ]; then sudo apt-get install -y gcc-5 g++-5; fi
diff --git a/bundle/synthpod_bundle.ttl b/bundle/synthpod_bundle.ttl
index 661ab73a..5a43cc21 100644
--- a/bundle/synthpod_bundle.ttl
+++ b/bundle/synthpod_bundle.ttl
@@ -28,6 +28,12 @@
@prefix omk: <http://open-music-kontrollers.ch/ventosus#> .
@prefix proj: <http://open-music-kontrollers.ch/lv2/> .
@prefix synthpod: <http://open-music-kontrollers.ch/lv2/synthpod#> .
+@prefix osc: <http://open-music-kontrollers.ch/lv2/osc#> .
+
+osc:Event
+ a rdfs:Class ;
+ rdfs:subClassOf atom:Object ;
+ rdfs:label "OSC Event (Bundle or Message)" .
# system-port definitions
synthpod:systemPorts
@@ -100,6 +106,7 @@ synthpod:sink
atom:AtomPort ;
atom:bufferType atom:Sequence ;
atom:supports midi:MidiEvent ;
+ atom:supports osc:Event ;
atom:supports atom:Object ;
atom:supports time:Position ;
atom:supports patch:Message ;
@@ -191,6 +198,7 @@ synthpod:source
atom:AtomPort ;
atom:bufferType atom:Sequence ;
atom:supports midi:MidiEvent ;
+ atom:supports osc:Event ;
atom:supports atom:Object ;
atom:supports time:Position ;
atom:supports patch:Message ;
@@ -326,6 +334,7 @@ synthpod:osc_sink
synthpod:OSCPort ,
atom:AtomPort ;
atom:bufferType atom:Sequence ;
+ atom:supports osc:Event ;
atom:supports atom:Object ;
lv2:index 0 ;
lv2:symbol "osc_sink" ;
@@ -349,6 +358,7 @@ synthpod:osc_source
synthpod:OSCPort ,
atom:AtomPort ;
atom:bufferType atom:Sequence ;
+ atom:supports osc:Event ;
atom:supports atom:Object ;
lv2:index 0 ;
lv2:symbol "osc_source" ;
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
index 3a21e384..4229d8e5 100644
--- a/data/CMakeLists.txt
+++ b/data/CMakeLists.txt
@@ -32,6 +32,11 @@ add_custom_target(THEME ALL DEPENDS ${PROJECT_BINARY_DIR}/synthpod.edj)
install(FILES ${PROJECT_BINARY_DIR}/synthpod.edj DESTINATION ${SYNTHPOD_DATA_DIR})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pix/audio.png DESTINATION ${SYNTHPOD_DATA_DIR})
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pix/atom.png DESTINATION ${SYNTHPOD_DATA_DIR})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pix/control.png DESTINATION ${SYNTHPOD_DATA_DIR})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pix/cv.png DESTINATION ${SYNTHPOD_DATA_DIR})
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pix/atom.png DESTINATION ${SYNTHPOD_DATA_DIR})
+
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pix/midi.png DESTINATION ${SYNTHPOD_DATA_DIR})
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pix/osc.png DESTINATION ${SYNTHPOD_DATA_DIR})
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pix/time.png DESTINATION ${SYNTHPOD_DATA_DIR})
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pix/patch.png DESTINATION ${SYNTHPOD_DATA_DIR})
diff --git a/lib/patcher.c b/lib/patcher.c
index a290abc2..6b510ea7 100644
--- a/lib/patcher.c
+++ b/lib/patcher.c
@@ -25,7 +25,7 @@
#define PATCHER_DISCONNECT_REQUEST "disconnect,request"
#define PATCHER_REALIZE_REQUEST "realize,request"
-#define LEN 16
+#define LEN 12
typedef struct _patcher_t patcher_t;
diff --git a/lib/synthpod_private.h b/lib/synthpod_private.h
index 46983512..b49487ef 100644
--- a/lib/synthpod_private.h
+++ b/lib/synthpod_private.h
@@ -42,25 +42,36 @@
#include <lv2/lv2plug.in/ns/ext/port-props/port-props.h>
#include <lv2/lv2plug.in/ns/ext/port-groups/port-groups.h>
#include <lv2/lv2plug.in/ns/ext/state/state.h>
+#include <lv2/lv2plug.in/ns/ext/time/time.h>
#include <lv2/lv2plug.in/ns/extensions/ui/ui.h>
#include <lv2/lv2plug.in/ns/extensions/units/units.h>
#include <zero_worker.h>
#include <lv2_external_ui.h> // kxstudio kx-ui extension
typedef enum _port_type_t port_type_t;
+typedef enum _port_atom_type_t port_atom_type_t;
typedef enum _port_buffer_type_t port_buffer_type_t;
typedef enum _port_direction_t port_direction_t;
typedef enum _port_protocol_t port_protocol_t;
enum _port_type_t {
PORT_TYPE_AUDIO,
- PORT_TYPE_ATOM,
PORT_TYPE_CONTROL,
PORT_TYPE_CV,
+ PORT_TYPE_ATOM,
PORT_TYPE_NUM
};
+enum _port_atom_type_t {
+ PORT_ATOM_TYPE_ALL = 0,
+
+ PORT_ATOM_TYPE_MIDI = (1 << 0),
+ PORT_ATOM_TYPE_OSC = (1 << 1),
+ PORT_ATOM_TYPE_TIME = (1 << 2),
+ PORT_ATOM_TYPE_PATCH = (1 << 3)
+};
+
enum _port_buffer_type_t {
PORT_BUFFER_TYPE_NONE = 0,
PORT_BUFFER_TYPE_SEQUENCE,
@@ -108,6 +119,8 @@ struct _reg_t {
// atom sequence event types
reg_item_t midi;
+ reg_item_t osc_event;
+ reg_item_t time_position;
// control port property
reg_item_t integer;
@@ -312,6 +325,8 @@ sp_regs_init(reg_t *regs, LilvWorld *world, LV2_URID_Map *map)
_register(&regs->port.sequence, world, map, LV2_ATOM__Sequence);
_register(&regs->port.midi, world, map, LV2_MIDI__MidiEvent);
+ _register(&regs->port.osc_event, world, map, "http://open-music-kontrollers.ch/lv2/osc#Event");
+ _register(&regs->port.time_position, world, map, LV2_TIME__Position);
_register(&regs->port.integer, world, map, LV2_CORE__integer);
_register(&regs->port.enumeration, world, map, LV2_CORE__enumeration);
@@ -464,6 +479,8 @@ sp_regs_deinit(reg_t *regs)
_unregister(&regs->port.sequence);
_unregister(&regs->port.midi);
+ _unregister(&regs->port.osc_event);
+ _unregister(&regs->port.time_position);
_unregister(&regs->port.integer);
_unregister(&regs->port.enumeration);
diff --git a/lib/synthpod_ui.c b/lib/synthpod_ui.c
index 97227c24..835a80cc 100644
--- a/lib/synthpod_ui.c
+++ b/lib/synthpod_ui.c
@@ -221,6 +221,7 @@ struct _port_t {
port_direction_t direction; // input, output
port_type_t type; // audio, CV, control, atom
+ port_atom_type_t atom_type; // MIDI, OSC, Time
port_buffer_type_t buffer_type; // none, sequence
int patchable; // support patch:Message
@@ -311,6 +312,11 @@ struct _sp_ui_t {
Elm_Object_Item *matrix_atom;
Elm_Object_Item *matrix_control;
Elm_Object_Item *matrix_cv;
+ port_atom_type_t matrix_atom_type;
+ Elm_Object_Item *matrix_atom_midi;
+ Elm_Object_Item *matrix_atom_osc;
+ Elm_Object_Item *matrix_atom_time;
+ Elm_Object_Item *matrix_atom_patch;
Evas_Object *modlist;
@@ -2155,6 +2161,16 @@ _sp_ui_mod_add(sp_ui_t *ui, const char *uri, u_id_t uid, LV2_Handle inst,
// does this port support patch:Message?
tar->patchable = lilv_port_supports_event(plug, port, ui->regs.patch.message.node);
+
+ tar->atom_type = 0;
+ if(lilv_port_supports_event(plug, port, ui->regs.port.midi.node))
+ tar->atom_type |= PORT_ATOM_TYPE_MIDI;
+ if(lilv_port_supports_event(plug, port, ui->regs.port.osc_event.node))
+ tar->atom_type |= PORT_ATOM_TYPE_OSC;
+ if(lilv_port_supports_event(plug, port, ui->regs.port.time_position.node))
+ tar->atom_type |= PORT_ATOM_TYPE_TIME;
+ if(lilv_port_supports_event(plug, port, ui->regs.patch.message.node))
+ tar->atom_type |= PORT_ATOM_TYPE_PATCH;
}
// get port unit
@@ -2819,6 +2835,11 @@ _patches_update(sp_ui_t *ui)
if(!port->selected)
continue; // ignore unselected ports
+ if( (port->type == PORT_TYPE_ATOM)
+ && (ui->matrix_atom_type != PORT_ATOM_TYPE_ALL)
+ && !(port->atom_type & ui->matrix_atom_type))
+ continue;
+
count[port->direction][port->type] += 1;
}
}
@@ -2855,6 +2876,11 @@ _patches_update(sp_ui_t *ui)
if(port->type != ui->matrix_type)
continue; // ignore unselected port types
+ if( (port->type == PORT_TYPE_ATOM)
+ && (ui->matrix_atom_type != PORT_ATOM_TYPE_ALL)
+ && !(port->atom_type & ui->matrix_atom_type))
+ continue; // ignore unwanted atom types
+
LilvNode *name_node = lilv_port_get_name(mod->plug, port->tar);
const char *name_str = NULL;
if(name_node)
@@ -5112,15 +5138,48 @@ _patchbar_selected(void *data, Evas_Object *obj, void *event_info)
Elm_Object_Item *itm = event_info;
if(itm == ui->matrix_audio)
+ {
ui->matrix_type = PORT_TYPE_AUDIO;
- else if(itm == ui->matrix_atom)
- ui->matrix_type = PORT_TYPE_ATOM;
+ }
else if(itm == ui->matrix_control)
+ {
ui->matrix_type = PORT_TYPE_CONTROL;
+ }
else if(itm == ui->matrix_cv)
+ {
ui->matrix_type = PORT_TYPE_CV;
+ }
+ else if(itm == ui->matrix_atom)
+ {
+ ui->matrix_type = PORT_TYPE_ATOM;
+ ui->matrix_atom_type = PORT_ATOM_TYPE_ALL;
+ }
+
+ else if(itm == ui->matrix_atom_midi)
+ {
+ ui->matrix_type = PORT_TYPE_ATOM;
+ ui->matrix_atom_type = PORT_ATOM_TYPE_MIDI;
+ }
+ else if(itm == ui->matrix_atom_osc)
+ {
+ ui->matrix_type = PORT_TYPE_ATOM;
+ ui->matrix_atom_type = PORT_ATOM_TYPE_OSC;
+ }
+ else if(itm == ui->matrix_atom_time)
+ {
+ ui->matrix_type = PORT_TYPE_ATOM;
+ ui->matrix_atom_type = PORT_ATOM_TYPE_TIME;
+ }
+ else if(itm == ui->matrix_atom_patch)
+ {
+ ui->matrix_type = PORT_TYPE_ATOM;
+ ui->matrix_atom_type = PORT_ATOM_TYPE_PATCH;
+ }
+
else
+ {
return;
+ }
_patches_update(ui);
}
@@ -5677,6 +5736,7 @@ sp_ui_new(Evas_Object *win, const LilvWorld *world, sp_ui_driver_t *driver,
elm_toolbar_homogeneous_set(ui->patchbar, EINA_TRUE);
elm_toolbar_align_set(ui->patchbar, 0.f);
elm_toolbar_select_mode_set(ui->patchbar, ELM_OBJECT_SELECT_MODE_ALWAYS);
+ elm_toolbar_shrink_mode_set(ui->patchbar, ELM_TOOLBAR_SHRINK_SCROLL);
evas_object_smart_callback_add(ui->patchbar, "selected", _patchbar_selected, ui);
evas_object_size_hint_weight_set(ui->patchbar, EVAS_HINT_EXPAND, 0.f);
evas_object_size_hint_align_set(ui->patchbar, EVAS_HINT_FILL, 0.f);
@@ -5684,14 +5744,27 @@ sp_ui_new(Evas_Object *win, const LilvWorld *world, sp_ui_driver_t *driver,
elm_box_pack_end(ui->patchbox, ui->patchbar);
ui->matrix_audio = elm_toolbar_item_append(ui->patchbar,
- SYNTHPOD_DATA_DIR"/audio.png", "AUDIO", NULL, NULL);
+ SYNTHPOD_DATA_DIR"/audio.png", "Audio", NULL, NULL);
elm_toolbar_item_selected_set(ui->matrix_audio, EINA_TRUE);
- ui->matrix_atom = elm_toolbar_item_append(ui->patchbar,
- SYNTHPOD_DATA_DIR"/atom.png", "ATOM", NULL, NULL);
ui->matrix_control = elm_toolbar_item_append(ui->patchbar,
- SYNTHPOD_DATA_DIR"/control.png", "CONTROL", NULL, NULL);
+ SYNTHPOD_DATA_DIR"/control.png", "Control", NULL, NULL);
ui->matrix_cv = elm_toolbar_item_append(ui->patchbar,
SYNTHPOD_DATA_DIR"/cv.png", "CV", NULL, NULL);
+ ui->matrix_atom = elm_toolbar_item_append(ui->patchbar,
+ SYNTHPOD_DATA_DIR"/atom.png", "Atom", NULL, NULL);
+
+ Elm_Object_Item *sep = elm_toolbar_item_append(ui->patchbar,
+ NULL, NULL, NULL, NULL);
+ elm_toolbar_item_separator_set(sep, EINA_TRUE);
+
+ ui->matrix_atom_midi = elm_toolbar_item_append(ui->patchbar,
+ SYNTHPOD_DATA_DIR"/midi.png", "MIDI", NULL, NULL);
+ ui->matrix_atom_osc = elm_toolbar_item_append(ui->patchbar,
+ SYNTHPOD_DATA_DIR"/osc.png", "OSC", NULL, NULL);
+ ui->matrix_atom_time = elm_toolbar_item_append(ui->patchbar,
+ SYNTHPOD_DATA_DIR"/time.png", "Time", NULL, NULL);
+ ui->matrix_atom_patch = elm_toolbar_item_append(ui->patchbar,
+ SYNTHPOD_DATA_DIR"/patch.png", "Patch", NULL, NULL);
} // patchbar
ui->matrix = patcher_object_add(ui->patchbox);
diff --git a/plugins/synthpod.ttl b/plugins/synthpod.ttl
index fdfc85d2..3b1abfbc 100644
--- a/plugins/synthpod.ttl
+++ b/plugins/synthpod.ttl
@@ -43,6 +43,12 @@
@prefix synthpod: <http://open-music-kontrollers.ch/lv2/synthpod#> .
@prefix zwork: <http://open-music-kontrollers.ch/lv2/zero-worker#> .
@prefix zwrite: <http://open-music-kontrollers.ch/lv2/zero-writer#> .
+@prefix osc: <http://open-music-kontrollers.ch/lv2/osc#> .
+
+osc:Event
+ a rdfs:Class ;
+ rdfs:subClassOf atom:Object ;
+ rdfs:label "OSC Event (Bundle or Message)" .
# to please sord_validate
zwork:interface
@@ -136,6 +142,7 @@ synthpod:stereo
atom:AtomPort ;
atom:bufferType atom:Sequence ;
atom:supports midi:MidiEvent ;
+ atom:supports osc:Event ;
atom:supports atom:Object ;
atom:supports time:Position ;
atom:supports patch:Message ;
@@ -150,6 +157,7 @@ synthpod:stereo
atom:AtomPort ;
atom:bufferType atom:Sequence ;
atom:supports midi:MidiEvent ;
+ atom:supports osc:Event ;
atom:supports atom:Object ;
atom:supports time:Position ;
atom:supports patch:Message ;