From 2c1c92e8de2d0f7b6f1f043b8e088eebdba18274 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 29 Oct 2014 22:34:12 -0400 Subject: [PATCH] move new Waves backend debug bits into libs/pbd/debug.cc because backends are dynamically loaded AFTER command line parsing. See comments in libs/pbd/debug.cc for more details --- libs/backends/wavesaudio/debug.cc | 24 ------------- libs/backends/wavesaudio/debug.h | 35 ------------------- libs/backends/wavesaudio/waves_midi_device.cc | 3 +- libs/backends/wavesaudio/wscript | 1 - libs/pbd/debug.cc | 14 ++++++++ libs/pbd/pbd/debug.h | 7 +++- 6 files changed, 21 insertions(+), 63 deletions(-) delete mode 100644 libs/backends/wavesaudio/debug.cc delete mode 100644 libs/backends/wavesaudio/debug.h diff --git a/libs/backends/wavesaudio/debug.cc b/libs/backends/wavesaudio/debug.cc deleted file mode 100644 index 0c7e463f94..0000000000 --- a/libs/backends/wavesaudio/debug.cc +++ /dev/null @@ -1,24 +0,0 @@ -/* - Copyright (C) 2010 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include "debug.h" - -uint64_t PBD::DEBUG::WavesMIDI = PBD::new_debug_bit ("WavesMIDI"); -uint64_t PBD::DEBUG::WavesAudio = PBD::new_debug_bit ("WavesAudio"); - diff --git a/libs/backends/wavesaudio/debug.h b/libs/backends/wavesaudio/debug.h deleted file mode 100644 index 31bea24c72..0000000000 --- a/libs/backends/wavesaudio/debug.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - Copyright (C) 2014 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __ardour_waves_backend_debug_h__ -#define __ardour_waves_backend_debug_h__ - -#include - -#include "pbd/debug.h" - -namespace PBD { - namespace DEBUG { - extern uint64_t WavesMIDI; - extern uint64_t WavesAudio; - } -} - -#endif /* __ardour_waves_backend_debug_h__ */ - diff --git a/libs/backends/wavesaudio/waves_midi_device.cc b/libs/backends/wavesaudio/waves_midi_device.cc index fd7b238234..6c91baf3cb 100644 --- a/libs/backends/wavesaudio/waves_midi_device.cc +++ b/libs/backends/wavesaudio/waves_midi_device.cc @@ -20,13 +20,12 @@ #include #include "pbd/error.h" +#include "pbd/debug.h" #include "pbd/compose.h" #include "waves_midi_device.h" #include "waves_midi_event.h" -#include "debug.h" - // use non-zero latency because we want output to be timestapmed #define LATENCY 0 diff --git a/libs/backends/wavesaudio/wscript b/libs/backends/wavesaudio/wscript index 28efa2adde..c1ff717d10 100644 --- a/libs/backends/wavesaudio/wscript +++ b/libs/backends/wavesaudio/wscript @@ -38,7 +38,6 @@ def build(bld): obj.framework = 'CoreMIDI' obj.source = [ - 'debug.cc', 'waves_audiobackend.cc', 'waves_audiobackend.latency.cc', 'waves_audiobackend.midi.cc', diff --git a/libs/pbd/debug.cc b/libs/pbd/debug.cc index f967061c25..8230e9393b 100644 --- a/libs/pbd/debug.cc +++ b/libs/pbd/debug.cc @@ -51,6 +51,20 @@ uint64_t PBD::DEBUG::EventLoop = PBD::new_debug_bit ("eventloop"); uint64_t PBD::DEBUG::AbstractUI = PBD::new_debug_bit ("abstractui"); uint64_t PBD::DEBUG::FileUtils = PBD::new_debug_bit ("fileutils"); + +/* These are debug bits that are used by backends. Since these are loaded dynamically, + after command-line parsing, defining them in code that is part of the backend + doesn't make them available for command line parsing. Put them here. + + This is sort of a hack, because it means that the debug bits aren't defined + with the code in which they are relevant. But providing access to debug bits + from dynamically loaded code, for use in command line parsing, is way above the pay grade + of this debug tracing scheme. +*/ + +uint64_t PBD::DEBUG::WavesMIDI = PBD::new_debug_bit ("WavesMIDI"); +uint64_t PBD::DEBUG::WavesAudio = PBD::new_debug_bit ("WavesAudio"); + uint64_t PBD::debug_bits = 0x0; uint64_t diff --git a/libs/pbd/pbd/debug.h b/libs/pbd/pbd/debug.h index 54577f1a7e..03f1aa6d2f 100644 --- a/libs/pbd/pbd/debug.h +++ b/libs/pbd/pbd/debug.h @@ -45,7 +45,12 @@ namespace PBD { LIBPBD_API extern uint64_t Pool; LIBPBD_API extern uint64_t EventLoop; LIBPBD_API extern uint64_t AbstractUI; - extern uint64_t FileUtils; + LIBPBD_API extern uint64_t FileUtils; + + /* See notes in ../debug.cc on why these are defined here */ + + LIBPBD_API extern uint64_t WavesMIDI; + LIBPBD_API extern uint64_t WavesAudio; } }