proper debug output for channel mapping
authorRobin Gareus <robin@gareus.org>
Sat, 2 Apr 2016 02:00:30 +0000 (04:00 +0200)
committerRobin Gareus <robin@gareus.org>
Sat, 2 Apr 2016 02:00:30 +0000 (04:00 +0200)
libs/ardour/ardour/debug.h
libs/ardour/debug.cc
libs/ardour/plugin_insert.cc

index 6ebf21a958b1d358b6a8bd9a2cedcb93c0c47ebf..2f52fba8f7040ce9858c1919cb15d89604ca1326 100644 (file)
@@ -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;
index 86afaf6917045add1d46b4a23895e99b045f8dbf..e99d8a7426843e95977e7643fc07129b6040f051 100644 (file)
@@ -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");
index 675c172fcfaec1f03e772e758c4ac7a53a2aae5b..b02437e130346daaaed73321510b033227b387f6 100644 (file)
@@ -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);
        }