first vaguely working version using PresentationInfo
[ardour.git] / libs / ardour / lv2_plugin.cc
index e13328b97b89c33e667b20b7dc07203021bb43ed..4c3ca31d2dca53d1e3263fcdde2adbc7babe1486 100644 (file)
@@ -634,6 +634,7 @@ LV2Plugin::init(const void* c_plugin, framecnt_t rate)
 
                _port_flags.push_back(flags);
                _port_minimumSize.push_back(minimumSize);
+               DEBUG_TRACE(DEBUG::LV2, string_compose("port %1 buffer %2 bytes\n", i, minimumSize));
        }
 
        _control_data = new float[num_ports];
@@ -808,6 +809,7 @@ LV2Plugin::~LV2Plugin ()
 #endif
 
        free(_features);
+       free(_log_feature.data);
        free(_make_path_feature.data);
        free(_work_schedule_feature.data);
 
@@ -828,6 +830,7 @@ LV2Plugin::~LV2Plugin ()
        delete [] _shadow_data;
        delete [] _defaults;
        delete [] _ev_buffers;
+       delete _impl;
 }
 
 bool
@@ -1124,7 +1127,7 @@ LV2Plugin::add_state(XMLNode* root) const
 
        XMLNode*    child;
        char        buf[32];
-       LocaleGuard lg(X_("C"));
+       LocaleGuard lg;
 
        for (uint32_t i = 0; i < parameter_count(); ++i) {
                if (parameter_is_input(i) && parameter_is_control(i)) {
@@ -1797,13 +1800,13 @@ int
 LV2Plugin::set_state(const XMLNode& node, int version)
 {
        XMLNodeList          nodes;
-       const XMLProperty*   prop;
+       XMLProperty const * prop;
        XMLNodeConstIterator iter;
        XMLNode*             child;
        const char*          sym;
        const char*          value;
        uint32_t             port_id;
-       LocaleGuard          lg(X_("C"));
+       LocaleGuard          lg;
 
        if (node.name() != state_node_name()) {
                error << _("Bad node sent to LV2Plugin::set_state") << endmsg;
@@ -1934,7 +1937,7 @@ LV2Plugin::get_parameter_descriptor(uint32_t which, ParameterDescriptor& desc) c
 }
 
 Plugin::IOPortDescription
-LV2Plugin::describe_io_port (ARDOUR::DataType dt, bool input, uint32_t id)
+LV2Plugin::describe_io_port (ARDOUR::DataType dt, bool input, uint32_t id) const
 {
        PortFlags match = 0;
        switch (dt) {
@@ -2117,8 +2120,7 @@ LV2Plugin::allocate_atom_event_buffers()
                        LilvNodes* atom_supports = lilv_port_get_value(
                                p, port, _world.atom_supports);
 
-                       if (!lilv_nodes_contains(buffer_types, _world.atom_Sequence)
-                                       || !lilv_nodes_contains(atom_supports, _world.midi_MidiEvent)) {
+                       if (lilv_nodes_contains(buffer_types, _world.atom_Sequence)) {
                                if (lilv_port_is_a(p, port, _world.lv2_InputPort)) {
                                        count_atom_in++;
                                }
@@ -2145,7 +2147,7 @@ LV2Plugin::allocate_atom_event_buffers()
                return;
        }
 
-       DEBUG_TRACE(DEBUG::LV2, string_compose("allocate %1 atom_ev_buffers of %d bytes\n", total_atom_buffers, minimumSize));
+       DEBUG_TRACE(DEBUG::LV2, string_compose("allocate %1 atom_ev_buffers of %2 bytes\n", total_atom_buffers, minimumSize));
        _atom_ev_buffers = (LV2_Evbuf**) malloc((total_atom_buffers + 1) * sizeof(LV2_Evbuf*));
        for (int i = 0; i < total_atom_buffers; ++i ) {
                _atom_ev_buffers[i] = lv2_evbuf_new(minimumSize, LV2_EVBUF_ATOM,
@@ -2308,7 +2310,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
                                        if (_session.transport_frame() != _next_cycle_start ||
                                            _session.transport_speed() != _next_cycle_speed) {
                                                // Transport has changed, write position at cycle start
-                                               tmap.bbt_time(_session.transport_frame(), bbt);
+                                               bbt = tmap.bbt_at_frame (_session.transport_frame());
                                                write_position(&_impl->forge, _ev_buffers[port_index],
                                                               tmetric, bbt, _session.transport_speed(),
                                                               _session.transport_frame(), 0);
@@ -2340,7 +2342,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
                                                ++m;
                                        } else {
                                                tmetric.set_metric(metric);
-                                               bbt = metric->start();
+                                               bbt = tmap.bbt_at_pulse (metric->pulse());
                                                write_position(&_impl->forge, _ev_buffers[port_index],
                                                               tmetric, bbt, _session.transport_speed(),
                                                               metric->frame(),
@@ -2775,7 +2777,7 @@ LV2World::LV2World()
        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);