summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libs/engine/LV2Info.cpp2
-rw-r--r--src/libs/engine/LV2Info.hpp3
-rw-r--r--src/libs/engine/LV2Node.cpp7
-rw-r--r--src/libs/engine/OSCEngineReceiver.cpp6
-rw-r--r--src/libs/engine/events/SetPortValueEvent.cpp45
-rw-r--r--src/libs/gui/Configuration.cpp5
-rw-r--r--src/libs/gui/Port.cpp3
7 files changed, 53 insertions, 18 deletions
diff --git a/src/libs/engine/LV2Info.cpp b/src/libs/engine/LV2Info.cpp
index 4d934855..43dd014b 100644
--- a/src/libs/engine/LV2Info.cpp
+++ b/src/libs/engine/LV2Info.cpp
@@ -34,6 +34,8 @@ LV2Info::LV2Info(Ingen::Shared::World* world)
, event_class(slv2_value_new_uri(world->slv2_world, SLV2_PORT_CLASS_EVENT))
, _world(world)
{
+ assert(world);
+
LV2_Event_Feature* ev_data = (LV2_Event_Feature*)malloc(sizeof(LV2_Event_Feature));
ev_data->lv2_event_ref = &LV2Info::event_ref;
ev_data->lv2_event_unref = &LV2Info::event_ref;
diff --git a/src/libs/engine/LV2Info.hpp b/src/libs/engine/LV2Info.hpp
index d7da8185..f4859ac7 100644
--- a/src/libs/engine/LV2Info.hpp
+++ b/src/libs/engine/LV2Info.hpp
@@ -47,6 +47,9 @@ public:
SLV2Value control_class;
SLV2Value audio_class;
SLV2Value event_class;
+
+ Ingen::Shared::World& world() { return *_world; }
+ SLV2World lv2_world() { return _world->slv2_world; }
static uint32_t event_ref(LV2_Event_Callback_Data callback_data,
LV2_Event* event);
diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp
index d784f1d2..a3c20a95 100644
--- a/src/libs/engine/LV2Node.cpp
+++ b/src/libs/engine/LV2Node.cpp
@@ -198,6 +198,13 @@ LV2Node::instantiate()
if (direction == INPUT && data_type == DataType::CONTROL)
((AudioBuffer*)port->buffer(0))->set_value(def, 0, 0);
+
+ SLV2Value pred = slv2_value_new_uri(info->lv2_world(),
+ "http://lv2plug.in/ns/dev/contexts#context");
+ SLV2Values contexts = slv2_port_get_value(plug, id, pred);
+ if (slv2_values_size(contexts) > 0) {
+ cout << "PORT HAS CONTEXT!" << endl;
+ }
_ports->at(j) = port;
}
diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp
index dbdb388d..04352c2f 100644
--- a/src/libs/engine/OSCEngineReceiver.cpp
+++ b/src/libs/engine/OSCEngineReceiver.cpp
@@ -612,6 +612,12 @@ OSCEngineReceiver::_set_port_value_cb(const char* path, const char* types, lo_ar
size_t data_size = lo_blob_datasize(b);
void* data = lo_blob_dataptr(b);
set_voice_value(port_path, argv[2]->i, Atom(type, data_size, data));
+ } else if (!strcmp(types, "issN")) { // empty event (type only), all voices
+ const char* type = &argv[2]->s;
+ set_port_value(port_path, Atom(type, 0, NULL));
+ } else if (!strcmp(types, "isisN")) { // empty event (type only), specific voice
+ const char* type = &argv[3]->s;
+ set_voice_value(port_path, argv[2]->i, Atom(type, 0, NULL));
} else {
return 1;
}
diff --git a/src/libs/engine/events/SetPortValueEvent.cpp b/src/libs/engine/events/SetPortValueEvent.cpp
index f69ba9a3..90e66c1c 100644
--- a/src/libs/engine/events/SetPortValueEvent.cpp
+++ b/src/libs/engine/events/SetPortValueEvent.cpp
@@ -138,21 +138,36 @@ SetPortValueEvent::execute(ProcessContext& context)
}
EventBuffer* const ebuf = dynamic_cast<EventBuffer*>(buf);
- // FIXME: eliminate string comparisons
- if (ebuf && _value.type() == Atom::BLOB
- && !strcmp(_value.get_blob_type(), "lv2_midi:MidiEvent")) {
- const LV2Features::Feature* f = _engine.world()->lv2_features->feature(LV2_URI_MAP_URI);
- LV2URIMap* map = (LV2URIMap*)f->controller;
- const uint32_t type_id = map->uri_to_id(NULL, "http://lv2plug.in/ns/ext/midi#MidiEvent");
- const uint32_t frames = std::max((uint32_t)(_time - context.start()), ebuf->latest_frames());
- ebuf->prepare_write(context.start(), context.nframes());
- // FIXME: how should this work? binary over OSC, ick
- // Message is an event:
- ebuf->append(frames, 0, type_id, _value.data_size(), (const uint8_t*)_value.get_blob());
- // Message is an event buffer:
- //ebuf->append((LV2_Event_Buffer*)_data);
- _port->raise_set_by_user_flag();
- return;
+
+ const LV2Features::Feature* f = _engine.world()->lv2_features->feature(LV2_URI_MAP_URI);
+ LV2URIMap* map = (LV2URIMap*)f->controller;
+
+ // FIXME: eliminate lookups
+ // FIXME: need a proper prefix system
+ if (ebuf && _value.type() == Atom::BLOB) {
+ const uint32_t frames = std::max(
+ (uint32_t)(_time - context.start()),
+ ebuf->latest_frames());
+
+ // Size 0 event, pass it along to the plugin as a typed but empty event
+ if (_value.data_size() == 0) {
+ cout << "BANG!" << endl;
+ const uint32_t type_id = map->uri_to_id(NULL, _value.get_blob_type());
+ ebuf->append(frames, 0, type_id, 0, NULL);
+ _port->raise_set_by_user_flag();
+ return;
+
+ } else if (!strcmp(_value.get_blob_type(), "lv2_midi:MidiEvent")) {
+ const uint32_t type_id = map->uri_to_id(NULL,
+ "http://lv2plug.in/ns/ext/midi#MidiEvent");
+
+ ebuf->prepare_write(context.start(), context.nframes());
+ // FIXME: use OSC midi type? avoid MIDI over OSC entirely?
+ ebuf->append(frames, 0, type_id, _value.data_size(),
+ (const uint8_t*)_value.get_blob());
+ _port->raise_set_by_user_flag();
+ return;
+ }
}
diff --git a/src/libs/gui/Configuration.cpp b/src/libs/gui/Configuration.cpp
index a442b37c..758dc744 100644
--- a/src/libs/gui/Configuration.cpp
+++ b/src/libs/gui/Configuration.cpp
@@ -36,9 +36,10 @@ using namespace Ingen::Client;
Configuration::Configuration()
// Colours from the Tango palette with modified V and alpha
- : _audio_port_color( 0x244678C0)
+ : _name_style(HUMAN)
+ , _audio_port_color( 0x244678C0)
, _control_port_color(0x4A8A0EC0)
- , _event_port_color( 0x960909C0)
+ , _event_port_color( 0x960909C0)
// , _midi_port_color( 0x960909C0)
// , _osc_port_color( 0x5C3566C0)
{
diff --git a/src/libs/gui/Port.cpp b/src/libs/gui/Port.cpp
index fd35ff90..031c74c5 100644
--- a/src/libs/gui/Port.cpp
+++ b/src/libs/gui/Port.cpp
@@ -126,7 +126,8 @@ Port::set_control(float value, bool signal)
if (_port_model->type() == DataType::CONTROL) {
App::instance().engine()->set_port_value(_port_model->path(), Atom(value));
} else if (_port_model->type() == DataType::EVENT) {
- cout << "EVENT CONTROL" << endl;
+ App::instance().engine()->set_port_value(_port_model->path(),
+ Atom("<http://example.org/ev#BangEvent>", 0, NULL));
}
}