uint32_t num_ports () const;
uint32_t parameter_count () const;
float default_value (uint32_t port);
+ framecnt_t max_latency () const;
framecnt_t signal_latency () const;
void set_parameter (uint32_t port, float val);
float get_parameter (uint32_t port) const;
URIMap& _uri_map;
bool _no_sample_accurate_ctrl;
bool _can_write_automation;
+ framecnt_t _max_latency;
+ framecnt_t _current_latency;
friend const void* lv2plugin_get_port_value(const char* port_symbol,
void* user_data,
return 0;
}
+ /** Emitted when a Latency Changes
+ *
+ * (this cannot be part of ARDOUR::Latent because
+ * signals cannot be copy-constructed).
+ */
+ PBD::Signal2<void,framecnt_t, framecnt_t> LatencyChanged;
+
+ /* overload Latent::set_user_latency w/signal emission */
+ virtual void set_user_latency (framecnt_t val) {
+ bool changed = val != _user_latency;
+ framecnt_t old = effective_latency ();
+ _user_latency = val;
+ if (changed) {
+ LatencyChanged (old, effective_latency ()); /* EMIT SIGNAL */
+ }
+ }
+
+ /** the max possible latency a plugin will have */
+ virtual framecnt_t max_latency () const { return 0; } // TODO = 0, require implementation
+
/** Emitted when a preset is added or removed, respectively */
PBD::Signal0<void> PresetAdded;
PBD::Signal0<void> PresetRemoved;
_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_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;
}
}
}
+framecnt_t
+LV2Plugin::max_latency () const
+{
+ return _max_latency;
+}
+
framecnt_t
LV2Plugin::signal_latency() const
{
_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;
}