summaryrefslogtreecommitdiff
path: root/lv2
diff options
context:
space:
mode:
authorJonas Suhr Christensen <jsc@umbraculum.org>2014-03-07 04:25:52 +0100
committerJonas Suhr Christensen <jsc@umbraculum.org>2014-03-07 04:25:52 +0100
commit74b8a63270c1c0b01b33e861c26b1e2a59eeb82b (patch)
tree799aaec0d88e50172e17b61af37ca391a83d59d3 /lv2
parent75702e36ddb30ca2924cb42dc0b44ddfbdac36e5 (diff)
Changed midi handling from event extension to atom extension.
Diffstat (limited to 'lv2')
-rw-r--r--lv2/drumgizmo.ttl11
-rw-r--r--lv2/input_lv2.cc17
-rw-r--r--lv2/input_lv2.h4
-rw-r--r--lv2/lv2.cc5
4 files changed, 20 insertions, 17 deletions
diff --git a/lv2/drumgizmo.ttl b/lv2/drumgizmo.ttl
index c72b34a..23345f3 100644
--- a/lv2/drumgizmo.ttl
+++ b/lv2/drumgizmo.ttl
@@ -16,7 +16,7 @@
@prefix doap: <http://usefulinc.com/ns/doap#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
-@prefix lv2ev: <http://lv2plug.in/ns/ext/event#> .
+@prefix atom: <http://lv2plug.in/ns/ext/atom#> .
@prefix uiext: <http://lv2plug.in/ns/extensions/ui#> .
@prefix state: <http://lv2plug.in/ns/ext/state#> .
@@ -38,10 +38,11 @@
lv2:optionalFeature <http://lv2plug.in/ns/ext/event> ;
lv2:extensionData state:interface ;
lv2:port [
- a lv2:InputPort ,
- lv2ev:EventPort ;
- lv2ev:supportsEvent <http://lv2plug.in/ns/ext/midi#MidiEvent> ;
- lv2:index 0 ;
+ a atom:AtomPort ,
+ lv2:InputPort;
+ atom:bufferType atom:Sequence ;
+ atom:supports <http://lv2plug.in/ns/ext/midi#MidiEvent> ;
+ lv2:index 0 ;
lv2:symbol "control" ;
lv2:name "Control"
] , [
diff --git a/lv2/input_lv2.cc b/lv2/input_lv2.cc
index 0d97760..d995e75 100644
--- a/lv2/input_lv2.cc
+++ b/lv2/input_lv2.cc
@@ -26,6 +26,8 @@
*/
#include "input_lv2.h"
+#include "lv2/lv2plug.in/ns/ext/atom/util.h"
+
#include <midimapparser.h>
#include <hugin.hpp>
@@ -70,14 +72,12 @@ event_t *InputLV2::run(size_t pos, size_t len, size_t *nevents)
list = (event_t *)malloc(sizeof(event_t) * 1000);
listsize = 0;
- LV2_Event_Iterator iterator;
- for(lv2_event_begin(&iterator, eventPort);
- lv2_event_is_valid(&iterator);
- lv2_event_increment(&iterator)) {
-
- LV2_Event* ev = lv2_event_get(&iterator, NULL);
+ LV2_Atom_Event* ev = lv2_atom_sequence_begin(&eventPort->body);
- uint8_t* const data = (uint8_t* const)(ev + 1);
+ while(!lv2_atom_sequence_is_end(&eventPort->body,
+ eventPort->atom.size,
+ ev)) {
+ uint8_t* const data = (uint8_t*)(ev+1);
if ((data[0] & 0xF0) == 0x80) { // note off
int key = data[1];
@@ -96,7 +96,7 @@ event_t *InputLV2::run(size_t pos, size_t len, size_t *nevents)
list[listsize].type = TYPE_ONSET;
list[listsize].instrument = i;
list[listsize].velocity = velocity / 127.0;
- list[listsize].offset = ev->frames;
+ list[listsize].offset = ev->time.frames;
listsize++;
}
/*
@@ -105,6 +105,7 @@ event_t *InputLV2::run(size_t pos, size_t len, size_t *nevents)
plugin->play = true;
*/
}
+ ev = lv2_atom_sequence_next(ev);
}
*nevents = listsize;
diff --git a/lv2/input_lv2.h b/lv2/input_lv2.h
index aa39a23..32e2fd8 100644
--- a/lv2/input_lv2.h
+++ b/lv2/input_lv2.h
@@ -29,7 +29,7 @@
#include <audioinputenginemidi.h>
-#include <lv2/lv2plug.in/ns/ext/event/event-helpers.h>
+#include <lv2/lv2plug.in/ns/ext/atom/atom.h>
class InputLV2 : public AudioInputEngineMidi {
public:
@@ -47,7 +47,7 @@ public:
event_t *run(size_t pos, size_t len, size_t *nevents);
void post();
- LV2_Event_Buffer *eventPort;
+ LV2_Atom_Sequence *eventPort;
private:
Instruments *instruments;
diff --git a/lv2/lv2.cc b/lv2/lv2.cc
index c1f1ecc..3aeb5f0 100644
--- a/lv2/lv2.cc
+++ b/lv2/lv2.cc
@@ -27,6 +27,7 @@
#include <lv2/lv2plug.in/ns/lv2core/lv2.h>
#include <stdlib.h>
+#include <string.h>
#include "lv2_gui.h"
@@ -34,7 +35,7 @@
#include <hugin.hpp>
-#define MIDI_EVENT_URI "http://lv2plug.in/ns/ext/midi#MidiEvent"
+#include <lv2/lv2plug.in/ns/ext/atom/atom.h>
#define NS_ATOM "http://lv2plug.in/ns/ext/atom#"
#define NS_DG "http://drumgizmo.org/lv2/atom#"
@@ -310,7 +311,7 @@ void connect_port(LV2_Handle instance,
DGLV2 *dglv2 = (DGLV2 *)instance;
if(port == 0) {// MIDI in
- dglv2->in->eventPort = (LV2_Event_Buffer*)data_location;
+ dglv2->in->eventPort = (LV2_Atom_Sequence*)data_location;
} else {// Audio Port
if(port - 1 < NUM_OUTPUTS) {
dglv2->out->outputPorts[port - 1].samples = (sample_t*)data_location;