From c11ef385f5c103e663910d4c5db23d3d3f7fdda8 Mon Sep 17 00:00:00 2001 From: paul Date: Sat, 5 Mar 2011 23:14:39 +0000 Subject: [PATCH] some LV2 debug tracing git-svn-id: http://subversion.ardour.org/svn/ardour2/ardour2/branches/3.0@9078 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/debug.h | 1 + libs/ardour/buffer_set.cc | 13 +++++++++++++ libs/ardour/lv2_plugin.cc | 39 +++++++++++++++++++++++++++------------ 3 files changed, 41 insertions(+), 12 deletions(-) diff --git a/libs/ardour/ardour/debug.h b/libs/ardour/ardour/debug.h index 69421662f..c141bf404 100644 --- a/libs/ardour/ardour/debug.h +++ b/libs/ardour/ardour/debug.h @@ -49,6 +49,7 @@ namespace PBD { extern uint64_t Solo; extern uint64_t AudioPlayback; extern uint64_t Panning; + extern uint64_t LV2; } } diff --git a/libs/ardour/buffer_set.cc b/libs/ardour/buffer_set.cc index 159a24c21..736c6a386 100644 --- a/libs/ardour/buffer_set.cc +++ b/libs/ardour/buffer_set.cc @@ -25,6 +25,7 @@ #include #include "ardour/buffer.h" #include "ardour/buffer_set.h" +#include "ardour/debug.h" #include "ardour/midi_buffer.h" #include "ardour/port.h" #include "ardour/port_set.h" @@ -254,6 +255,12 @@ BufferSet::get_lv2_midi(bool input, size_t i) for (MidiBuffer::iterator e = mbuf.begin(); e != mbuf.end(); ++e) { const Evoral::MIDIEvent ev(*e, false); uint32_t type = LV2Plugin::midi_event_type(); +#ifndef NDEBUG + DEBUG_TRACE (PBD::DEBUG::LV2, string_compose ("(FLUSH) MIDI event of size %1\n", ev.size())); + for (uint16_t x = 0; x < ev.size(); ++x) { + DEBUG_TRACE (PBD::DEBUG::LV2, string_compose ("\tByte[%1] = %2\n", x, (int) ev.buffer()[x])); + } +#endif ebuf->append(ev.time(), 0, type, ev.size(), ev.buffer()); } } @@ -275,6 +282,12 @@ BufferSet::flush_lv2_midi(bool input, size_t i) uint16_t size; uint8_t* data; ebuf->get_event(&frames, &subframes, &type, &size, &data); +#ifndef NDEBUG + DEBUG_TRACE (PBD::DEBUG::LV2, string_compose ("(FLUSH) MIDI event of size %1\n", size)); + for (uint16_t x = 0; x < size; ++x) { + DEBUG_TRACE (PBD::DEBUG::LV2, string_compose ("\tByte[%1] = %2\n", x, (int) data[x])); + } +#endif mbuf.push_back(frames, size, data); } } diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index 9ee0fe61d..b02cc401c 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -35,6 +35,7 @@ #include "ardour/ardour.h" #include "ardour/audio_buffer.h" #include "ardour/audioengine.h" +#include "ardour/debug.h" #include "ardour/lv2_event_buffer.h" #include "ardour/lv2_plugin.h" #include "ardour/session.h" @@ -89,6 +90,8 @@ LV2Plugin::LV2Plugin (const LV2Plugin &other) void LV2Plugin::init (LV2World& world, SLV2Plugin plugin, framecnt_t rate) { + DEBUG_TRACE (DEBUG::LV2, "LV2 plugin init\n"); + _world = world; _plugin = plugin; _ui = NULL; @@ -200,6 +203,8 @@ LV2Plugin::init (LV2World& world, SLV2Plugin plugin, framecnt_t rate) LV2Plugin::~LV2Plugin () { + DEBUG_TRACE (DEBUG::LV2, string_compose ("%1 destroy\n", name())); + deactivate (); cleanup (); @@ -246,6 +251,8 @@ LV2Plugin::port_symbol (uint32_t index) const void LV2Plugin::set_parameter (uint32_t which, float val) { + DEBUG_TRACE (DEBUG::LV2, string_compose ("%1 set parameter %2 to %3\n", name(), which, val)); + if (which < slv2_plugin_get_num_ports(_plugin)) { _shadow_data[which] = val; } else { @@ -542,16 +549,16 @@ LV2Plugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& desc) SLV2Value def, min, max; slv2_port_get_range(_plugin, port, &def, &min, &max); - desc.integer_step = slv2_port_has_property(_plugin, port, _world.integer); - desc.toggled = slv2_port_has_property(_plugin, port, _world.toggled); - desc.logarithmic = slv2_port_has_property(_plugin, port, _world.logarithmic); - desc.sr_dependent = slv2_port_has_property(_plugin, port, _world.srate); - desc.label = slv2_value_as_string(slv2_port_get_name(_plugin, port)); - desc.lower = min ? slv2_value_as_float(min) : 0.0f; - desc.upper = max ? slv2_value_as_float(max) : 1.0f; - desc.min_unbound = false; // TODO: LV2 extension required - desc.max_unbound = false; // TODO: LV2 extension required - + desc.integer_step = slv2_port_has_property(_plugin, port, _world.integer); + desc.toggled = slv2_port_has_property(_plugin, port, _world.toggled); + desc.logarithmic = slv2_port_has_property(_plugin, port, _world.logarithmic); + desc.sr_dependent = slv2_port_has_property(_plugin, port, _world.srate); + desc.label = slv2_value_as_string(slv2_port_get_name(_plugin, port)); + desc.lower = min ? slv2_value_as_float(min) : 0.0f; + desc.upper = max ? slv2_value_as_float(max) : 1.0f; + desc.min_unbound = false; // TODO: LV2 extension required + desc.max_unbound = false; // TODO: LV2 extension required + if (desc.integer_step) { desc.step = 1.0; desc.smallstep = 0.1; @@ -612,6 +619,8 @@ LV2Plugin::automatable () const void LV2Plugin::activate () { + DEBUG_TRACE (DEBUG::LV2, string_compose ("%1 activate\n", name())); + if (!_was_activated) { slv2_instance_activate (_instance); _was_activated = true; @@ -621,6 +630,8 @@ LV2Plugin::activate () void LV2Plugin::deactivate () { + DEBUG_TRACE (DEBUG::LV2, string_compose ("%1 deactivate\n", name())); + if (_was_activated) { slv2_instance_deactivate (_instance); _was_activated = false; @@ -630,6 +641,8 @@ LV2Plugin::deactivate () void LV2Plugin::cleanup () { + DEBUG_TRACE (DEBUG::LV2, string_compose ("%1 cleanup\n", name())); + activate (); deactivate (); slv2_instance_free (_instance); @@ -638,9 +651,11 @@ LV2Plugin::cleanup () int LV2Plugin::connect_and_run (BufferSet& bufs, - ChanMapping in_map, ChanMapping out_map, - pframes_t nframes, framecnt_t offset) + ChanMapping in_map, ChanMapping out_map, + pframes_t nframes, framecnt_t offset) { + DEBUG_TRACE (DEBUG::LV2, string_compose ("%1 run %2 offset %3\n", name(), nframes, offset)); + Plugin::connect_and_run (bufs, in_map, out_map, nframes, offset); cycles_t then = get_cycles (); -- 2.11.4.GIT