LilvNode* lv2_enumeration;
LilvNode* lv2_freewheeling;
LilvNode* lv2_inPlaceBroken;
+ LilvNode* lv2_isSideChain;
LilvNode* lv2_integer;
LilvNode* lv2_default;
LilvNode* lv2_minimum;
}
}
+#ifdef LV2_EXTENDED
+/* inline display extension */
+static void
+queue_draw (LV2_Inline_Display_Handle handle)
+{
+ LV2Plugin* plugin = (LV2Plugin*)handle;
+ plugin->QueueDraw(); /* EMIT SIGNAL */
+}
+#endif
+
/* log extension */
static int
, block_length(0)
#ifdef HAVE_LV2_1_2_0
, options(0)
+#endif
+#ifdef LV2_EXTENDED
+ , queue_draw(0)
#endif
{}
#ifdef HAVE_LV2_1_2_0
LV2_Options_Option* options;
#endif
+#ifdef LV2_EXTENDED
+ LV2_Inline_Display* queue_draw;
+#endif
};
LV2Plugin::LV2Plugin (AudioEngine& engine,
_was_activated = false;
_has_state_interface = false;
_can_write_automation = false;
+ _max_latency = 0;
+ _current_latency = 0;
_impl->block_length = _session.get_block_size();
_instance_access_feature.URI = "http://lv2plug.in/ns/ext/instance-access";
lilv_node_free(state_uri);
lilv_node_free(state_iface_uri);
- _features = (LV2_Feature**)calloc(11, sizeof(LV2_Feature*));
+ _features = (LV2_Feature**)calloc(12, sizeof(LV2_Feature*));
_features[0] = &_instance_access_feature;
_features[1] = &_data_access_feature;
_features[2] = &_make_path_feature;
lv2_atom_forge_init(&_impl->forge, _uri_map.urid_map());
lv2_atom_forge_init(&_impl->ui_forge, _uri_map.urid_map());
+#ifdef LV2_EXTENDED
+ _impl->queue_draw = (LV2_Inline_Display*)
+ malloc (sizeof(LV2_Inline_Display));
+ _impl->queue_draw->handle = this;
+ _impl->queue_draw->queue_draw = queue_draw;
+
+ _queue_draw_feature.URI = LV2_INLINEDISPLAY__queue_draw;
+ _queue_draw_feature.data = _impl->queue_draw;
+ _features[n_features++] = &_queue_draw_feature;
+#endif
+
#ifdef HAVE_LV2_1_2_0
LV2_URID atom_Int = _uri_map.uri_to_id(LV2_ATOM__Int);
static const int32_t _min_block_length = 1; // may happen during split-cycles
lilv_node_free(options_iface_uri);
#endif
+#ifdef LV2_EXTENDED
+ _display_interface = (const LV2_Inline_Display_Interface*)
+ extension_data (LV2_INLINEDISPLAY__interface);
+#endif
+
if (lilv_plugin_has_feature(plugin, _world.lv2_inPlaceBroken)) {
error << string_compose(
_("LV2: \"%1\" cannot be used, since it cannot do inplace processing."),
lilv_instance_connect_port(_impl->instance, i, &_control_data[i]);
if (latent && i == latency_index) {
+ LilvNode *max;
+ lilv_port_get_range(_impl->plugin, port, NULL, NULL, &max);
+ _max_latency = max ? lilv_node_as_float(max) : .02 * _sample_rate;
_latency_control_port = &_control_data[i];
*_latency_control_port = 0;
}
#ifdef HAVE_LV2_1_2_0
free(_impl->options);
#endif
+#ifdef LV2_EXTENDED
+ free(_impl->queue_draw);
+#endif
free(_features);
free(_make_path_feature.data);
return !fs_matches && !nrs_matches;
}
+#ifdef LV2_EXTENDED
+bool
+LV2Plugin::has_inline_display () {
+ return _display_interface ? true : false;
+}
+
+Plugin::Display_Image_Surface*
+LV2Plugin::render_inline_display (uint32_t w, uint32_t h) {
+ if (_display_interface) {
+ /* Plugin::Display_Image_Surface is identical to
+ * LV2_Inline_Display_Image_Surface */
+ return (Plugin::Display_Image_Surface*) _display_interface->render ((void*)_impl->instance->lv2_handle, w, h);
+ }
+ return NULL;
+}
+#endif
+
string
LV2Plugin::unique_id() const
{
return 0;
}
+Plugin::IOPortDescription
+LV2Plugin::describe_io_port (ARDOUR::DataType dt, bool input, uint32_t id) const
+{
+ PortFlags match = 0;
+ switch (dt) {
+ case DataType::AUDIO:
+ match = PORT_AUDIO;
+ break;
+ case DataType::MIDI:
+ match = PORT_SEQUENCE | PORT_MIDI; // ignore old PORT_EVENT
+ break;
+ default:
+ return Plugin::IOPortDescription ("?");
+ break;
+ }
+ if (input) {
+ match |= PORT_INPUT;
+ } else {
+ match |= PORT_OUTPUT;
+ }
+
+ uint32_t p = 0;
+ uint32_t idx = UINT32_MAX;
+
+ uint32_t const num_ports = parameter_count();
+ for (uint32_t port_index = 0; port_index < num_ports; ++port_index) {
+ PortFlags flags = _port_flags[port_index];
+ if ((flags & match) == match) {
+ if (p == id) {
+ idx = port_index;
+ }
+ ++p;
+ }
+ }
+ if (idx == UINT32_MAX) {
+ return Plugin::IOPortDescription ("?");
+ }
+
+ LilvNode* name = lilv_port_get_name(_impl->plugin,
+ lilv_plugin_get_port_by_index(_impl->plugin, idx));
+ Plugin::IOPortDescription iod (lilv_node_as_string (name));
+ lilv_node_free(name);
+
+ if (lilv_port_has_property(_impl->plugin,
+ lilv_plugin_get_port_by_index(_impl->plugin, idx), _world.lv2_isSideChain)) {
+ iod.is_sidechain = true;
+ }
+ return iod;
+}
+
string
LV2Plugin::describe_parameter(Evoral::Parameter which)
{
}
}
+framecnt_t
+LV2Plugin::max_latency () const
+{
+ return _max_latency;
+}
+
framecnt_t
LV2Plugin::signal_latency() const
{
_uri_map.urids.patch_value, &value,
0);
- if (!property || !value ||
- property->type != _uri_map.urids.atom_URID ||
- value->type != _uri_map.urids.atom_Path) {
+ if (property && value &&
+ property->type == _uri_map.urids.atom_URID &&
+ value->type == _uri_map.urids.atom_Path) {
+ const uint32_t prop_id = ((const LV2_Atom_URID*)property)->body;
+ const char* path = (const char*)LV2_ATOM_BODY_CONST(value);
+
+ // Emit PropertyChanged signal for UI
+ // TODO: This should emit the control's Changed signal
+ PropertyChanged(prop_id, Variant(Variant::PATH, path));
+ } else {
std::cerr << "warning: patch:Set for unknown property" << std::endl;
- continue;
}
-
- const uint32_t prop_id = ((const LV2_Atom_URID*)property)->body;
- const char* path = (const char*)LV2_ATOM_BODY_CONST(value);
-
- // Emit PropertyChanged signal for UI
- // TODO: This should emit the control's Changed signal
- PropertyChanged(prop_id, Variant(Variant::PATH, path));
}
}
}
_next_cycle_speed = _session.transport_speed();
_next_cycle_start = _session.transport_frame() + (nframes * _next_cycle_speed);
+ if (_latency_control_port) {
+ framecnt_t new_latency = signal_latency ();
+ if (_current_latency != new_latency) {
+ LatencyChanged (_current_latency, new_latency); /* EMIT SIGNAL */
+ }
+ _current_latency = new_latency;
+ }
return 0;
}
lv2_InputPort = lilv_new_uri(world, LILV_URI_INPUT_PORT);
lv2_OutputPort = lilv_new_uri(world, LILV_URI_OUTPUT_PORT);
lv2_inPlaceBroken = lilv_new_uri(world, LV2_CORE__inPlaceBroken);
+ lv2_isSideChain = lilv_new_uri(world, LV2_CORE_PREFIX "isSideChain");
lv2_integer = lilv_new_uri(world, LV2_CORE__integer);
lv2_default = lilv_new_uri(world, LV2_CORE__default);
lv2_minimum = lilv_new_uri(world, LV2_CORE__minimum);
patch_writable = lilv_new_uri(world, LV2_PATCH__writable);
patch_Message = lilv_new_uri(world, LV2_PATCH__Message);
#ifdef LV2_EXTENDED
- lv2_noSampleAccurateCtrl = lilv_new_uri(world, LV2_CORE_PREFIX "noSampleAccurateControls");
+ lv2_noSampleAccurateCtrl = lilv_new_uri(world, "http://ardour.org/lv2/ext#noSampleAccurateControls");
auto_can_write_automatation = lilv_new_uri(world, LV2_AUTOMATE_URI__can_write);
auto_automation_control = lilv_new_uri(world, LV2_AUTOMATE_URI__control);
auto_automation_controlled = lilv_new_uri(world, LV2_AUTOMATE_URI__controlled);
lilv_node_free(lv2_sampleRate);
lilv_node_free(lv2_reportsLatency);
lilv_node_free(lv2_integer);
+ lilv_node_free(lv2_isSideChain);
lilv_node_free(lv2_inPlaceBroken);
lilv_node_free(lv2_OutputPort);
lilv_node_free(lv2_InputPort);