From 5405783a2b5c8d7238b02dba51aa559bf5ad8a28 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 2 Apr 2016 04:00:30 +0200 Subject: [PATCH] proper debug output for channel mapping --- libs/ardour/ardour/debug.h | 1 + libs/ardour/debug.cc | 1 + libs/ardour/plugin_insert.cc | 39 +++++++++++++++++++++++++----------- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/libs/ardour/ardour/debug.h b/libs/ardour/ardour/debug.h index 6ebf21a958..2f52fba8f7 100644 --- a/libs/ardour/ardour/debug.h +++ b/libs/ardour/ardour/debug.h @@ -37,6 +37,7 @@ namespace PBD { LIBARDOUR_API extern DebugBits LatencyCompensation; LIBARDOUR_API extern DebugBits Peaks; LIBARDOUR_API extern DebugBits Processors; + LIBARDOUR_API extern DebugBits ChanMapping; LIBARDOUR_API extern DebugBits ProcessThreads; LIBARDOUR_API extern DebugBits Graph; LIBARDOUR_API extern DebugBits Destruction; diff --git a/libs/ardour/debug.cc b/libs/ardour/debug.cc index 86afaf6917..e99d8a7426 100644 --- a/libs/ardour/debug.cc +++ b/libs/ardour/debug.cc @@ -33,6 +33,7 @@ PBD::DebugBits PBD::DEBUG::Latency = PBD::new_debug_bit ("latency"); PBD::DebugBits PBD::DEBUG::LatencyCompensation = PBD::new_debug_bit ("latencycompensation"); PBD::DebugBits PBD::DEBUG::Peaks = PBD::new_debug_bit ("peaks"); PBD::DebugBits PBD::DEBUG::Processors = PBD::new_debug_bit ("processors"); +PBD::DebugBits PBD::DEBUG::ChanMapping = PBD::new_debug_bit ("chanmapping"); PBD::DebugBits PBD::DEBUG::ProcessThreads = PBD::new_debug_bit ("processthreads"); PBD::DebugBits PBD::DEBUG::Graph = PBD::new_debug_bit ("graph"); PBD::DebugBits PBD::DEBUG::Destruction = PBD::new_debug_bit ("destruction"); diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index 675c172fcf..b02437e130 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -1060,8 +1060,13 @@ PluginInsert::configure_io (ChanCount in, ChanCount out) /* get plugin configuration */ _match = private_can_support_io_configuration (in, out); -#ifndef NDEBUG // XXX - cout << "Match '" << name() << "': " << _match; +#ifndef NDEBUG + if (DEBUG_ENABLED(DEBUG::ChanMapping)) { + DEBUG_STR_DECL(a); + DEBUG_STR_APPEND(a, string_compose ("Match '%1':", name())); + DEBUG_STR_APPEND(a, _match); + DEBUG_TRACE (DEBUG::ChanMapping, DEBUG_STR(a).str()); + } #endif /* set the matching method and number of plugins that we will use to meet this configuration */ @@ -1129,15 +1134,25 @@ PluginInsert::configure_io (ChanCount in, ChanCount out) if (mapping_changed) { PluginMapChanged (); /* EMIT SIGNAL */ -#ifndef NDEBUG // XXX - uint32_t pc = 0; - cout << "----<<----\n"; - for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i, ++pc) { - cout << "Channel Map for " << name() << " plugin " << pc << "\n"; - cout << " * Inputs:\n" << _in_map[pc]; - cout << " * Outputs:\n" << _out_map[pc]; + +#ifndef NDEBUG + if (DEBUG_ENABLED(DEBUG::ChanMapping)) { + uint32_t pc = 0; + DEBUG_STR_DECL(a); + DEBUG_STR_APPEND(a, "\n--------<<--------\n"); + for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i, ++pc) { + if (pc > 0) { + DEBUG_STR_APPEND(a, "----><----\n"); + } + DEBUG_STR_APPEND(a, string_compose ("Channel Map for %1 plugin %2\n", name(), pc)); + DEBUG_STR_APPEND(a, " * Inputs:\n"); + DEBUG_STR_APPEND(a, _in_map[pc]); + DEBUG_STR_APPEND(a, " * Outputs:\n"); + DEBUG_STR_APPEND(a, _out_map[pc]); + } + DEBUG_STR_APPEND(a, "-------->>--------\n"); + DEBUG_TRACE (DEBUG::ChanMapping, DEBUG_STR(a).str()); } - cout << "---->>----\n"; #endif } @@ -1324,11 +1339,11 @@ PluginInsert::automatic_can_support_io_configuration (ChanCount const & inx, Cha ChanCount outputs = info->n_outputs; if (in.get(DataType::MIDI) == 1 && outputs.get(DataType::MIDI) == 0) { - DEBUG_TRACE ( DEBUG::Processors, string_compose ("bypassing midi-data around %1\n", name())); + DEBUG_TRACE ( DEBUG::ChanMapping, string_compose ("bypassing midi-data around %1\n", name())); midi_bypass.set (DataType::MIDI, 1); } if (in.get(DataType::MIDI) == 1 && inputs.get(DataType::MIDI) == 0) { - DEBUG_TRACE ( DEBUG::Processors, string_compose ("hiding midi-port from plugin %1\n", name())); + DEBUG_TRACE ( DEBUG::ChanMapping, string_compose ("hiding midi-port from plugin %1\n", name())); in.set(DataType::MIDI, 0); } -- 2.30.2