# HG changeset patch # User Chris Cannam # Date 1308059279 -3600 # Node ID 573d45e9487b74f289025d7c449f48b6b57bf1b5 # Parent be43b2fe68e865077366a239b7938ba92681b66c# Parent 06f13a3b9e9ee40734ac4bd30b34df80749d74d5 Merge from debug-output branch diff -r be43b2fe68e8 -r 573d45e9487b base/Command.h --- a/base/Command.h Tue Jun 14 13:43:03 2011 +0100 +++ b/base/Command.h Tue Jun 14 14:47:59 2011 +0100 @@ -20,6 +20,8 @@ #include #include +#include "Debug.h" + class Command { public: diff -r be43b2fe68e8 -r 573d45e9487b base/Debug.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/base/Debug.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -0,0 +1,86 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + Sonic Visualiser + An audio file viewer and annotation editor. + Centre for Digital Music, Queen Mary, University of London. + This file copyright 2010-2011 Chris Cannam and QMUL. + + 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. See the file + COPYING included with this distribution for more information. +*/ + +#include "Debug.h" +#include "ResourceFinder.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +QDebug & +getSVDebug() +{ + static QFile *logFile = 0; + static QDebug *debug = 0; + static QMutex mutex; + static char *prefix; + mutex.lock(); + if (!debug) { + prefix = new char[20]; + sprintf(prefix, "[%lu]", (unsigned long)QCoreApplication::applicationPid()); + QString pfx = ResourceFinder().getUserResourcePrefix(); + QDir logdir(QString("%1/%2").arg(pfx).arg("log")); + if (!logdir.exists()) logdir.mkpath(logdir.path()); + logFile = new QFile(logdir.path() + "/debug.log"); + if (logFile->open(QIODevice::WriteOnly | QIODevice::Truncate)) { + QDebug(QtDebugMsg) << (const char *)prefix + << "Opened debug log file " + << logFile->fileName(); + debug = new QDebug(logFile); + } else { + QDebug(QtWarningMsg) << (const char *)prefix + << "Failed to open debug log file " + << logFile->fileName() + << " for writing, using console debug instead"; + debug = new QDebug(QtDebugMsg); + delete logFile; + logFile = 0; + } + *debug << endl << (const char *)prefix << "Log started at " + << QDateTime::currentDateTime().toString(); + } + mutex.unlock(); + + QDebug &dref = *debug; + return dref << endl << (const char *)prefix; +} + +QDebug & +operator<<(QDebug &dbg, const std::string &s) +{ + dbg << QString::fromUtf8(s.c_str()); + return dbg; +} + +std::ostream & +operator<<(std::ostream &target, const QString &str) +{ + return target << str.toLocal8Bit().data(); +} + +std::ostream & +operator<<(std::ostream &target, const QUrl &u) +{ + return target << "<" << u.toString() << ">"; +} + diff -r be43b2fe68e8 -r 573d45e9487b base/Debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/base/Debug.h Tue Jun 14 14:47:59 2011 +0100 @@ -0,0 +1,65 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + Sonic Visualiser + An audio file viewer and annotation editor. + Centre for Digital Music, Queen Mary, University of London. + This file copyright 2010-2011 Chris Cannam and QMUL. + + 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. See the file + COPYING included with this distribution for more information. +*/ + +#ifndef _DEBUG_H_ +#define _DEBUG_H_ + +#include +#include +#include +#include + +class QString; +class QUrl; + +QDebug &operator<<(QDebug &, const std::string &); +std::ostream &operator<<(std::ostream &, const QString &); +std::ostream &operator<<(std::ostream &, const QUrl &); + +#ifndef NDEBUG + +extern QDebug &getSVDebug(); + +#define DEBUG getSVDebug() + +template +inline QDebug &operator<<(QDebug &d, const T &t) { + QString s; + QTextStream ts(&s); + ts << t; + d << s; + return d; +} + +#else + +class NoDebug +{ +public: + inline NoDebug() {} + inline ~NoDebug(){} + + template + inline NoDebug &operator<<(const T &) { return *this; } + + inline NoDebug &operator<<(QTextStreamFunction) { return *this; } +}; + +#define DEBUG NoDebug() + +#endif /* !NDEBUG */ + +#endif /* !_DEBUG_H_ */ + diff -r be43b2fe68e8 -r 573d45e9487b base/Exceptions.cpp --- a/base/Exceptions.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/base/Exceptions.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -21,7 +21,7 @@ m_file(file) { std::cerr << "ERROR: File not found: " - << file.toStdString() << std::endl; + << file << std::endl; } const char * @@ -35,7 +35,7 @@ m_file(file) { std::cerr << "ERROR: Failed to open file: " - << file.toStdString() << std::endl; + << file << std::endl; } const char * @@ -49,7 +49,7 @@ m_directory(directory) { std::cerr << "ERROR: Directory creation failed for directory: " - << directory.toStdString() << std::endl; + << directory << std::endl; } const char * @@ -63,7 +63,7 @@ m_file(file) { std::cerr << "ERROR: File read failed for file: " - << file.toStdString() << std::endl; + << file << std::endl; } const char * @@ -77,8 +77,8 @@ m_file(file), m_operation(op) { - std::cerr << "ERROR: File " << op.toStdString() << " failed for file: " - << file.toStdString() << std::endl; + std::cerr << "ERROR: File " << op << " failed for file: " + << file << std::endl; } const char * @@ -96,7 +96,7 @@ m_available(available) { std::cerr << "ERROR: Not enough disc space available in " - << directory.toStdString() << ": need " << required + << directory << ": need " << required << ", only have " << available << std::endl; } @@ -106,7 +106,7 @@ m_available(0) { std::cerr << "ERROR: Not enough disc space available in " - << directory.toStdString() << std::endl; + << directory << std::endl; } const char * diff -r be43b2fe68e8 -r 573d45e9487b base/Exceptions.h --- a/base/Exceptions.h Tue Jun 14 13:43:03 2011 +0100 +++ b/base/Exceptions.h Tue Jun 14 14:47:59 2011 +0100 @@ -20,6 +20,8 @@ #include +#include "Debug.h" + class FileNotFound : virtual public std::exception { public: diff -r be43b2fe68e8 -r 573d45e9487b base/LogRange.cpp --- a/base/LogRange.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/base/LogRange.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -26,7 +26,7 @@ if (min > max) std::swap(min, max); if (max == min) max = min + 1; -// std::cerr << "LogRange::mapRange: min = " << min << ", max = " << max << std::endl; +// DEBUG << "LogRange::mapRange: min = " << min << ", max = " << max << endl; if (min >= 0.f) { @@ -35,7 +35,7 @@ if (min == 0.f) min = std::min(logthresh, max); else min = log10f(min); -// std::cerr << "LogRange::mapRange: positive: min = " << min << ", max = " << max << std::endl; +// DEBUG << "LogRange::mapRange: positive: min = " << min << ", max = " << max << endl; } else if (max <= 0.f) { @@ -46,7 +46,7 @@ std::swap(min, max); -// std::cerr << "LogRange::mapRange: negative: min = " << min << ", max = " << max << std::endl; +// DEBUG << "LogRange::mapRange: negative: min = " << min << ", max = " << max << endl; } else { @@ -55,7 +55,7 @@ max = log10f(std::max(max, -min)); min = std::min(logthresh, max); -// std::cerr << "LogRange::mapRange: spanning: min = " << min << ", max = " << max << std::endl; +// DEBUG << "LogRange::mapRange: spanning: min = " << min << ", max = " << max << endl; } if (min == max) min = max - 1; @@ -104,8 +104,8 @@ float sd0 = sd(values, 0, mi); float sd1 = sd(values, mi, values.size() - mi); - std::cerr << "LogRange::useLogScale: sd0 = " - << sd0 << ", sd1 = " << sd1 << std::endl; + DEBUG << "LogRange::useLogScale: sd0 = " + << sd0 << ", sd1 = " << sd1 << endl; if (sd0 == 0 || sd1 == 0) return false; diff -r be43b2fe68e8 -r 573d45e9487b base/LogRange.h --- a/base/LogRange.h Tue Jun 14 13:43:03 2011 +0100 +++ b/base/LogRange.h Tue Jun 14 14:47:59 2011 +0100 @@ -17,6 +17,7 @@ #define _LOG_RANGE_H_ #include +#include "Debug.h" class LogRange { diff -r be43b2fe68e8 -r 573d45e9487b base/PlayParameterRepository.cpp --- a/base/PlayParameterRepository.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/base/PlayParameterRepository.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -124,7 +124,7 @@ PlayParameterRepository::playPluginConfigurationChanged(QString config) { PlayParameters *params = dynamic_cast(sender()); -// std::cerr << "PlayParameterRepository::playPluginConfigurationChanged" << std::endl; +// DEBUG << "PlayParameterRepository::playPluginConfigurationChanged" << endl; for (PlayableParameterMap::iterator i = m_playParameters.begin(); i != m_playParameters.end(); ++i) { if (i->second == params) { diff -r be43b2fe68e8 -r 573d45e9487b base/PlayParameters.cpp --- a/base/PlayParameters.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/base/PlayParameters.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -132,7 +132,7 @@ { if (m_playPluginConfiguration != configuration) { m_playPluginConfiguration = configuration; -// std::cerr << "PlayParameters(" << this << "): setPlayPluginConfiguration to \"" << configuration.toStdString() << "\"" << std::endl; +// std::cerr << "PlayParameters(" << this << "): setPlayPluginConfiguration to \"" << configuration << "\"" << std::endl; emit playPluginConfigurationChanged(configuration); emit playParametersChanged(); } diff -r be43b2fe68e8 -r 573d45e9487b base/PropertyContainer.cpp --- a/base/PropertyContainer.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/base/PropertyContainer.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -68,7 +68,7 @@ void PropertyContainer::setProperty(const PropertyName &name, int) { - std::cerr << "WARNING: PropertyContainer[" << getPropertyContainerName().toStdString() << "]::setProperty(" << name.toStdString() << "): no implementation in subclass!" << std::endl; + std::cerr << "WARNING: PropertyContainer[" << getPropertyContainerName() << "]::setProperty(" << name << "): no implementation in subclass!" << std::endl; } Command * @@ -86,7 +86,7 @@ int value; if (!convertPropertyStrings(nameString, valueString, name, value)) { std::cerr << "WARNING: PropertyContainer::setProperty(\"" - << nameString.toStdString() << "\", \"" + << nameString << "\", \"" << valueString.toStdString() << "\"): Name and value conversion failed" << std::endl; return; @@ -101,7 +101,7 @@ int value; if (!convertPropertyStrings(nameString, valueString, name, value)) { std::cerr << "WARNING: PropertyContainer::getSetPropertyCommand(\"" - << nameString.toStdString() << "\", \"" + << nameString << "\", \"" << valueString.toStdString() << "\"): Name and value conversion failed" << std::endl; return 0; @@ -135,7 +135,7 @@ } if (name == "") { - std::cerr << "PropertyContainer::convertPropertyStrings: Unable to match name string \"" << nameString.toStdString() << "\"" << std::endl; + std::cerr << "PropertyContainer::convertPropertyStrings: Unable to match name string \"" << nameString << "\"" << std::endl; return false; } @@ -192,7 +192,7 @@ break; case InvalidProperty: - std::cerr << "PropertyContainer::convertPropertyStrings: Invalid property name \"" << name.toStdString() << "\"" << std::endl; + DEBUG << "PropertyContainer::convertPropertyStrings: Invalid property name \"" << name << "\"" << endl; return false; } @@ -204,10 +204,10 @@ bool ok = false; int i = valueString.toInt(&ok); if (!ok) { - std::cerr << "PropertyContainer::convertPropertyStrings: Unable to parse value string \"" << valueString.toStdString() << "\"" << std::endl; + std::cerr << "PropertyContainer::convertPropertyStrings: Unable to parse value string \"" << valueString << "\"" << std::endl; return false; } else if (i < min || i > max) { - std::cerr << "PropertyContainer::convertPropertyStrings: Property value \"" << i << "\" outside valid range " << min << " to " << max << std::endl; + DEBUG << "PropertyContainer::convertPropertyStrings: Property value \"" << i << "\" outside valid range " << min << " to " << max << endl; return false; } diff -r be43b2fe68e8 -r 573d45e9487b base/RangeMapper.cpp --- a/base/RangeMapper.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/base/RangeMapper.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -43,8 +43,8 @@ * (m_maxpos - m_minpos)); if (position < m_minpos) position = m_minpos; if (position > m_maxpos) position = m_maxpos; -// std::cerr << "LinearRangeMapper::getPositionForValue: " << value << " -> " -// << position << " (minpos " << m_minpos << ", maxpos " << m_maxpos << ", minval " << m_minval << ", maxval " << m_maxval << ")" << std::endl; +// DEBUG << "LinearRangeMapper::getPositionForValue: " << value << " -> " +// << position << " (minpos " << m_minpos << ", maxpos " << m_maxpos << ", minval " << m_minval << ", maxval " << m_maxval << ")" << endl; if (m_inverted) return m_maxpos - position; else return position; } @@ -58,8 +58,8 @@ * (m_maxval - m_minval)); if (value < m_minval) value = m_minval; if (value > m_maxval) value = m_maxval; -// std::cerr << "LinearRangeMapper::getValueForPosition: " << position << " -> " -// << value << " (minpos " << m_minpos << ", maxpos " << m_maxpos << ", minval " << m_minval << ", maxval " << m_maxval << ")" << std::endl; +// DEBUG << "LinearRangeMapper::getValueForPosition: " << position << " -> " +// << value << " (minpos " << m_minpos << ", maxpos " << m_maxpos << ", minval " << m_minval << ", maxval " << m_maxval << ")" << endl; return value; } @@ -76,7 +76,7 @@ std::cerr << "LogRangeMapper: minpos " << minpos << ", maxpos " << maxpos << ", minval " << minval << ", maxval " << maxval << ", minlog " << m_minlog << ", ratio " << m_ratio - << ", unit " << unit.toStdString() << std::endl; + << ", unit " << unit << std::endl; assert(m_maxpos != m_minpos); @@ -109,8 +109,8 @@ int position = (log10(value) - m_minlog) * m_ratio + m_minpos; if (position < m_minpos) position = m_minpos; if (position > m_maxpos) position = m_maxpos; -// std::cerr << "LogRangeMapper::getPositionForValue: " << value << " -> " -// << position << " (minpos " << m_minpos << ", maxpos " << m_maxpos << ", ratio " << m_ratio << ", minlog " << m_minlog << ")" << std::endl; +// DEBUG << "LogRangeMapper::getPositionForValue: " << value << " -> " +// << position << " (minpos " << m_minpos << ", maxpos " << m_maxpos << ", ratio " << m_ratio << ", minlog " << m_minlog << ")" << endl; if (m_inverted) return m_maxpos - position; else return position; } @@ -120,8 +120,8 @@ { if (m_inverted) position = m_maxpos - position; float value = powf(10, (position - m_minpos) / m_ratio + m_minlog); -// std::cerr << "LogRangeMapper::getValueForPosition: " << position << " -> " -// << value << " (minpos " << m_minpos << ", maxpos " << m_maxpos << ", ratio " << m_ratio << ", minlog " << m_minlog << ")" << std::endl; +// DEBUG << "LogRangeMapper::getValueForPosition: " << position << " -> " +// << value << " (minpos " << m_minpos << ", maxpos " << m_maxpos << ", ratio " << m_ratio << ", minlog " << m_minlog << ")" << endl; return value; } diff -r be43b2fe68e8 -r 573d45e9487b base/RangeMapper.h --- a/base/RangeMapper.h Tue Jun 14 13:43:03 2011 +0100 +++ b/base/RangeMapper.h Tue Jun 14 14:47:59 2011 +0100 @@ -18,6 +18,8 @@ #include +#include "Debug.h" + class RangeMapper { diff -r be43b2fe68e8 -r 573d45e9487b base/RealTime.cpp --- a/base/RealTime.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/base/RealTime.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -242,8 +242,8 @@ int nsec = atoi(snsec.c_str()); if (negative) sec = -sec; -// std::cerr << "RealTime::fromString: string " << s << " -> " -// << sec << " sec, " << nsec << " nsec" << std::endl; +// DEBUG << "RealTime::fromString: string " << s << " -> " +// << sec << " sec, " << nsec << " nsec" << endl; return RealTime(sec, nsec); } diff -r be43b2fe68e8 -r 573d45e9487b base/ResourceFinder.cpp --- a/base/ResourceFinder.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/base/ResourceFinder.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -152,7 +152,7 @@ QString prefix = *i; - std::cerr << "ResourceFinder::getResourcePath: Looking up file \"" << fileName.toStdString() << "\" for category \"" << resourceCat.toStdString() << "\" in prefix \"" << prefix.toStdString() << "\"" << std::endl; + DEBUG << "ResourceFinder::getResourcePath: Looking up file \"" << fileName << "\" for category \"" << resourceCat << "\" in prefix \"" << prefix << "\"" << endl; QString path = QString("%1%2/%3").arg(prefix).arg(resourceCat).arg(fileName); @@ -211,7 +211,7 @@ QDir userDir(user); if (!userDir.exists()) { if (!userDir.mkpath(user)) { - std::cerr << "ResourceFinder::getResourceSaveDir: ERROR: Failed to create user resource path \"" << user.toStdString() << "\"" << std::endl; + std::cerr << "ResourceFinder::getResourceSaveDir: ERROR: Failed to create user resource path \"" << user << "\"" << std::endl; return ""; } } @@ -221,7 +221,7 @@ QDir saveDir(save); if (!saveDir.exists()) { if (!userDir.mkpath(save)) { - std::cerr << "ResourceFinder::getResourceSaveDir: ERROR: Failed to create user resource path \"" << save.toStdString() << "\"" << std::endl; + std::cerr << "ResourceFinder::getResourceSaveDir: ERROR: Failed to create user resource path \"" << save << "\"" << std::endl; return ""; } } @@ -278,11 +278,11 @@ // This is the lowest-priority alternative path for this // resource, so we know that there must be no installed copy. // Install one to the user location. - std::cerr << "ResourceFinder::unbundleResource: File " << fileName.toStdString() << " is bundled, un-bundling it" << std::endl; + DEBUG << "ResourceFinder::unbundleResource: File " << fileName << " is bundled, un-bundling it" << endl; QString target = getResourceSavePath(resourceCat, fileName); QFile file(path); if (!file.copy(target)) { - std::cerr << "ResourceFinder::unbundleResource: ERROR: Failed to un-bundle resource file \"" << fileName.toStdString() << "\" to user location \"" << target.toStdString() << "\"" << std::endl; + std::cerr << "ResourceFinder::unbundleResource: ERROR: Failed to un-bundle resource file \"" << fileName << "\" to user location \"" << target << "\"" << std::endl; return false; } diff -r be43b2fe68e8 -r 573d45e9487b base/ResourceFinder.h --- a/base/ResourceFinder.h Tue Jun 14 13:43:03 2011 +0100 +++ b/base/ResourceFinder.h Tue Jun 14 14:47:59 2011 +0100 @@ -23,6 +23,8 @@ #define _RESOURCE_FINDER_H_ #include + +#include "Debug.h" class ResourceFinder { diff -r be43b2fe68e8 -r 573d45e9487b base/StorageAdviser.cpp --- a/base/StorageAdviser.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/base/StorageAdviser.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -36,9 +36,9 @@ int maximumSize) { #ifdef DEBUG_STORAGE_ADVISER - std::cerr << "StorageAdviser::recommend: Criteria " << criteria + DEBUG << "StorageAdviser::recommend: Criteria " << criteria << ", minimumSize " << minimumSize - << ", maximumSize " << maximumSize << std::endl; + << ", maximumSize " << maximumSize << endl; #endif if (m_baseRecommendation != NoRecommendation) { diff -r be43b2fe68e8 -r 573d45e9487b base/StringBits.cpp --- a/base/StringBits.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/base/StringBits.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -139,7 +139,7 @@ for (int j = 0; j < tests.size(); ++j) { cout << endl; - cout << tests[j].toStdString() << endl; + cout << tests[j] << endl; cout << "->" << endl << "("; QStringList l = splitQuoted(tests[j], ' '); for (int i = 0; i < l.size(); ++i) { diff -r be43b2fe68e8 -r 573d45e9487b base/TempDirectory.cpp --- a/base/TempDirectory.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/base/TempDirectory.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -44,7 +44,7 @@ TempDirectory::~TempDirectory() { - std::cerr << "TempDirectory::~TempDirectory" << std::endl; + DEBUG << "TempDirectory::~TempDirectory" << endl; cleanup(); } @@ -208,7 +208,7 @@ if (!QFile(fi.absoluteFilePath()).remove()) { std::cerr << "WARNING: TempDirectory::cleanup: " << "Failed to unlink file \"" - << fi.absoluteFilePath().toStdString() << "\"" + << fi.absoluteFilePath() << "\"" << std::endl; } } @@ -219,13 +219,13 @@ if (!dir.cdUp()) { std::cerr << "WARNING: TempDirectory::cleanup: " << "Failed to cd to parent directory of " - << tmpdir.toStdString() << std::endl; + << tmpdir << std::endl; return; } if (!dir.rmdir(dirname)) { std::cerr << "WARNING: TempDirectory::cleanup: " << "Failed to remove directory " - << dirname.toStdString() << std::endl; + << dirname << std::endl; } } @@ -248,7 +248,7 @@ if (subdir.count() == 0) { std::cerr << "INFO: Found temporary directory with no .pid file in it!\n(directory=\"" - << dirpath.toStdString() << "\"). Removing it..." << std::endl; + << dirpath << "\"). Removing it..." << std::endl; cleanupDirectory(dirpath); std::cerr << "...done." << std::endl; continue; diff -r be43b2fe68e8 -r 573d45e9487b base/TempWriteFile.cpp --- a/base/TempWriteFile.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/base/TempWriteFile.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -27,7 +27,7 @@ temp.setAutoRemove(false); temp.open(); // creates the file and opens it atomically if (temp.error()) { - std::cerr << "TempWriteFile: Failed to create temporary file in directory of " << m_target.toStdString() << ": " << temp.errorString().toStdString() << std::endl; + std::cerr << "TempWriteFile: Failed to create temporary file in directory of " << m_target << ": " << temp.errorString() << std::endl; throw FileOperationFailed(temp.fileName(), "creation"); } @@ -60,7 +60,7 @@ // Therefore, delete first the existing file. if (dir.exists(m_target)) dir.remove(m_target); if (!dir.rename(m_temp, m_target)) { - std::cerr << "TempWriteFile: Failed to rename temporary file " << m_temp.toStdString() << " to target " << m_target.toStdString() << std::endl; + std::cerr << "TempWriteFile: Failed to rename temporary file " << m_temp << " to target " << m_target << std::endl; throw FileOperationFailed(m_temp, "rename"); } diff -r be43b2fe68e8 -r 573d45e9487b base/XmlExportable.cpp --- a/base/XmlExportable.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/base/XmlExportable.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -25,7 +25,7 @@ XmlExportable::toXmlString(QString indent, QString extraAttributes) const { -// std::cerr << "XmlExportable::toXmlString" << std::endl; +// DEBUG << "XmlExportable::toXmlString" << endl; QString s; diff -r be43b2fe68e8 -r 573d45e9487b base/XmlExportable.h --- a/base/XmlExportable.h Tue Jun 14 13:43:03 2011 +0100 +++ b/base/XmlExportable.h Tue Jun 14 14:47:59 2011 +0100 @@ -18,6 +18,8 @@ #include +#include "Debug.h" + class QTextStream; class XmlExportable diff -r be43b2fe68e8 -r 573d45e9487b data/fft/FFTDataServer.cpp --- a/data/fft/FFTDataServer.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fft/FFTDataServer.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -191,7 +191,7 @@ if (server->getFillCompletion() < 50) distance += 100; #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::getFuzzyInstance: Distance for server " << server << " is " << distance << ", best is " << bestdist << std::endl; + DEBUG << "FFTDataServer::getFuzzyInstance: Distance for server " << server << " is " << distance << ", best is " << bestdist << endl; #endif if (bestdist == -1 || distance < bestdist) { @@ -204,7 +204,7 @@ if (bestdist >= 0) { FFTDataServer *server = best->second.first; #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::getFuzzyInstance: We like server " << server << " (with distance " << bestdist << ")" << std::endl; + DEBUG << "FFTDataServer::getFuzzyInstance: We like server " << server << " (with distance " << bestdist << ")" << endl; #endif claimInstance(server, false); return server; @@ -228,7 +228,7 @@ FFTDataServer::findServer(QString n) { #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::findServer(\"" << n.toStdString() << "\")" << std::endl; + DEBUG << "FFTDataServer::findServer(\"" << n << "\")" << endl; #endif if (m_servers.find(n) != m_servers.end()) { @@ -236,7 +236,7 @@ FFTDataServer *server = m_servers[n].first; #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::findServer(\"" << n.toStdString() << "\"): found " << server << std::endl; + DEBUG << "FFTDataServer::findServer(\"" << n << "\"): found " << server << endl; #endif claimInstance(server, false); @@ -245,7 +245,7 @@ } #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::findServer(\"" << n.toStdString() << "\"): not found" << std::endl; + DEBUG << "FFTDataServer::findServer(\"" << n << "\"): not found" << endl; #endif return 0; @@ -264,7 +264,7 @@ "FFTDataServer::claimInstance::m_serverMapMutex"); #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::claimInstance(" << server << ")" << std::endl; + DEBUG << "FFTDataServer::claimInstance(" << server << ")" << endl; #endif for (ServerMap::iterator i = m_servers.begin(); i != m_servers.end(); ++i) { @@ -275,7 +275,7 @@ if (*j == server) { #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::claimInstance: found in released server list, removing from it" << std::endl; + DEBUG << "FFTDataServer::claimInstance: found in released server list, removing from it" << endl; #endif m_releasedServers.erase(j); break; @@ -285,7 +285,7 @@ ++i->second.second; #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::claimInstance: new refcount is " << i->second.second << std::endl; + DEBUG << "FFTDataServer::claimInstance: new refcount is " << i->second.second << endl; #endif return; @@ -309,7 +309,7 @@ "FFTDataServer::releaseInstance::m_serverMapMutex"); #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::releaseInstance(" << server << ")" << std::endl; + DEBUG << "FFTDataServer::releaseInstance(" << server << ")" << endl; #endif // -- if ref count > 0, decrement and return @@ -332,18 +332,18 @@ /*!!! if (server->m_lastUsedCache == -1) { // never used #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::releaseInstance: instance " + DEBUG << "FFTDataServer::releaseInstance: instance " << server << " has never been used, erasing" - << std::endl; + << endl; #endif delete server; m_servers.erase(i); } else { */ #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::releaseInstance: instance " + DEBUG << "FFTDataServer::releaseInstance: instance " << server << " no longer in use, marking for possible collection" - << std::endl; + << endl; #endif bool found = false; for (ServerQueue::iterator j = m_releasedServers.begin(); @@ -361,9 +361,9 @@ //!!! } } else { #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::releaseInstance: instance " + DEBUG << "FFTDataServer::releaseInstance: instance " << server << " now has refcount " << i->second.second - << std::endl; + << endl; #endif } return; @@ -378,8 +378,8 @@ FFTDataServer::purgeLimbo(int maxSize) { #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::purgeLimbo(" << maxSize << "): " - << m_releasedServers.size() << " candidates" << std::endl; + DEBUG << "FFTDataServer::purgeLimbo(" << maxSize << "): " + << m_releasedServers.size() << " candidates" << endl; #endif while (int(m_releasedServers.size()) > maxSize) { @@ -389,8 +389,8 @@ bool found = false; #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::purgeLimbo: considering candidate " - << server << std::endl; + DEBUG << "FFTDataServer::purgeLimbo: considering candidate " + << server << endl; #endif for (ServerMap::iterator i = m_servers.begin(); i != m_servers.end(); ++i) { @@ -405,8 +405,8 @@ break; } #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::purgeLimbo: looks OK, erasing it" - << std::endl; + DEBUG << "FFTDataServer::purgeLimbo: looks OK, erasing it" + << endl; #endif m_servers.erase(i); @@ -426,8 +426,8 @@ } #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::purgeLimbo(" << maxSize << "): " - << m_releasedServers.size() << " remain" << std::endl; + DEBUG << "FFTDataServer::purgeLimbo(" << maxSize << "): " + << m_releasedServers.size() << " remain" << endl; #endif } @@ -439,8 +439,8 @@ "FFTDataServer::modelAboutToBeDeleted::m_serverMapMutex"); #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::modelAboutToBeDeleted(" << model << ")" - << std::endl; + DEBUG << "FFTDataServer::modelAboutToBeDeleted(" << model << ")" + << endl; #endif for (ServerMap::iterator i = m_servers.begin(); i != m_servers.end(); ++i) { @@ -450,12 +450,12 @@ if (server->getModel() == model) { #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::modelAboutToBeDeleted: server is " - << server << std::endl; + DEBUG << "FFTDataServer::modelAboutToBeDeleted: server is " + << server << endl; #endif if (i->second.second > 0) { - std::cerr << "WARNING: FFTDataServer::modelAboutToBeDeleted: Model " << model << " (\"" << model->objectName().toStdString() << "\") is about to be deleted, but is still being referred to by FFT server " << server << " with non-zero refcount " << i->second.second << std::endl; + std::cerr << "WARNING: FFTDataServer::modelAboutToBeDeleted: Model " << model << " (\"" << model->objectName() << "\") is about to be deleted, but is still being referred to by FFT server " << server << " with non-zero refcount " << i->second.second << std::endl; server->suspendWrites(); return; } @@ -463,14 +463,14 @@ j != m_releasedServers.end(); ++j) { if (*j == server) { #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::modelAboutToBeDeleted: erasing from released servers" << std::endl; + DEBUG << "FFTDataServer::modelAboutToBeDeleted: erasing from released servers" << endl; #endif m_releasedServers.erase(j); break; } } #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::modelAboutToBeDeleted: erasing server" << std::endl; + DEBUG << "FFTDataServer::modelAboutToBeDeleted: erasing server" << endl; #endif m_servers.erase(i); delete server; @@ -841,7 +841,7 @@ // preconditions: m_caches[c] exists and contains a file writer; // m_cacheVectorLock is not locked by this thread #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::makeCacheReader(" << c << ")" << std::endl; + DEBUG << "FFTDataServer::makeCacheReader(" << c << ")" << endl; #endif QThread *me = QThread::currentThread(); @@ -875,7 +875,7 @@ cb = m_caches.at(deleteCandidate); if (cb && cb->fileCacheReader.find(me) != cb->fileCacheReader.end()) { #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::makeCacheReader: Deleting probably unpopular reader " << deleteCandidate << " for this thread (as I create reader " << c << ")" << std::endl; + DEBUG << "FFTDataServer::makeCacheReader: Deleting probably unpopular reader " << deleteCandidate << " for this thread (as I create reader " << c << ")" << endl; #endif delete cb->fileCacheReader[me]; cb->fileCacheReader.erase(me); @@ -901,8 +901,8 @@ if (!cache->haveSetColumnAt(col)) { Profiler profiler("FFTDataServer::getMagnitudeAt: filling"); #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::getMagnitudeAt: calling fillColumn(" - << x << ")" << std::endl; + DEBUG << "FFTDataServer::getMagnitudeAt: calling fillColumn(" + << x << ")" << endl; #endif fillColumn(x); } @@ -1130,7 +1130,7 @@ if (!cache->haveSetColumnAt(col)) { Profiler profiler("FFTDataServer::getValuesAt: filling"); #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::getValuesAt(" << x << ", " << y << "): filling" << std::endl; + DEBUG << "FFTDataServer::getValuesAt(" << x << ", " << y << "): filling" << endl; #endif fillColumn(x); } @@ -1189,7 +1189,7 @@ /*!!! if (m_lastUsedCache == -1) { if (m_suspended) { - std::cerr << "FFTDataServer::isColumnReady(" << x << "): no cache, calling resume" << std::endl; + DEBUG << "FFTDataServer::isColumnReady(" << x << "): no cache, calling resume" << endl; resume(); } m_fillThread->start(); @@ -1258,12 +1258,12 @@ endFrame -= winsize / 2; #ifdef DEBUG_FFT_SERVER_FILL - std::cerr << "FFTDataServer::fillColumn: requesting frames " + DEBUG << "FFTDataServer::fillColumn: requesting frames " << startFrame + pfx << " -> " << endFrame << " ( = " << endFrame - (startFrame + pfx) << ") at index " << off + pfx << " in buffer of size " << m_fftSize << " with window size " << m_windowSize - << " from channel " << m_channel << std::endl; + << " from channel " << m_channel << endl; #endif QMutexLocker locker(&m_fftBuffersLock); @@ -1370,7 +1370,7 @@ } if (m_suspended) { -// std::cerr << "FFTDataServer::fillColumn(" << x << "): calling resume" << std::endl; +// DEBUG << "FFTDataServer::fillColumn(" << x << "): calling resume" << endl; // resume(); } } @@ -1446,7 +1446,7 @@ FFTDataServer::FillThread::run() { #ifdef DEBUG_FFT_SERVER_FILL - std::cerr << "FFTDataServer::FillThread::run()" << std::endl; + DEBUG << "FFTDataServer::FillThread::run()" << endl; #endif m_extent = 0; @@ -1454,7 +1454,7 @@ while (!m_server.m_model->isReady() && !m_server.m_exiting) { #ifdef DEBUG_FFT_SERVER_FILL - std::cerr << "FFTDataServer::FillThread::run(): waiting for model " << m_server.m_model << " to be ready" << std::endl; + DEBUG << "FFTDataServer::FillThread::run(): waiting for model " << m_server.m_model << " to be ready" << endl; #endif sleep(1); } @@ -1476,7 +1476,7 @@ try { m_server.fillColumn(int((f - start) / m_server.m_windowIncrement)); } catch (std::exception &e) { - std::cerr << "FFTDataServer::FillThread::run: exception: " << e.what() << std::endl; + DEBUG << "FFTDataServer::FillThread::run: exception: " << e.what() << endl; m_error = e.what(); m_server.fillComplete(); m_completion = 100; @@ -1525,7 +1525,7 @@ try { m_server.fillColumn(int((f - start) / m_server.m_windowIncrement)); } catch (std::exception &e) { - std::cerr << "FFTDataServer::FillThread::run: exception: " << e.what() << std::endl; + DEBUG << "FFTDataServer::FillThread::run: exception: " << e.what() << endl; m_error = e.what(); m_server.fillComplete(); m_completion = 100; @@ -1567,7 +1567,7 @@ m_extent = end; #ifdef DEBUG_FFT_SERVER - std::cerr << "FFTDataServer::FillThread::run exiting" << std::endl; + DEBUG << "FFTDataServer::FillThread::run exiting" << endl; #endif } diff -r be43b2fe68e8 -r 573d45e9487b data/fft/FFTFileCacheReader.cpp --- a/data/fft/FFTFileCacheReader.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fft/FFTFileCacheReader.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -157,7 +157,7 @@ void FFTFileCacheReader::getValuesAt(size_t x, size_t y, float &real, float &imag) const { -// std::cerr << "FFTFileCacheReader::getValuesAt(" << x << "," << y << ")" << std::endl; +// DEBUG << "FFTFileCacheReader::getValuesAt(" << x << "," << y << ")" << endl; switch (m_storageType) { @@ -216,7 +216,7 @@ { if (m_readbuf && m_readbufGood && (m_readbufCol == x || (m_readbufWidth > 1 && m_readbufCol+1 == x))) { -// std::cerr << "FFTFileCacheReader::haveSetColumnAt: short-circuiting; we know about this one" << std::endl; +// DEBUG << "FFTFileCacheReader::haveSetColumnAt: short-circuiting; we know about this one" << endl; return true; } return m_mfc->haveSetColumnAt(x); @@ -236,7 +236,7 @@ { Profiler profiler("FFTFileCacheReader::populateReadBuf", false); -// std::cerr << "FFTFileCacheReader::populateReadBuf(" << x << ")" << std::endl; +// DEBUG << "FFTFileCacheReader::populateReadBuf(" << x << ")" << endl; if (!m_readbuf) { m_readbuf = new char[m_mfc->getHeight() * 2 * m_mfc->getCellSize()]; diff -r be43b2fe68e8 -r 573d45e9487b data/fft/FFTFileCacheWriter.cpp --- a/data/fft/FFTFileCacheWriter.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fft/FFTFileCacheWriter.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -188,7 +188,7 @@ FFTFileCacheWriter::allColumnsWritten() { #ifdef DEBUG_FFT_FILE_CACHE_WRITER - std::cerr << "FFTFileCacheWriter::allColumnsWritten" << std::endl; + DEBUG << "FFTFileCacheWriter::allColumnsWritten" << endl; #endif m_mfc->close(); } diff -r be43b2fe68e8 -r 573d45e9487b data/fileio/AudioFileReaderFactory.cpp --- a/data/fileio/AudioFileReaderFactory.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fileio/AudioFileReaderFactory.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -73,15 +73,15 @@ { QString err; -// std::cerr << "AudioFileReaderFactory::createReader(\"" << source.getLocation().toStdString() << "\"): Requested rate: " << targetRate << std::endl; +// DEBUG << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\"): Requested rate: " << targetRate << endl; if (!source.isOK()) { - std::cerr << "AudioFileReaderFactory::createReader(\"" << source.getLocation().toStdString() << "\": Failed to retrieve source (transmission error?): " << source.getErrorString().toStdString() << std::endl; + std::cerr << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\": Failed to retrieve source (transmission error?): " << source.getErrorString() << std::endl; return 0; } if (!source.isAvailable()) { - std::cerr << "AudioFileReaderFactory::createReader(\"" << source.getLocation().toStdString() << "\": Source not found" << std::endl; + DEBUG << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\": Source not found" << endl; return 0; } @@ -98,7 +98,7 @@ reader->isOK() && reader->getSampleRate() != targetRate) { - std::cerr << "AudioFileReaderFactory::createReader: WAV file rate: " << reader->getSampleRate() << ", creating resampling reader" << std::endl; + DEBUG << "AudioFileReaderFactory::createReader: WAV file rate: " << reader->getSampleRate() << ", creating resampling reader" << endl; delete reader; reader = new ResamplingWavFileReader @@ -189,7 +189,7 @@ reader->isOK() && reader->getSampleRate() != targetRate) { - std::cerr << "AudioFileReaderFactory::createReader: WAV file rate: " << reader->getSampleRate() << ", creating resampling reader" << std::endl; + DEBUG << "AudioFileReaderFactory::createReader: WAV file rate: " << reader->getSampleRate() << ", creating resampling reader" << endl; delete reader; reader = new ResamplingWavFileReader @@ -272,10 +272,10 @@ std::cerr << "AudioFileReaderFactory: Preferred reader for " << "url \"" << source.getLocation().toStdString() << "\" (content type \"" - << source.getContentType().toStdString() << "\") failed"; + << source.getContentType() << "\") failed"; if (reader->getError() != "") { - std::cerr << ": \"" << reader->getError().toStdString() << "\""; + std::cerr << ": \"" << reader->getError() << "\""; } std::cerr << std::endl; delete reader; diff -r be43b2fe68e8 -r 573d45e9487b data/fileio/BZipFileDevice.cpp --- a/data/fileio/BZipFileDevice.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fileio/BZipFileDevice.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -30,7 +30,7 @@ BZipFileDevice::~BZipFileDevice() { -// std::cerr << "BZipFileDevice::~BZipFileDevice(" << m_fileName.toStdString() << ")" << std::endl; +// DEBUG << "BZipFileDevice::~BZipFileDevice(" << m_fileName << ")" << endl; if (m_bzFile) close(); } @@ -88,7 +88,7 @@ return false; } -// std::cerr << "BZipFileDevice: opened \"" << m_fileName.toStdString() << "\" for writing" << std::endl; +// std::cerr << "BZipFileDevice: opened \"" << m_fileName << "\" for writing" << std::endl; setErrorString(QString()); setOpenMode(mode); @@ -115,7 +115,7 @@ return false; } -// std::cerr << "BZipFileDevice: opened \"" << m_fileName.toStdString() << "\" for reading" << std::endl; +// std::cerr << "BZipFileDevice: opened \"" << m_fileName << "\" for reading" << std::endl; m_atEnd = false; @@ -178,7 +178,7 @@ int bzError = BZ_OK; int read = BZ2_bzRead(&bzError, m_bzFile, data, maxSize); -// std::cerr << "BZipFileDevice::readData: requested " << maxSize << ", read " << read << std::endl; +// DEBUG << "BZipFileDevice::readData: requested " << maxSize << ", read " << read << endl; if (bzError != BZ_OK) { if (bzError != BZ_STREAM_END) { @@ -187,7 +187,7 @@ m_ok = false; return -1; } else { -// std::cerr << "BZipFileDevice::readData: reached end of file" << std::endl; +// DEBUG << "BZipFileDevice::readData: reached end of file" << endl; m_atEnd = true; } } @@ -201,7 +201,7 @@ int bzError = BZ_OK; BZ2_bzWrite(&bzError, m_bzFile, (void *)data, maxSize); -// std::cerr << "BZipFileDevice::writeData: " << maxSize << " to write" << std::endl; +// DEBUG << "BZipFileDevice::writeData: " << maxSize << " to write" << endl; if (bzError != BZ_OK) { std::cerr << "BZipFileDevice::writeData: error condition" << std::endl; @@ -210,7 +210,7 @@ return -1; } -// std::cerr << "BZipFileDevice::writeData: wrote " << maxSize << std::endl; +// DEBUG << "BZipFileDevice::writeData: wrote " << maxSize << endl; return maxSize; } diff -r be43b2fe68e8 -r 573d45e9487b data/fileio/CSVFileReader.cpp --- a/data/fileio/CSVFileReader.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fileio/CSVFileReader.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -59,10 +59,10 @@ CSVFileReader::~CSVFileReader() { - std::cerr << "CSVFileReader::~CSVFileReader: file is " << m_file << std::endl; + DEBUG << "CSVFileReader::~CSVFileReader: file is " << m_file << endl; if (m_file) { - std::cerr << "CSVFileReader::CSVFileReader: Closing file" << std::endl; + DEBUG << "CSVFileReader::CSVFileReader: Closing file" << endl; m_file->close(); } delete m_file; @@ -337,7 +337,7 @@ << list[i].toStdString() << "\" in data line " << lineno+1 << ":" << std::endl; - std::cerr << line.toStdString() << std::endl; + std::cerr << line << std::endl; ++warnings; } else if (warnings == warnLimit) { // std::cerr << "WARNING: Too many warnings" << std::endl; @@ -345,8 +345,8 @@ } } -// std::cerr << "Setting bin values for count " << lineno << ", frame " -// << frameNo << ", time " << RealTime::frame2RealTime(frameNo, sampleRate) << std::endl; +// DEBUG << "Setting bin values for count " << lineno << ", frame " +// << frameNo << ", time " << RealTime::frame2RealTime(frameNo, sampleRate) << endl; model3->setColumn(lineno, values); } diff -r be43b2fe68e8 -r 573d45e9487b data/fileio/CachedFile.cpp --- a/data/fileio/CachedFile.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fileio/CachedFile.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -78,8 +78,8 @@ { Profiler p("CachedFile::CachedFile[1]"); - std::cerr << "CachedFile::CachedFile: origin is \"" - << origin.toStdString() << "\"" << std::endl; + DEBUG << "CachedFile::CachedFile: origin is \"" + << origin << "\"" << endl; check(); } @@ -93,8 +93,8 @@ { Profiler p("CachedFile::CachedFile[2]"); - std::cerr << "CachedFile::CachedFile: url is \"" - << url.toString().toStdString() << "\"" << std::endl; + DEBUG << "CachedFile::CachedFile: url is \"" + << url.toString() << "\"" << endl; check(); } @@ -132,20 +132,20 @@ m_localFilename = getLocalFilenameFor(m_origin); if (!QFileInfo(m_localFilename).exists()) { - std::cerr << "CachedFile::check: Local file does not exist, making a note that it hasn't been retrieved" << std::endl; + DEBUG << "CachedFile::check: Local file does not exist, making a note that it hasn't been retrieved" << endl; updateLastRetrieval(false); // empirically! } QDateTime lastRetrieval = getLastRetrieval(); if (lastRetrieval.isValid()) { - std::cerr << "CachedFile::check: Valid last retrieval at " - << lastRetrieval.toString().toStdString() << std::endl; + DEBUG << "CachedFile::check: Valid last retrieval at " + << lastRetrieval.toString() << endl; // this will not be the case if the file is missing, after // updateLastRetrieval(false) was called above m_ok = true; if (lastRetrieval.addDays(2) < QDateTime::currentDateTime()) { //!!! - std::cerr << "CachedFile::check: Out of date; trying to retrieve again" << std::endl; + DEBUG << "CachedFile::check: Out of date; trying to retrieve again" << endl; // doesn't matter if retrieval fails -- we just don't // update the last retrieval time @@ -154,17 +154,17 @@ // retrieval every single time if it isn't working if (retrieve()) { - std::cerr << "CachedFile::check: Retrieval succeeded" << std::endl; + DEBUG << "CachedFile::check: Retrieval succeeded" << endl; updateLastRetrieval(true); } else { std::cerr << "CachedFile::check: Retrieval failed, will try again later (using existing file for now)" << std::endl; } } } else { - std::cerr << "CachedFile::check: No valid last retrieval" << std::endl; + DEBUG << "CachedFile::check: No valid last retrieval" << endl; // there is no acceptable file if (retrieve()) { - std::cerr << "CachedFile::check: Retrieval succeeded" << std::endl; + DEBUG << "CachedFile::check: Retrieval succeeded" << endl; m_ok = true; updateLastRetrieval(true); } else { @@ -191,28 +191,28 @@ FileSource fs(m_origin, m_reporter, m_preferredContentType); if (!fs.isOK() || !fs.isAvailable()) { - std::cerr << "CachedFile::retrieve: ERROR: FileSource reported unavailable or failure" << std::endl; + DEBUG << "CachedFile::retrieve: ERROR: FileSource reported unavailable or failure" << endl; return false; } fs.waitForData(); if (!fs.isOK()) { - std::cerr << "CachedFile::retrieve: ERROR: FileSource reported failure during receive" << std::endl; + DEBUG << "CachedFile::retrieve: ERROR: FileSource reported failure during receive" << endl; return false; } QString tempName = fs.getLocalFilename(); QFile tempFile(tempName); if (!tempFile.exists()) { - std::cerr << "CachedFile::retrieve: ERROR: FileSource reported success, but local temporary file \"" << tempName.toStdString() << "\" does not exist" << std::endl; + DEBUG << "CachedFile::retrieve: ERROR: FileSource reported success, but local temporary file \"" << tempName << "\" does not exist" << endl; return false; } QFile previous(m_localFilename); if (previous.exists()) { if (!previous.remove()) { - std::cerr << "CachedFile::retrieve: ERROR: Failed to remove previous copy of cached file at \"" << m_localFilename.toStdString() << "\"" << std::endl; + std::cerr << "CachedFile::retrieve: ERROR: Failed to remove previous copy of cached file at \"" << m_localFilename << "\"" << std::endl; return false; } } @@ -222,11 +222,11 @@ //!!! disk space left) if (!tempFile.copy(m_localFilename)) { - std::cerr << "CachedFile::retrieve: ERROR: Failed to copy newly retrieved file from \"" << tempName.toStdString() << "\" to \"" << m_localFilename.toStdString() << "\"" << std::endl; + std::cerr << "CachedFile::retrieve: ERROR: Failed to copy newly retrieved file from \"" << tempName << "\" to \"" << m_localFilename << "\"" << std::endl; return false; } - std::cerr << "CachedFile::retrieve: Successfully copied newly retrieved file \"" << tempName.toStdString() << "\" to its home at \"" << m_localFilename.toStdString() << "\"" << std::endl; + DEBUG << "CachedFile::retrieve: Successfully copied newly retrieved file \"" << tempName << "\" to its home at \"" << m_localFilename << "\"" << endl; return true; } diff -r be43b2fe68e8 -r 573d45e9487b data/fileio/CodedAudioFileReader.cpp --- a/data/fileio/CodedAudioFileReader.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fileio/CodedAudioFileReader.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -40,7 +40,7 @@ m_resampler(0), m_resampleBuffer(0) { -// std::cerr << "CodedAudioFileReader::CodedAudioFileReader: rate " << targetRate << std::endl; +// DEBUG << "CodedAudioFileReader::CodedAudioFileReader: rate " << targetRate << endl; m_frameCount = 0; m_sampleRate = targetRate; @@ -54,14 +54,14 @@ if (m_cacheFileWritePtr) sf_close(m_cacheFileWritePtr); -// std::cerr << "CodedAudioFileReader::~CodedAudioFileReader: deleting cache file reader" << std::endl; +// DEBUG << "CodedAudioFileReader::~CodedAudioFileReader: deleting cache file reader" << endl; delete m_cacheFileReader; delete[] m_cacheWriteBuffer; if (m_cacheFileName != "") { if (!QFile(m_cacheFileName).remove()) { - std::cerr << "WARNING: CodedAudioFileReader::~CodedAudioFileReader: Failed to delete cache file \"" << m_cacheFileName.toStdString() << "\"" << std::endl; + std::cerr << "WARNING: CodedAudioFileReader::~CodedAudioFileReader: Failed to delete cache file \"" << m_cacheFileName << "\"" << std::endl; } } @@ -72,7 +72,7 @@ void CodedAudioFileReader::startSerialised(QString id) { -// std::cerr << "CodedAudioFileReader::startSerialised(" << id.toStdString() << ")" << std::endl; +// DEBUG << "CodedAudioFileReader::startSerialised(" << id << ")" << endl; delete m_serialiser; m_serialiser = new Serialiser(id); @@ -92,15 +92,15 @@ { QMutexLocker locker(&m_cacheMutex); -// std::cerr << "CodedAudioFileReader::initialiseDecodeCache: file rate = " << m_fileRate << std::endl; +// DEBUG << "CodedAudioFileReader::initialiseDecodeCache: file rate = " << m_fileRate << endl; if (m_fileRate == 0) { - std::cerr << "CodedAudioFileReader::initialiseDecodeCache: ERROR: File sample rate unknown (bug in subclass implementation?)" << std::endl; + DEBUG << "CodedAudioFileReader::initialiseDecodeCache: ERROR: File sample rate unknown (bug in subclass implementation?)" << endl; m_fileRate = 48000; // got to have something } if (m_sampleRate == 0) { m_sampleRate = m_fileRate; - std::cerr << "CodedAudioFileReader::initialiseDecodeCache: rate (from file) = " << m_fileRate << std::endl; + DEBUG << "CodedAudioFileReader::initialiseDecodeCache: rate (from file) = " << m_fileRate << endl; } if (m_fileRate != m_sampleRate) { std::cerr << "CodedAudioFileReader: resampling " << m_fileRate << " -> " << m_sampleRate << std::endl; @@ -144,7 +144,7 @@ m_cacheFileReader = new WavFileReader(m_cacheFileName); if (!m_cacheFileReader->isOK()) { - std::cerr << "ERROR: CodedAudioFileReader::initialiseDecodeCache: Failed to construct WAV file reader for temporary file: " << m_cacheFileReader->getError().toStdString() << std::endl; + std::cerr << "ERROR: CodedAudioFileReader::initialiseDecodeCache: Failed to construct WAV file reader for temporary file: " << m_cacheFileReader->getError() << std::endl; delete m_cacheFileReader; m_cacheFileReader = 0; m_cacheMode = CacheInMemory; @@ -152,7 +152,7 @@ } } else { - std::cerr << "CodedAudioFileReader::initialiseDecodeCache: failed to open cache file \"" << m_cacheFileName.toStdString() << "\" (" << m_channelCount << " channels, sample rate " << m_sampleRate << " for writing, falling back to in-memory cache" << std::endl; + std::cerr << "CodedAudioFileReader::initialiseDecodeCache: failed to open cache file \"" << m_cacheFileName << "\" (" << m_channelCount << " channels, sample rate " << m_sampleRate << " for writing, falling back to in-memory cache" << std::endl; m_cacheMode = CacheInMemory; } @@ -354,7 +354,7 @@ // locking) if (!m_initialised) { - std::cerr << "CodedAudioFileReader::getInterleavedFrames: not initialised" << std::endl; + DEBUG << "CodedAudioFileReader::getInterleavedFrames: not initialised" << endl; return; } diff -r be43b2fe68e8 -r 573d45e9487b data/fileio/FileReadThread.cpp --- a/data/fileio/FileReadThread.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fileio/FileReadThread.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -47,7 +47,7 @@ notifyCancelled(); #ifdef DEBUG_FILE_READ_THREAD - std::cerr << "FileReadThread::run() exiting" << std::endl; + DEBUG << "FileReadThread::run() exiting" << endl; #endif } @@ -55,7 +55,7 @@ FileReadThread::finish() { #ifdef DEBUG_FILE_READ_THREAD - std::cerr << "FileReadThread::finish()" << std::endl; + DEBUG << "FileReadThread::finish()" << endl; #endif { @@ -73,7 +73,7 @@ m_condition.wakeAll(); #ifdef DEBUG_FILE_READ_THREAD - std::cerr << "FileReadThread::finish() exiting" << std::endl; + DEBUG << "FileReadThread::finish() exiting" << endl; #endif } @@ -113,7 +113,7 @@ } #ifdef DEBUG_FILE_READ_THREAD - std::cerr << "FileReadThread::cancel(" << token << ") waking condition" << std::endl; + DEBUG << "FileReadThread::cancel(" << token << ") waking condition" << endl; #endif m_condition.wakeAll(); @@ -216,7 +216,7 @@ m_mutex.unlock(); #ifdef DEBUG_FILE_READ_THREAD - std::cerr << "FileReadThread::process: reading " << request.start << ", " << request.size << " on " << request.fd << std::endl; + DEBUG << "FileReadThread::process: reading " << request.start << ", " << request.size << " on " << request.fd << endl; #endif bool successful = false; @@ -289,14 +289,14 @@ m_queue.erase(token); m_readyRequests[token] = request; #ifdef DEBUG_FILE_READ_THREAD - std::cerr << "FileReadThread::process: done, marking as ready (success = " << m_readyRequests[token].successful << ")" << std::endl; + DEBUG << "FileReadThread::process: done, marking as ready (success = " << m_readyRequests[token].successful << ")" << endl; #endif } else { #ifdef DEBUG_FILE_READ_THREAD if (m_exiting) { - std::cerr << "FileReadThread::process: exiting" << std::endl; + DEBUG << "FileReadThread::process: exiting" << endl; } else { - std::cerr << "FileReadThread::process: request disappeared" << std::endl; + DEBUG << "FileReadThread::process: request disappeared" << endl; } #endif } @@ -312,7 +312,7 @@ int token = *m_newlyCancelled.begin(); #ifdef DEBUG_FILE_READ_THREAD - std::cerr << "FileReadThread::notifyCancelled: token " << token << std::endl; + DEBUG << "FileReadThread::notifyCancelled: token " << token << endl; #endif m_newlyCancelled.erase(token); diff -r be43b2fe68e8 -r 573d45e9487b data/fileio/FileSource.cpp --- a/data/fileio/FileSource.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fileio/FileSource.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -88,12 +88,12 @@ } #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::FileSource(" << fileOrUrl.toStdString() << "): url <" << m_url.toString().toStdString() << ">" << std::endl; + DEBUG << "FileSource::FileSource(" << fileOrUrl << "): url <" << m_url.toString() << ">" << endl; incCount(m_url.toString()); #endif if (!canHandleScheme(m_url)) { - std::cerr << "FileSource::FileSource: ERROR: Unsupported scheme in URL \"" << m_url.toString().toStdString() << "\"" << std::endl; + DEBUG << "FileSource::FileSource: ERROR: Unsupported scheme in URL \"" << m_url.toString() << "\"" << endl; m_errorString = tr("Unsupported scheme in URL"); return; } @@ -103,7 +103,7 @@ if (!isRemote() && !isAvailable()) { #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::FileSource: Failed to open local file with URL \"" << m_url.toString().toStdString() << "; trying again assuming filename was encoded" << std::endl; + std::cerr << "FileSource::FileSource: Failed to open local file with URL \"" << m_url.toString() << "; trying again assuming filename was encoded" << std::endl; #endif m_url = QUrl::fromEncoded(fileOrUrl.toAscii()); init(); @@ -148,7 +148,7 @@ } #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::FileSource(string) exiting" << std::endl; + DEBUG << "FileSource::FileSource(string) exiting" << endl; #endif } @@ -166,12 +166,12 @@ m_refCounted(false) { #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::FileSource(" << url.toString().toStdString() << ") [as url]" << std::endl; + DEBUG << "FileSource::FileSource(" << url.toString() << ") [as url]" << endl; incCount(m_url.toString()); #endif if (!canHandleScheme(m_url)) { - std::cerr << "FileSource::FileSource: ERROR: Unsupported scheme in URL \"" << m_url.toString().toStdString() << "\"" << std::endl; + DEBUG << "FileSource::FileSource: ERROR: Unsupported scheme in URL \"" << m_url.toString() << "\"" << endl; m_errorString = tr("Unsupported scheme in URL"); return; } @@ -179,7 +179,7 @@ init(); #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::FileSource(url) exiting" << std::endl; + DEBUG << "FileSource::FileSource(url) exiting" << endl; #endif } @@ -198,12 +198,12 @@ m_refCounted(false) { #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::FileSource(" << m_url.toString().toStdString() << ") [copy ctor]" << std::endl; + DEBUG << "FileSource::FileSource(" << m_url.toString() << ") [copy ctor]" << endl; incCount(m_url.toString()); #endif if (!canHandleScheme(m_url)) { - std::cerr << "FileSource::FileSource: ERROR: Unsupported scheme in URL \"" << m_url.toString().toStdString() << "\"" << std::endl; + DEBUG << "FileSource::FileSource: ERROR: Unsupported scheme in URL \"" << m_url.toString() << "\"" << endl; m_errorString = tr("Unsupported scheme in URL"); return; } @@ -213,8 +213,8 @@ } else { QMutexLocker locker(&m_mapMutex); #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::FileSource(copy ctor): ref count is " - << m_refCountMap[m_url] << std::endl; + DEBUG << "FileSource::FileSource(copy ctor): ref count is " + << m_refCountMap[m_url] << endl; #endif if (m_refCountMap[m_url] > 0) { m_refCountMap[m_url]++; @@ -232,18 +232,18 @@ m_done = true; #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::FileSource(" << m_url.toString().toStdString() << ") [copy ctor]: note: local filename is \"" << m_localFilename.toStdString() << "\"" << std::endl; + DEBUG << "FileSource::FileSource(" << m_url.toString() << ") [copy ctor]: note: local filename is \"" << m_localFilename << "\"" << endl; #endif #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::FileSource(copy ctor) exiting" << std::endl; + DEBUG << "FileSource::FileSource(copy ctor) exiting" << endl; #endif } FileSource::~FileSource() { #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource(" << m_url.toString().toStdString() << ")::~FileSource" << std::endl; + std::cerr << "FileSource(" << m_url.toString() << ")::~FileSource" << std::endl; decCount(m_url.toString()); #endif @@ -257,7 +257,7 @@ { if (!isRemote()) { #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::init: Not a remote URL" << std::endl; + DEBUG << "FileSource::init: Not a remote URL" << endl; #endif bool literal = false; m_localFilename = m_url.toLocalFile(); @@ -269,8 +269,8 @@ m_localFilename = QFileInfo(m_localFilename).absoluteFilePath(); #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::init: URL translates to local filename \"" - << m_localFilename.toStdString() << "\" (with literal=" << literal << ")" << std::endl; + DEBUG << "FileSource::init: URL translates to local filename \"" + << m_localFilename << "\" (with literal=" << literal << ")" << endl; #endif m_ok = true; m_lastStatus = 200; @@ -280,7 +280,7 @@ m_lastStatus = 404; } else { #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::init: Local file of this name does not exist, trying URL as a literal filename" << std::endl; + DEBUG << "FileSource::init: Local file of this name does not exist, trying URL as a literal filename" << endl; #endif // Again, QUrl may have been mistreating us -- // e.g. dropping a part that looks like query data @@ -298,7 +298,7 @@ if (createCacheFile()) { #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::init: Already have this one" << std::endl; + DEBUG << "FileSource::init: Already have this one" << endl; #endif m_ok = true; if (!QFileInfo(m_localFilename).exists()) { @@ -317,8 +317,8 @@ QString scheme = m_url.scheme().toLower(); #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::init: Don't have local copy of \"" - << m_url.toString().toStdString() << "\", retrieving" << std::endl; + DEBUG << "FileSource::init: Don't have local copy of \"" + << m_url.toString() << "\", retrieving" << endl; #endif if (scheme == "http") { @@ -343,7 +343,7 @@ cleanup(); m_refCountMap[m_url]++; #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::init: Another FileSource has got there first, abandoning our download and using theirs" << std::endl; + DEBUG << "FileSource::init: Another FileSource has got there first, abandoning our download and using theirs" << endl; #endif m_localFilename = m_remoteLocalMap[m_url]; m_refCounted = true; @@ -426,8 +426,8 @@ QString path = "/" + QString(m_url.toEncoded()).section('/', 3); #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource: path is \"" - << path.toStdString() << "\"" << std::endl; + DEBUG << "FileSource: path is \"" + << path << "\"" << endl; #endif if (m_preferredContentType == "") { @@ -435,7 +435,7 @@ } else { #ifdef DEBUG_FILE_SOURCE std::cerr << "FileSource: indicating preferred content type of \"" - << m_preferredContentType.toStdString() << "\"" << std::endl; + << m_preferredContentType << "\"" << std::endl; #endif QHttpRequestHeader header("GET", path); header.setValue("Host", m_url.host()); @@ -528,8 +528,8 @@ if (!m_ok) available = false; else available = (m_lastStatus / 100 == 2); #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::isAvailable: " << (available ? "yes" : "no") - << std::endl; + DEBUG << "FileSource::isAvailable: " << (available ? "yes" : "no") + << endl; #endif return available; } @@ -547,7 +547,7 @@ FileSource::waitForData() { while (m_ok && !m_done) { -// std::cerr << "FileSource::waitForData: calling QApplication::processEvents" << std::endl; +// DEBUG << "FileSource::waitForData: calling QApplication::processEvents" << endl; QCoreApplication::processEvents(); usleep(10000); } @@ -627,14 +627,14 @@ FileSource::httpResponseHeaderReceived(const QHttpResponseHeader &resp) { #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::httpResponseHeaderReceived" << std::endl; + DEBUG << "FileSource::httpResponseHeaderReceived" << endl; #endif if (resp.statusCode() / 100 == 3) { QString location = resp.value("Location"); #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::responseHeaderReceived: redirect to \"" - << location.toStdString() << "\" received" << std::endl; + DEBUG << "FileSource::responseHeaderReceived: redirect to \"" + << location << "\" received" << endl; #endif if (location != "") { QUrl newUrl(location); @@ -661,13 +661,13 @@ m_errorString = QString("%1 %2") .arg(resp.statusCode()).arg(resp.reasonPhrase()); #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::responseHeaderReceived: " - << m_errorString.toStdString() << std::endl; + DEBUG << "FileSource::responseHeaderReceived: " + << m_errorString << endl; #endif } else { #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::responseHeaderReceived: " - << m_lastStatus << std::endl; + DEBUG << "FileSource::responseHeaderReceived: " + << m_lastStatus << endl; #endif if (resp.hasContentType()) m_contentType = resp.contentType(); } @@ -687,8 +687,8 @@ if (!error) { #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::ftpCommandFinished: success for command " - << command << std::endl; + DEBUG << "FileSource::ftpCommandFinished: success for command " + << command << endl; #endif return; } @@ -776,7 +776,7 @@ FileSource::deleteCacheFile() { #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::deleteCacheFile(\"" << m_localFilename.toStdString() << "\")" << std::endl; + DEBUG << "FileSource::deleteCacheFile(\"" << m_localFilename << "\")" << endl; #endif cleanup(); @@ -813,11 +813,11 @@ if (!QFile(m_localFilename).remove()) { #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::deleteCacheFile: ERROR: Failed to delete file \"" << m_localFilename.toStdString() << "\"" << std::endl; + std::cerr << "FileSource::deleteCacheFile: ERROR: Failed to delete file \"" << m_localFilename << "\"" << std::endl; #endif } else { #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::deleteCacheFile: Deleted cache file \"" << m_localFilename.toStdString() << "\"" << std::endl; + DEBUG << "FileSource::deleteCacheFile: Deleted cache file \"" << m_localFilename << "\"" << endl; #endif m_localFilename = ""; } @@ -834,7 +834,7 @@ QMutexLocker locker(&m_mapMutex); #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::createCacheFile: refcount is " << m_refCountMap[m_url] << std::endl; + DEBUG << "FileSource::createCacheFile: refcount is " << m_refCountMap[m_url] << endl; #endif if (m_refCountMap[m_url] > 0) { @@ -881,7 +881,7 @@ QString filepath(dir.filePath(filename)); #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::createCacheFile: URL is \"" << m_url.toString().toStdString() << "\", dir is \"" << dir.path().toStdString() << "\", base \"" << base.toStdString() << "\", extension \"" << extension.toStdString() << "\", filebase \"" << filename.toStdString() << "\", filename \"" << filepath.toStdString() << "\"" << std::endl; + DEBUG << "FileSource::createCacheFile: URL is \"" << m_url.toString() << "\", dir is \"" << dir.path() << "\", base \"" << base << "\", extension \"" << extension << "\", filebase \"" << filename << "\", filename \"" << filepath << "\"" << endl; #endif QMutexLocker fcLocker(&m_fileCreationMutex); @@ -893,8 +893,8 @@ #ifdef DEBUG_FILE_SOURCE std::cerr << "FileSource::createCacheFile: Failed to create local file \"" - << filepath.toStdString() << "\" for URL \"" - << m_url.toString().toStdString() << "\" (or file already exists): appending suffix instead" << std::endl; + << filepath << "\" for URL \"" + << m_url.toString() << "\" (or file already exists): appending suffix instead" << std::endl; #endif if (extension == "") { @@ -909,8 +909,8 @@ #ifdef DEBUG_FILE_SOURCE std::cerr << "FileSource::createCacheFile: ERROR: Failed to create local file \"" - << filepath.toStdString() << "\" for URL \"" - << m_url.toString().toStdString() << "\" (or file already exists)" << std::endl; + << filepath << "\" for URL \"" + << m_url.toString() << "\" (or file already exists)" << std::endl; #endif return ""; @@ -918,9 +918,9 @@ } #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::createCacheFile: url " - << m_url.toString().toStdString() << " -> local filename " - << filepath.toStdString() << std::endl; + DEBUG << "FileSource::createCacheFile: url " + << m_url.toString() << " -> local filename " + << filepath << endl; #endif m_localFilename = filepath; diff -r be43b2fe68e8 -r 573d45e9487b data/fileio/FileSource.h --- a/data/fileio/FileSource.h Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fileio/FileSource.h Tue Jun 14 14:47:59 2011 +0100 @@ -23,6 +23,8 @@ #include +#include "base/Debug.h" + class QFtp; class QHttp; class QFile; diff -r be43b2fe68e8 -r 573d45e9487b data/fileio/MIDIFileReader.cpp --- a/data/fileio/MIDIFileReader.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fileio/MIDIFileReader.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -278,7 +278,7 @@ m_error = ""; #ifdef MIDI_DEBUG - cerr << "MIDIFileReader::open() : fileName = " << m_fileName.c_str() << endl; + DEBUG << "MIDIFileReader::open() : fileName = " << m_fileName.c_str() << endl; #endif // Open the file @@ -315,7 +315,7 @@ for (unsigned int j = 0; j < m_numberOfTracks; ++j) { #ifdef MIDI_DEBUG - cerr << "Parsing Track " << j << endl; + DEBUG << "Parsing Track " << j << endl; #endif if (!skipToNextTrack()) { @@ -350,7 +350,7 @@ } catch (MIDIException e) { - cerr << "MIDIFileReader::open() - caught exception - " << e.what() << endl; + DEBUG << "MIDIFileReader::open() - caught exception - " << e.what() << endl; m_error = e.what(); } @@ -392,14 +392,14 @@ { if (midiHeader.size() < 14) { #ifdef MIDI_DEBUG - cerr << "MIDIFileReader::parseHeader() - file header undersized" << endl; + DEBUG << "MIDIFileReader::parseHeader() - file header undersized" << endl; #endif return false; } if (midiHeader.compare(0, 4, MIDI_FILE_HEADER) != 0) { #ifdef MIDI_DEBUG - cerr << "MIDIFileReader::parseHeader()" + DEBUG << "MIDIFileReader::parseHeader()" << "- file header not found or malformed" << endl; #endif @@ -408,7 +408,7 @@ if (midiBytesToLong(midiHeader.substr(4,4)) != 6L) { #ifdef MIDI_DEBUG - cerr << "MIDIFileReader::parseHeader()" + DEBUG << "MIDIFileReader::parseHeader()" << " - header length incorrect" << endl; #endif @@ -498,7 +498,7 @@ data1 = midiByte; #ifdef MIDI_DEBUG - cerr << "using running status (byte " << int(midiByte) << " found)" << endl; + DEBUG << "using running status (byte " << int(midiByte) << " found)" << endl; #endif } else { #ifdef MIDI_DEBUG @@ -611,7 +611,7 @@ MIDI_END_OF_EXCLUSIVE) { #ifdef MIDI_DEBUG - cerr << "MIDIFileReader::parseTrack() - " + DEBUG << "MIDIFileReader::parseTrack() - " << "malformed or unsupported SysEx type" << endl; #endif @@ -631,14 +631,14 @@ case MIDI_END_OF_EXCLUSIVE: #ifdef MIDI_DEBUG - cerr << "MIDIFileReader::parseTrack() - " + DEBUG << "MIDIFileReader::parseTrack() - " << "Found a stray MIDI_END_OF_EXCLUSIVE" << endl; #endif break; default: #ifdef MIDI_DEBUG - cerr << "MIDIFileReader::parseTrack()" + DEBUG << "MIDIFileReader::parseTrack()" << " - Unsupported MIDI Event Code: " << (int)eventCode << endl; #endif @@ -787,15 +787,15 @@ double seconds = (60.0 * quarters) / tempo; /* - std::cerr << "MIDIFileReader::getTimeForMIDITime(" << midiTime << ")" - << std::endl; - std::cerr << "timing division = " << td << std::endl; + DEBUG << "MIDIFileReader::getTimeForMIDITime(" << midiTime << ")" + << endl; + DEBUG << "timing division = " << td << endl; std::cerr << "nearest tempo event (of " << m_tempoMap.size() << ") is at " << tempoMIDITime << " (" << tempoRealTime << ")" << std::endl; std::cerr << "quarters since then = " << quarters << std::endl; std::cerr << "tempo = " << tempo << " quarters per minute" << std::endl; std::cerr << "seconds since then = " << seconds << std::endl; - std::cerr << "resulting time = " << (tempoRealTime + RealTime::fromSeconds(seconds)) << std::endl; + DEBUG << "resulting time = " << (tempoRealTime + RealTime::fromSeconds(seconds)) << endl; */ return tempoRealTime + RealTime::fromSeconds(seconds); @@ -1033,7 +1033,7 @@ Note note(startFrame, (*i)->getPitch(), endFrame - startFrame, level, noteLabel); -// std::cerr << "Adding note " << startFrame << "," << (endFrame-startFrame) << " : " << int((*i)->getPitch()) << std::endl; +// DEBUG << "Adding note " << startFrame << "," << (endFrame-startFrame) << " : " << int((*i)->getPitch()) << endl; model->addPoint(note); break; diff -r be43b2fe68e8 -r 573d45e9487b data/fileio/MP3FileReader.cpp --- a/data/fileio/MP3FileReader.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fileio/MP3FileReader.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -96,7 +96,7 @@ return; } else if (sz == 0) { std::cerr << QString("MP3FileReader::MP3FileReader: Warning: reached EOF after only %1 of %2 bytes") - .arg(offset).arg(m_fileSize).toStdString() << std::endl; + .arg(offset).arg(m_fileSize) << std::endl; m_fileSize = offset; break; } @@ -141,7 +141,7 @@ } if (m_error != "") { - std::cerr << "MP3FileReader::MP3FileReader(\"" << m_path.toStdString() << "\"): ERROR: " << m_error.toStdString() << std::endl; + std::cerr << "MP3FileReader::MP3FileReader(\"" << m_path << "\"): ERROR: " << m_error << std::endl; } } @@ -177,7 +177,7 @@ id3_tag *tag = id3_file_tag(file); if (!tag) { #ifdef DEBUG_ID3TAG - std::cerr << "MP3FileReader::loadTags: No ID3 tag found" << std::endl; + DEBUG << "MP3FileReader::loadTags: No ID3 tag found" << endl; #endif id3_file_close(file); return; @@ -200,8 +200,8 @@ #else #ifdef DEBUG_ID3TAG - std::cerr << "MP3FileReader::loadTags: ID3 tag support not compiled in" - << std::endl; + DEBUG << "MP3FileReader::loadTags: ID3 tag support not compiled in" + << endl; #endif #endif } @@ -215,20 +215,20 @@ id3_frame *frame = id3_tag_findframe(tag, name, 0); if (!frame) { #ifdef DEBUG_ID3TAG - std::cerr << "MP3FileReader::loadTags: No \"" << name << "\" in ID3 tag" << std::endl; + DEBUG << "MP3FileReader::loadTags: No \"" << name << "\" in ID3 tag" << endl; #endif return ""; } if (frame->nfields < 2) { - std::cerr << "MP3FileReader::loadTags: WARNING: Not enough fields (" << frame->nfields << ") for \"" << name << "\" in ID3 tag" << std::endl; + DEBUG << "MP3FileReader::loadTags: WARNING: Not enough fields (" << frame->nfields << ") for \"" << name << "\" in ID3 tag" << endl; return ""; } unsigned int nstrings = id3_field_getnstrings(&frame->fields[1]); if (nstrings == 0) { #ifdef DEBUG_ID3TAG - std::cerr << "MP3FileReader::loadTags: No strings for \"" << name << "\" in ID3 tag" << std::endl; + DEBUG << "MP3FileReader::loadTags: No strings for \"" << name << "\" in ID3 tag" << endl; #endif return ""; } @@ -236,7 +236,7 @@ id3_ucs4_t const *ustr = id3_field_getstrings(&frame->fields[1], 0); if (!ustr) { #ifdef DEBUG_ID3TAG - std::cerr << "MP3FileReader::loadTags: Invalid or absent data for \"" << name << "\" in ID3 tag" << std::endl; + DEBUG << "MP3FileReader::loadTags: Invalid or absent data for \"" << name << "\" in ID3 tag" << endl; #endif return ""; } @@ -251,8 +251,8 @@ free(u8str); #ifdef DEBUG_ID3TAG - std::cerr << "MP3FileReader::loadTags: tag \"" << name << "\" -> \"" - << rv.toStdString() << "\"" << std::endl; + DEBUG << "MP3FileReader::loadTags: tag \"" << name << "\" -> \"" + << rv << "\"" << endl; #endif @@ -365,7 +365,7 @@ initialiseDecodeCache(); if (m_cacheMode == CacheInTemporaryFile) { -// std::cerr << "MP3FileReader::accept: channel count " << m_channelCount << ", file rate " << m_fileRate << ", about to start serialised section" << std::endl; +// DEBUG << "MP3FileReader::accept: channel count " << m_channelCount << ", file rate " << m_fileRate << ", about to start serialised section" << endl; startSerialised("MP3FileReader::Decode"); } } diff -r be43b2fe68e8 -r 573d45e9487b data/fileio/MatchFileReader.cpp --- a/data/fileio/MatchFileReader.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fileio/MatchFileReader.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -86,7 +86,7 @@ MatchFileReader::~MatchFileReader() { if (m_file) { - std::cerr << "MatchFileReader::MatchFileReader: Closing file" << std::endl; + DEBUG << "MatchFileReader::MatchFileReader: Closing file" << endl; m_file->close(); } delete m_file; diff -r be43b2fe68e8 -r 573d45e9487b data/fileio/MatchFileReader.h --- a/data/fileio/MatchFileReader.h Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fileio/MatchFileReader.h Tue Jun 14 14:47:59 2011 +0100 @@ -18,6 +18,7 @@ #include #include +#include "base/Debug.h" class QFile; class Model; diff -r be43b2fe68e8 -r 573d45e9487b data/fileio/MatrixFile.cpp --- a/data/fileio/MatrixFile.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fileio/MatrixFile.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -68,7 +68,7 @@ Profiler profiler("MatrixFile::MatrixFile", true); #ifdef DEBUG_MATRIX_FILE - std::cerr << "MatrixFile::MatrixFile(" << fileBase.toStdString() << ", " << int(mode) << ", " << cellSize << ", " << width << ", " << height << ")" << std::endl; + DEBUG << "MatrixFile::MatrixFile(" << fileBase << ", " << int(mode) << ", " << cellSize << ", " << width << ", " << height << ")" << endl; #endif m_createMutex.lock(); @@ -103,14 +103,14 @@ #endif #ifdef DEBUG_MATRIX_FILE - std::cerr << "MatrixFile(" << this << ")::MatrixFile: opening " << fileName.toStdString() << "..." << std::endl; + std::cerr << "MatrixFile(" << this << ")::MatrixFile: opening " << fileName << "..." << std::endl; #endif if ((m_fd = ::open(fileName.toLocal8Bit(), m_flags, m_fmode)) < 0) { ::perror("Open failed"); std::cerr << "ERROR: MatrixFile::MatrixFile: " << "Failed to open cache file \"" - << fileName.toStdString() << "\""; + << fileName << "\""; if (m_mode == WriteOnly) std::cerr << " for writing"; std::cerr << std::endl; throw FailedToOpenFile(fileName); @@ -130,7 +130,7 @@ ::perror("MatrixFile::MatrixFile: read failed"); std::cerr << "ERROR: MatrixFile::MatrixFile: " << "Failed to read header (fd " << m_fd << ", file \"" - << fileName.toStdString() << "\")" << std::endl; + << fileName << "\")" << std::endl; throw FileReadFailed(fileName); } if (header[0] != m_width || header[1] != m_height) { @@ -146,7 +146,7 @@ ++m_refcount[fileName]; #ifdef DEBUG_MATRIX_FILE - std::cerr << "MatrixFile[" << m_fd << "]::MatrixFile: File " << fileName.toStdString() << ", ref " << m_refcount[fileName] << std::endl; + std::cerr << "MatrixFile[" << m_fd << "]::MatrixFile: File " << fileName << ", ref " << m_refcount[fileName] << std::endl; std::cerr << "MatrixFile[" << m_fd << "]::MatrixFile: Done, size is " << "(" << m_width << ", " << m_height << ")" << std::endl; #endif @@ -173,9 +173,9 @@ if (--m_refcount[m_fileName] == 0) { if (::unlink(m_fileName.toLocal8Bit())) { - std::cerr << "WARNING: MatrixFile::~MatrixFile: reference count reached 0, but failed to unlink file \"" << m_fileName.toStdString() << "\"" << std::endl; + std::cerr << "WARNING: MatrixFile::~MatrixFile: reference count reached 0, but failed to unlink file \"" << m_fileName << "\"" << std::endl; } else { - std::cerr << "deleted " << m_fileName.toStdString() << std::endl; + std::cerr << "deleted " << m_fileName << std::endl; } } } @@ -248,7 +248,7 @@ MatrixFile::close() { #ifdef DEBUG_MATRIX_FILE - std::cerr << "MatrixFile::close()" << std::endl; + DEBUG << "MatrixFile::close()" << endl; #endif if (m_fd >= 0) { if (::close(m_fd) < 0) { diff -r be43b2fe68e8 -r 573d45e9487b data/fileio/OggVorbisFileReader.cpp --- a/data/fileio/OggVorbisFileReader.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fileio/OggVorbisFileReader.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -50,7 +50,7 @@ m_channelCount = 0; m_fileRate = 0; -// std::cerr << "OggVorbisFileReader::OggVorbisFileReader(" << m_path.toLocal8Bit().data() << "): now have " << (++instances) << " instances" << std::endl; +// DEBUG << "OggVorbisFileReader::OggVorbisFileReader(" << m_path.toLocal8Bit().data() << "): now have " << (++instances) << " instances" << endl; Profiler profiler("OggVorbisFileReader::OggVorbisFileReader", true); @@ -102,7 +102,7 @@ OggVorbisFileReader::~OggVorbisFileReader() { -// std::cerr << "OggVorbisFileReader::~OggVorbisFileReader(" << m_path.toLocal8Bit().data() << "): now have " << (--instances) << " instances" << std::endl; +// DEBUG << "OggVorbisFileReader::~OggVorbisFileReader(" << m_path.toLocal8Bit().data() << "): now have " << (--instances) << " instances" << endl; if (m_decodeThread) { m_cancelled = true; m_decodeThread->wait(); diff -r be43b2fe68e8 -r 573d45e9487b data/fileio/PlaylistFileReader.cpp --- a/data/fileio/PlaylistFileReader.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fileio/PlaylistFileReader.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -135,7 +135,7 @@ QFileInfo(testpath).isFile()) { std::cerr << "Path \"" << line.toStdString() << "\" is relative, resolving to \"" - << testpath.toStdString() << "\"" + << testpath << "\"" << std::endl; line = testpath; } diff -r be43b2fe68e8 -r 573d45e9487b data/fileio/QuickTimeFileReader.cpp --- a/data/fileio/QuickTimeFileReader.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fileio/QuickTimeFileReader.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -66,7 +66,7 @@ Profiler profiler("QuickTimeFileReader::QuickTimeFileReader", true); -std::cerr << "QuickTimeFileReader: path is \"" << m_path.toStdString() << "\"" << std::endl; +DEBUG << "QuickTimeFileReader: path is \"" << m_path << "\"" << endl; long QTversion; @@ -265,12 +265,12 @@ } } - std::cerr << "QuickTimeFileReader::QuickTimeFileReader: frame count is now " << getFrameCount() << ", error is \"\"" << m_error.toStdString() << "\"" << std::endl; + std::cerr << "QuickTimeFileReader::QuickTimeFileReader: frame count is now " << getFrameCount() << ", error is \"\"" << m_error << "\"" << std::endl; } QuickTimeFileReader::~QuickTimeFileReader() { - std::cerr << "QuickTimeFileReader::~QuickTimeFileReader" << std::endl; + DEBUG << "QuickTimeFileReader::~QuickTimeFileReader" << endl; if (m_decodeThread) { m_cancelled = true; diff -r be43b2fe68e8 -r 573d45e9487b data/fileio/ResamplingWavFileReader.cpp --- a/data/fileio/ResamplingWavFileReader.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fileio/ResamplingWavFileReader.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -39,8 +39,8 @@ m_channelCount = 0; m_fileRate = 0; - std::cerr << "ResamplingWavFileReader::ResamplingWavFileReader(\"" - << m_path.toStdString() << "\"): rate " << targetRate << std::endl; + DEBUG << "ResamplingWavFileReader::ResamplingWavFileReader(\"" + << m_path << "\"): rate " << targetRate << endl; Profiler profiler("ResamplingWavFileReader::ResamplingWavFileReader", true); diff -r be43b2fe68e8 -r 573d45e9487b data/fileio/WavFileReader.cpp --- a/data/fileio/WavFileReader.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fileio/WavFileReader.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -40,7 +40,7 @@ if (!m_file || (!fileUpdating && m_fileInfo.channels <= 0)) { std::cerr << "WavFileReader::initialize: Failed to open file at \"" - << m_path.toStdString() << "\" (" + << m_path << "\" (" << sf_strerror(m_file) << ")" << std::endl; if (m_file) { @@ -80,12 +80,12 @@ sf_close(m_file); m_file = sf_open(m_path.toLocal8Bit(), SFM_READ, &m_fileInfo); if (!m_file || m_fileInfo.channels <= 0) { - std::cerr << "WavFileReader::updateFrameCount: Failed to open file at \"" << m_path.toStdString() << "\" (" + std::cerr << "WavFileReader::updateFrameCount: Failed to open file at \"" << m_path << "\" (" << sf_strerror(m_file) << ")" << std::endl; } } -// std::cerr << "WavFileReader::updateFrameCount: now " << m_fileInfo.frames << std::endl; +// DEBUG << "WavFileReader::updateFrameCount: now " << m_fileInfo.frames << endl; m_frameCount = m_fileInfo.frames; @@ -122,8 +122,8 @@ } if ((long)start >= m_fileInfo.frames) { -// std::cerr << "WavFileReader::getInterleavedFrames: " << start -// << " > " << m_fileInfo.frames << std::endl; +// DEBUG << "WavFileReader::getInterleavedFrames: " << start +// << " > " << m_fileInfo.frames << endl; return; } diff -r be43b2fe68e8 -r 573d45e9487b data/fileio/WavFileWriter.cpp --- a/data/fileio/WavFileWriter.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/fileio/WavFileWriter.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -98,9 +98,9 @@ MultiSelection *selection) { if (source->getChannelCount() != m_channels) { - std::cerr << "WavFileWriter::writeModel: Wrong number of channels (" + DEBUG << "WavFileWriter::writeModel: Wrong number of channels (" << source->getChannelCount() << " != " << m_channels << ")" - << std::endl; + << endl; m_error = QString("Failed to write model to audio file '%1'") .arg(getWriteFilename()); return false; diff -r be43b2fe68e8 -r 573d45e9487b data/midi/MIDIEvent.h --- a/data/midi/MIDIEvent.h Tue Jun 14 13:43:03 2011 +0100 +++ b/data/midi/MIDIEvent.h Tue Jun 14 14:47:59 2011 +0100 @@ -25,6 +25,7 @@ #include #include #include +#include "base/Debug.h" typedef unsigned char MIDIByte; diff -r be43b2fe68e8 -r 573d45e9487b data/midi/MIDIInput.cpp --- a/data/midi/MIDIInput.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/midi/MIDIInput.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -50,7 +50,7 @@ void MIDIInput::callback(double timestamp, std::vector *message) { - std::cerr << "MIDIInput::callback(" << timestamp << ")" << std::endl; + DEBUG << "MIDIInput::callback(" << timestamp << ")" << endl; // In my experience so far, the timings passed to this function // are not reliable enough to use. We request instead an audio // frame time from whatever FrameTimer we have been given, and use @@ -84,7 +84,7 @@ return; } std::cerr << "WARNING: MIDIInput::postEvent: MIDI event queue (capacity " << m_buffer.getSize() << " is full!" << std::endl; - std::cerr << "Waiting for something to be processed" << std::endl; + DEBUG << "Waiting for something to be processed" << endl; #ifdef _WIN32 Sleep(1); #else diff -r be43b2fe68e8 -r 573d45e9487b data/midi/rtmidi/RtMidi.cpp --- a/data/midi/rtmidi/RtMidi.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/midi/rtmidi/RtMidi.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -761,12 +761,12 @@ case SND_SEQ_EVENT_PORT_UNSUBSCRIBED: #if defined(__RTMIDI_DEBUG__) - std::cerr << "RtMidiIn::alsaMidiHandler: port connection has closed!\n"; + DEBUG << "RtMidiIn::alsaMidiHandler: port connection has closed!\n"; // FIXME: this is called for all unsubscribe events, even ones //not related to this particular connection. As it stands, I //see no data provided in the "source" and "dest" fields so //there is nothing we can do about this at this time. - // std::cout << "sender = " << ev->source.client << ", dest = " << ev->dest.port << std::endl; + // std::cout << "sender = " << ev->source.client << ", dest = " << ev->dest.port << endl; #endif //data->doInput = false; break; diff -r be43b2fe68e8 -r 573d45e9487b data/model/AggregateWaveModel.cpp --- a/data/model/AggregateWaveModel.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/model/AggregateWaveModel.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -29,7 +29,7 @@ i != channelSpecs.end(); ++i) { if (i->model->getSampleRate() != channelSpecs.begin()->model->getSampleRate()) { - std::cerr << "AggregateWaveModel::AggregateWaveModel: WARNING: Component models do not all have the same sample rate" << std::endl; + DEBUG << "AggregateWaveModel::AggregateWaveModel: WARNING: Component models do not all have the same sample rate" << endl; break; } } diff -r be43b2fe68e8 -r 573d45e9487b data/model/AlignmentModel.cpp --- a/data/model/AlignmentModel.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/model/AlignmentModel.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -141,7 +141,7 @@ AlignmentModel::toReference(size_t frame) const { #ifdef DEBUG_ALIGNMENT_MODEL - std::cerr << "AlignmentModel::toReference(" << frame << ")" << std::endl; + DEBUG << "AlignmentModel::toReference(" << frame << ")" << endl; #endif if (!m_path) { if (!m_rawPath) return frame; @@ -154,7 +154,7 @@ AlignmentModel::fromReference(size_t frame) const { #ifdef DEBUG_ALIGNMENT_MODEL - std::cerr << "AlignmentModel::fromReference(" << frame << ")" << std::endl; + DEBUG << "AlignmentModel::fromReference(" << frame << ")" << endl; #endif if (!m_reversePath) { if (!m_rawPath) return frame; @@ -194,8 +194,8 @@ m_rawPath->isReady(&completion); #ifdef DEBUG_ALIGNMENT_MODEL - std::cerr << "AlignmentModel::pathCompletionChanged: completion = " - << completion << std::endl; + DEBUG << "AlignmentModel::pathCompletionChanged: completion = " + << completion << endl; #endif m_pathComplete = (completion == 100); @@ -242,7 +242,7 @@ } #ifdef DEBUG_ALIGNMENT_MODEL - std::cerr << "AlignmentModel::constructPath: " << m_path->getPointCount() << " points, at least " << (2 * m_path->getPointCount() * (3 * sizeof(void *) + sizeof(int) + sizeof(PathPoint))) << " bytes" << std::endl; + DEBUG << "AlignmentModel::constructPath: " << m_path->getPointCount() << " points, at least " << (2 * m_path->getPointCount() * (3 * sizeof(void *) + sizeof(int) + sizeof(PathPoint))) << " bytes" << endl; #endif } @@ -273,7 +273,7 @@ } #ifdef DEBUG_ALIGNMENT_MODEL - std::cerr << "AlignmentModel::constructReversePath: " << m_reversePath->getPointCount() << " points, at least " << (2 * m_reversePath->getPointCount() * (3 * sizeof(void *) + sizeof(int) + sizeof(PathPoint))) << " bytes" << std::endl; + DEBUG << "AlignmentModel::constructReversePath: " << m_reversePath->getPointCount() << " points, at least " << (2 * m_reversePath->getPointCount() * (3 * sizeof(void *) + sizeof(int) + sizeof(PathPoint))) << " bytes" << endl; #endif } @@ -291,13 +291,13 @@ if (points.empty()) { #ifdef DEBUG_ALIGNMENT_MODEL - std::cerr << "AlignmentModel::align: No points" << std::endl; + DEBUG << "AlignmentModel::align: No points" << endl; #endif return frame; } #ifdef DEBUG_ALIGNMENT_MODEL - std::cerr << "AlignmentModel::align: frame " << frame << " requested" << std::endl; + DEBUG << "AlignmentModel::align: frame " << frame << " requested" << endl; #endif PathModel::Point point(frame); @@ -340,7 +340,7 @@ } #ifdef DEBUG_ALIGNMENT_MODEL - std::cerr << "AlignmentModel::align: resultFrame = " << resultFrame << std::endl; + DEBUG << "AlignmentModel::align: resultFrame = " << resultFrame << endl; #endif return resultFrame; @@ -353,12 +353,12 @@ delete m_path; m_path = path; #ifdef DEBUG_ALIGNMENT_MODEL - std::cerr << "AlignmentModel::setPath: path = " << m_path << std::endl; + DEBUG << "AlignmentModel::setPath: path = " << m_path << endl; #endif constructReversePath(); #ifdef DEBUG_ALIGNMENT_MODEL - std::cerr << "AlignmentModel::setPath: after construction path = " - << m_path << ", rpath = " << m_reversePath << std::endl; + DEBUG << "AlignmentModel::setPath: after construction path = " + << m_path << ", rpath = " << m_reversePath << endl; #endif } @@ -368,7 +368,7 @@ QString extraAttributes) const { if (!m_path) { - std::cerr << "AlignmentModel::toXml: no path" << std::endl; + DEBUG << "AlignmentModel::toXml: no path" << endl; return; } diff -r be43b2fe68e8 -r 573d45e9487b data/model/EditableDenseThreeDimensionalModel.cpp --- a/data/model/EditableDenseThreeDimensionalModel.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/model/EditableDenseThreeDimensionalModel.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -492,7 +492,7 @@ // For historical reasons we read and write "resolution" as "windowSize" - std::cerr << "EditableDenseThreeDimensionalModel::toXml" << std::endl; + DEBUG << "EditableDenseThreeDimensionalModel::toXml" << endl; Model::toXml (out, indent, diff -r be43b2fe68e8 -r 573d45e9487b data/model/Model.cpp --- a/data/model/Model.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/model/Model.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -24,12 +24,12 @@ Model::~Model() { -// std::cerr << "Model::~Model(" << this << ")" << std::endl; +// DEBUG << "Model::~Model(" << this << ")" << endl; if (!m_aboutToDelete) { - std::cerr << "NOTE: Model::~Model(" << this << ", \"" - << objectName().toStdString() << "\"): Model deleted " - << "with no aboutToDelete notification" << std::endl; + DEBUG << "NOTE: Model::~Model(" << this << ", \"" + << objectName() << "\"): Model deleted " + << "with no aboutToDelete notification" << endl; } if (m_alignment) { @@ -63,7 +63,7 @@ if (m_aboutToDelete) { std::cerr << "WARNING: Model(" << this << ", \"" - << objectName().toStdString() << "\")::aboutToDelete: " + << objectName() << "\")::aboutToDelete: " << "aboutToDelete called more than once for the same model" << std::endl; } @@ -134,7 +134,7 @@ int Model::getAlignmentCompletion() const { -// std::cerr << "Model::getAlignmentCompletion" << std::endl; +// DEBUG << "Model::getAlignmentCompletion" << endl; if (!m_alignment) { if (m_sourceModel) return m_sourceModel->getAlignmentCompletion(); else return 100; diff -r be43b2fe68e8 -r 573d45e9487b data/model/ModelDataTableModel.cpp --- a/data/model/ModelDataTableModel.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/model/ModelDataTableModel.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -195,8 +195,8 @@ void ModelDataTableModel::sort(int column, Qt::SortOrder sortOrder) { -// std::cerr << "ModelDataTableModel::sort(" << column << ", " << sortOrder -// << ")" << std::endl; +// DEBUG << "ModelDataTableModel::sort(" << column << ", " << sortOrder +// << ")" << endl; int prevCurrent = getCurrentRow(); if (m_sortColumn != column) { clearSort(); @@ -362,7 +362,7 @@ } for (MapType::iterator i = rowMap.begin(); i != rowMap.end(); ++i) { -// std::cerr << "resortAlphabetical: " << i->second << ": " << i->first.toStdString() << std::endl; +// std::cerr << "resortAlphabetical: " << i->second << ": " << i->first << std::endl; m_rsort.push_back(i->second); } diff -r be43b2fe68e8 -r 573d45e9487b data/model/PowerOfSqrtTwoZoomConstraint.cpp --- a/data/model/PowerOfSqrtTwoZoomConstraint.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/model/PowerOfSqrtTwoZoomConstraint.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -51,7 +51,7 @@ else if (dir == RoundDown) rval = size_t(prevVal + 0.01); else if (val - blockSize < blockSize - prevVal) rval = size_t(val + 0.01); else rval = size_t(prevVal + 0.01); -// std::cerr << "returning " << rval << std::endl; +// DEBUG << "returning " << rval << endl; return rval; } @@ -74,7 +74,7 @@ << (power - minCachePower)); } -// std::cerr << "Testing base " << base << std::endl; +// DEBUG << "Testing base " << base << endl; if (base == blockSize) { result = base; diff -r be43b2fe68e8 -r 573d45e9487b data/model/WaveFileModel.cpp --- a/data/model/WaveFileModel.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/model/WaveFileModel.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -53,8 +53,8 @@ m_reader = AudioFileReaderFactory::createThreadingReader (m_source, targetRate); if (m_reader) { - std::cerr << "WaveFileModel::WaveFileModel: reader rate: " - << m_reader->getSampleRate() << std::endl; + DEBUG << "WaveFileModel::WaveFileModel: reader rate: " + << m_reader->getSampleRate() << endl; } } if (m_reader) setObjectName(m_reader->getTitle()); @@ -115,7 +115,7 @@ prevCompletion = *completion; } #ifdef DEBUG_WAVE_FILE_MODEL - std::cerr << "WaveFileModel::isReady(): ready = " << ready << ", completion = " << (completion ? *completion : -1) << std::endl; + DEBUG << "WaveFileModel::isReady(): ready = " << ready << ", completion = " << (completion ? *completion : -1) << endl; #endif return ready; } @@ -210,8 +210,8 @@ } #ifdef DEBUG_WAVE_FILE_MODEL -// std::cerr << "WaveFileModel::getValues(" << channel << ", " -// << start << ", " << end << "): calling reader" << std::endl; +// DEBUG << "WaveFileModel::getValues(" << channel << ", " +// << start << ", " << end << "): calling reader" << endl; #endif int channels = getChannelCount(); @@ -534,7 +534,7 @@ } #ifdef DEBUG_WAVE_FILE_MODEL - cerr << "returning " << ranges.size() << " ranges" << endl; + DEBUG << "returning " << ranges.size() << " ranges" << endl; #endif return; } @@ -607,7 +607,7 @@ m_fillThread->start(); #ifdef DEBUG_WAVE_FILE_MODEL - std::cerr << "WaveFileModel::fillCache: started fill thread" << std::endl; + DEBUG << "WaveFileModel::fillCache: started fill thread" << endl; #endif } @@ -617,7 +617,7 @@ if (m_fillThread) { size_t fillExtent = m_fillThread->getFillExtent(); #ifdef DEBUG_WAVE_FILE_MODEL - cerr << "WaveFileModel::fillTimerTimedOut: extent = " << fillExtent << endl; + DEBUG << "WaveFileModel::fillTimerTimedOut: extent = " << fillExtent << endl; #endif if (fillExtent > m_lastFillExtent) { emit modelChanged(m_lastFillExtent, fillExtent); @@ -625,7 +625,7 @@ } } else { #ifdef DEBUG_WAVE_FILE_MODEL - cerr << "WaveFileModel::fillTimerTimedOut: no thread" << std::endl; + DEBUG << "WaveFileModel::fillTimerTimedOut: no thread" << endl; #endif emit modelChanged(); } @@ -646,7 +646,7 @@ emit modelChanged(); emit ready(); #ifdef DEBUG_WAVE_FILE_MODEL - cerr << "WaveFileModel::cacheFilled" << endl; + DEBUG << "WaveFileModel::cacheFilled" << endl; #endif } @@ -669,7 +669,7 @@ if (updating) { while (channels == 0 && !m_model.m_exiting) { -// std::cerr << "WaveFileModel::fill: Waiting for channels..." << std::endl; +// DEBUG << "WaveFileModel::fill: Waiting for channels..." << endl; sleep(1); channels = m_model.getChannelCount(); } @@ -690,11 +690,11 @@ updating = m_model.m_reader->isUpdating(); m_frameCount = m_model.getFrameCount(); -// std::cerr << "WaveFileModel::fill: frame = " << frame << ", count = " << m_frameCount << std::endl; +// DEBUG << "WaveFileModel::fill: frame = " << frame << ", count = " << m_frameCount << endl; while (frame < m_frameCount) { -// std::cerr << "WaveFileModel::fill inner loop: frame = " << frame << ", count = " << m_frameCount << ", blocksize " << readBlockSize << std::endl; +// DEBUG << "WaveFileModel::fill inner loop: frame = " << frame << ", count = " << m_frameCount << ", blocksize " << readBlockSize << endl; if (updating && (frame + readBlockSize > m_frameCount)) break; diff -r be43b2fe68e8 -r 573d45e9487b data/model/WritableWaveFileModel.cpp --- a/data/model/WritableWaveFileModel.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/model/WritableWaveFileModel.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -57,7 +57,7 @@ m_writer = new WavFileWriter(path, sampleRate, channels, WavFileWriter::WriteToTarget); if (!m_writer->isOK()) { - std::cerr << "WritableWaveFileModel: Error in creating WAV file writer: " << m_writer->getError().toStdString() << std::endl; + std::cerr << "WritableWaveFileModel: Error in creating WAV file writer: " << m_writer->getError() << std::endl; delete m_writer; m_writer = 0; return; @@ -109,11 +109,11 @@ if (!m_writer) return false; #ifdef DEBUG_WRITABLE_WAVE_FILE_MODEL -// std::cerr << "WritableWaveFileModel::addSamples(" << count << ")" << std::endl; +// DEBUG << "WritableWaveFileModel::addSamples(" << count << ")" << endl; #endif if (!m_writer->writeSamples(samples, count)) { - std::cerr << "ERROR: WritableWaveFileModel::addSamples: writer failed: " << m_writer->getError().toStdString() << std::endl; + std::cerr << "ERROR: WritableWaveFileModel::addSamples: writer failed: " << m_writer->getError() << std::endl; return false; } @@ -123,12 +123,12 @@ if (m_reader && m_reader->getChannelCount() == 0) { #ifdef DEBUG_WRITABLE_WAVE_FILE_MODEL - std::cerr << "WritableWaveFileModel::addSamples(" << count << "): calling updateFrameCount (initial)" << std::endl; + DEBUG << "WritableWaveFileModel::addSamples(" << count << "): calling updateFrameCount (initial)" << endl; #endif m_reader->updateFrameCount(); } else if (++updateCounter == 100) { #ifdef DEBUG_WRITABLE_WAVE_FILE_MODEL - std::cerr << "WritableWaveFileModel::addSamples(" << count << "): calling updateFrameCount (periodic)" << std::endl; + DEBUG << "WritableWaveFileModel::addSamples(" << count << "): calling updateFrameCount (periodic)" << endl; #endif if (m_reader) m_reader->updateFrameCount(); updateCounter = 0; @@ -141,7 +141,7 @@ WritableWaveFileModel::isOK() const { bool ok = (m_writer && m_writer->isOK()); -// std::cerr << "WritableWaveFileModel::isOK(): ok = " << ok << std::endl; +// DEBUG << "WritableWaveFileModel::isOK(): ok = " << ok << endl; return ok; } @@ -164,7 +164,7 @@ size_t WritableWaveFileModel::getFrameCount() const { -// std::cerr << "WritableWaveFileModel::getFrameCount: count = " << m_frameCount << std::endl; +// DEBUG << "WritableWaveFileModel::getFrameCount: count = " << m_frameCount << endl; return m_frameCount; } diff -r be43b2fe68e8 -r 573d45e9487b data/osc/OSCMessage.h --- a/data/osc/OSCMessage.h Tue Jun 14 13:43:03 2011 +0100 +++ b/data/osc/OSCMessage.h Tue Jun 14 14:47:59 2011 +0100 @@ -27,6 +27,8 @@ #include #include +#include "base/Debug.h" + class OSCMessage { public: diff -r be43b2fe68e8 -r 573d45e9487b data/osc/OSCQueue.cpp --- a/data/osc/OSCQueue.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/data/osc/OSCQueue.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -167,7 +167,7 @@ return; } std::cerr << "WARNING: OSCQueue::postMessage: OSC message queue (capacity " << m_buffer.getSize() << " is full!" << std::endl; - std::cerr << "Waiting for something to be processed" << std::endl; + DEBUG << "Waiting for something to be processed" << endl; #ifdef _WIN32 Sleep(1); #else @@ -178,9 +178,9 @@ OSCMessage *mp = new OSCMessage(message); m_buffer.write(&mp, 1); - std::cerr << "OSCQueue::postMessage: Posted OSC message: target " + DEBUG << "OSCQueue::postMessage: Posted OSC message: target " << message.getTarget() << ", target data " << message.getTargetData() - << ", method " << message.getMethod().toStdString() << std::endl; + << ", method " << message.getMethod() << endl; emit messagesAvailable(); } @@ -213,14 +213,13 @@ if (method.contains('/')) { std::cerr << "ERROR: OSCQueue::parseOSCPath: malformed path \"" - << path.toStdString() << "\" (should be target/data/method or " + << path << "\" (should be target/data/method or " << "target/method or method, where target and data " << "are numeric)" << std::endl; return false; } - std::cerr << "OSCQueue::parseOSCPath: good path \"" << path.toStdString() - << "\"" << std::endl; + DEBUG << "OSCQueue::parseOSCPath: good path \"" << path << "\"" << endl; return true; } diff -r be43b2fe68e8 -r 573d45e9487b plugin/DSSIPluginFactory.cpp --- a/plugin/DSSIPluginFactory.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/plugin/DSSIPluginFactory.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -69,7 +69,7 @@ const LADSPA_Descriptor *descriptor = ddesc->LADSPA_Plugin; if (!descriptor) continue; -// std::cerr << "DSSIPluginFactory::enumeratePlugins: Name " << (descriptor->Name ? descriptor->Name : "NONE" ) << std::endl; +// DEBUG << "DSSIPluginFactory::enumeratePlugins: Name " << (descriptor->Name ? descriptor->Name : "NONE" ) << endl; list.push_back(*i); list.push_back(descriptor->Name); @@ -159,7 +159,7 @@ if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { loadLibrary(soname); if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { - std::cerr << "WARNING: DSSIPluginFactory::getDSSIDescriptor: loadLibrary failed for " << soname.toStdString() << std::endl; + std::cerr << "WARNING: DSSIPluginFactory::getDSSIDescriptor: loadLibrary failed for " << soname << std::endl; return 0; } firstInLibrary = true; @@ -171,7 +171,7 @@ DLSYM(libraryHandle, "dssi_descriptor"); if (!fn) { - std::cerr << "WARNING: DSSIPluginFactory::getDSSIDescriptor: No descriptor function in library " << soname.toStdString() << std::endl; + std::cerr << "WARNING: DSSIPluginFactory::getDSSIDescriptor: No descriptor function in library " << soname << std::endl; return 0; } @@ -188,7 +188,7 @@ ++index; } - std::cerr << "WARNING: DSSIPluginFactory::getDSSIDescriptor: No such plugin as " << label.toStdString() << " in library " << soname.toStdString() << std::endl; + std::cerr << "WARNING: DSSIPluginFactory::getDSSIDescriptor: No such plugin as " << label << " in library " << soname << std::endl; return 0; } @@ -292,7 +292,7 @@ if (!libraryHandle) { std::cerr << "WARNING: DSSIPluginFactory::discoverPlugins: couldn't load plugin library " - << soname.toStdString() << " - " << DLERROR() << std::endl; + << soname << " - " << DLERROR() << std::endl; return; } @@ -300,7 +300,7 @@ DLSYM(libraryHandle, "dssi_descriptor"); if (!fn) { - std::cerr << "WARNING: DSSIPluginFactory::discoverPlugins: No descriptor function in " << soname.toStdString() << std::endl; + std::cerr << "WARNING: DSSIPluginFactory::discoverPlugins: No descriptor function in " << soname << std::endl; return; } @@ -311,7 +311,7 @@ const LADSPA_Descriptor *ladspaDescriptor = descriptor->LADSPA_Plugin; if (!ladspaDescriptor) { - std::cerr << "WARNING: DSSIPluginFactory::discoverPlugins: No LADSPA descriptor for plugin " << index << " in " << soname.toStdString() << std::endl; + std::cerr << "WARNING: DSSIPluginFactory::discoverPlugins: No LADSPA descriptor for plugin " << index << " in " << soname << std::endl; ++index; continue; } diff -r be43b2fe68e8 -r 573d45e9487b plugin/DSSIPluginInstance.cpp --- a/plugin/DSSIPluginInstance.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/plugin/DSSIPluginInstance.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -77,8 +77,8 @@ m_haveLastEventSendTime(false) { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::DSSIPluginInstance(" << identifier << ")" - << std::endl; + DEBUG << "DSSIPluginInstance::DSSIPluginInstance(" << identifier << ")" + << endl; #endif init(); @@ -177,7 +177,7 @@ DSSIPluginInstance::getParameter(std::string id) const { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::getParameter(" << id << ")" << std::endl; + DEBUG << "DSSIPluginInstance::getParameter(" << id << ")" << endl; #endif for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { if (id == m_descriptor->LADSPA_Plugin->PortNames[m_controlPortsIn[i].first]) { @@ -186,7 +186,7 @@ #endif float v = getParameterValue(i); #ifdef DEBUG_DSSI - std::cerr << "Returning " << v << std::endl; + DEBUG << "Returning " << v << endl; #endif return v; } @@ -199,7 +199,7 @@ DSSIPluginInstance::setParameter(std::string id, float value) { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::setParameter(" << id << ", " << value << ")" << std::endl; + DEBUG << "DSSIPluginInstance::setParameter(" << id << ", " << value << ")" << endl; #endif for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { @@ -214,7 +214,7 @@ DSSIPluginInstance::init() { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::init" << std::endl; + DEBUG << "DSSIPluginInstance::init" << endl; #endif // Discover ports numbers and identities @@ -258,8 +258,8 @@ } #ifdef DEBUG_DSSI else - std::cerr << "DSSIPluginInstance::DSSIPluginInstance - " - << "unrecognised port type" << std::endl; + DEBUG << "DSSIPluginInstance::DSSIPluginInstance - " + << "unrecognised port type" << endl; #endif } @@ -272,7 +272,7 @@ size_t latency = 0; #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::getLatency(): m_latencyPort " << m_latencyPort << ", m_run " << m_run << std::endl; + DEBUG << "DSSIPluginInstance::getLatency(): m_latencyPort " << m_latencyPort << ", m_run " << m_run << endl; #endif if (m_latencyPort) { @@ -288,7 +288,7 @@ } #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::getLatency(): latency is " << latency << std::endl; + DEBUG << "DSSIPluginInstance::getLatency(): latency is " << latency << endl; #endif return latency; @@ -313,8 +313,8 @@ DSSIPluginInstance::setIdealChannelCount(size_t channels) { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::setIdealChannelCount: channel count " - << channels << " (was " << m_idealChannelCount << ")" << std::endl; + DEBUG << "DSSIPluginInstance::setIdealChannelCount: channel count " + << channels << " (was " << m_idealChannelCount << ")" << endl; #endif if (channels == m_idealChannelCount) { @@ -401,7 +401,7 @@ DSSIPluginInstance::~DSSIPluginInstance() { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::~DSSIPluginInstance" << std::endl; + DEBUG << "DSSIPluginInstance::~DSSIPluginInstance" << endl; #endif if (m_threads.find(m_instanceHandle) != m_threads.end()) { @@ -502,7 +502,7 @@ m_cachedPrograms.clear(); #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::checkProgramCache" << std::endl; + DEBUG << "DSSIPluginInstance::checkProgramCache" << endl; #endif if (!m_descriptor || !m_descriptor->get_program) { @@ -522,7 +522,7 @@ } #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::checkProgramCache: have " << m_cachedPrograms.size() << " programs" << std::endl; + DEBUG << "DSSIPluginInstance::checkProgramCache: have " << m_cachedPrograms.size() << " programs" << endl; #endif m_programCacheValid = true; @@ -532,7 +532,7 @@ DSSIPluginInstance::getPrograms() const { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::getPrograms" << std::endl; + DEBUG << "DSSIPluginInstance::getPrograms" << endl; #endif if (!m_descriptor) return ProgramList(); @@ -553,7 +553,7 @@ DSSIPluginInstance::getProgram(int bank, int program) const { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::getProgram(" << bank << "," << program << ")" << std::endl; + DEBUG << "DSSIPluginInstance::getProgram(" << bank << "," << program << ")" << endl; #endif if (!m_descriptor) return std::string(); @@ -572,7 +572,7 @@ DSSIPluginInstance::getProgram(std::string name) const { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::getProgram(" << name << ")" << std::endl; + DEBUG << "DSSIPluginInstance::getProgram(" << name << ")" << endl; #endif if (!m_descriptor) return 0; @@ -609,7 +609,7 @@ DSSIPluginInstance::selectProgramAux(std::string program, bool backupPortValues) { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::selectProgram(" << program << ")" << std::endl; + DEBUG << "DSSIPluginInstance::selectProgram(" << program << ")" << endl; #endif if (!m_descriptor) return; @@ -631,7 +631,7 @@ found = true; #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::selectProgram(" << program << "): found at bank " << bankNo << ", program " << programNo << std::endl; + DEBUG << "DSSIPluginInstance::selectProgram(" << program << "): found at bank " << bankNo << ", program " << programNo << endl; #endif break; @@ -647,7 +647,7 @@ m_processLock.unlock(); #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::selectProgram(" << program << "): made select_program(" << bankNo << "," << programNo << ") call" << std::endl; + DEBUG << "DSSIPluginInstance::selectProgram(" << program << "): made select_program(" << bankNo << "," << programNo << ") call" << endl; #endif if (backupPortValues) { @@ -661,7 +661,7 @@ DSSIPluginInstance::activate() { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::activate" << std::endl; + DEBUG << "DSSIPluginInstance::activate" << endl; #endif if (!m_descriptor || !m_descriptor->LADSPA_Plugin->activate) return; @@ -669,14 +669,14 @@ if (m_program != "") { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::activate: restoring program " << m_program << std::endl; + DEBUG << "DSSIPluginInstance::activate: restoring program " << m_program << endl; #endif selectProgramAux(m_program, false); } for (size_t i = 0; i < m_backupControlPortsIn.size(); ++i) { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::activate: setting port " << m_controlPortsIn[i].first << " to " << m_backupControlPortsIn[i] << std::endl; + DEBUG << "DSSIPluginInstance::activate: setting port " << m_controlPortsIn[i].first << " to " << m_backupControlPortsIn[i] << endl; #endif *m_controlPortsIn[i].second = m_backupControlPortsIn[i]; } @@ -687,9 +687,9 @@ { if (!m_descriptor || !m_descriptor->LADSPA_Plugin->connect_port) return; #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::connectPorts: " << m_audioPortsIn.size() + DEBUG << "DSSIPluginInstance::connectPorts: " << m_audioPortsIn.size() << " audio ports in, " << m_audioPortsOut.size() << " out, " - << m_outputBufferCount << " output buffers" << std::endl; + << m_outputBufferCount << " output buffers" << endl; #endif assert(sizeof(LADSPA_Data) == sizeof(float)); @@ -726,7 +726,7 @@ *m_controlPortsIn[i].second = defaultValue; m_backupControlPortsIn[i] = defaultValue; #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::connectPorts: set control port " << i << " to default value " << defaultValue << std::endl; + DEBUG << "DSSIPluginInstance::connectPorts: set control port " << i << " to default value " << defaultValue << endl; #endif } } @@ -749,7 +749,7 @@ DSSIPluginInstance::setParameterValue(unsigned int parameter, float value) { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::setParameterValue(" << parameter << ") to " << value << std::endl; + DEBUG << "DSSIPluginInstance::setParameterValue(" << parameter << ") to " << value << endl; #endif if (parameter >= m_controlPortsIn.size()) return; @@ -773,7 +773,7 @@ DSSIPluginInstance::setPortValueFromController(unsigned int port, int cv) { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::setPortValueFromController(" << port << ") to " << cv << std::endl; + DEBUG << "DSSIPluginInstance::setPortValueFromController(" << port << ") to " << cv << endl; #endif const LADSPA_Descriptor *p = m_descriptor->LADSPA_Plugin; @@ -819,7 +819,7 @@ DSSIPluginInstance::getParameterValue(unsigned int parameter) const { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::getParameterValue(" << parameter << ")" << std::endl; + DEBUG << "DSSIPluginInstance::getParameterValue(" << parameter << ")" << endl; #endif if (parameter >= m_controlPortsIn.size()) return 0.0; return (*m_controlPortsIn[parameter].second); @@ -869,7 +869,7 @@ #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::configure(" << key << "," << value << ")" << std::endl; + DEBUG << "DSSIPluginInstance::configure(" << key << "," << value << ")" << endl; #endif char *message = m_descriptor->configure(m_instanceHandle, @@ -908,7 +908,7 @@ const void *e) { #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::sendEvent: last was " << m_lastEventSendTime << " (valid " << m_haveLastEventSendTime << "), this is " << eventTime << std::endl; + DEBUG << "DSSIPluginInstance::sendEvent: last was " << m_lastEventSendTime << " (valid " << m_haveLastEventSendTime << "), this is " << eventTime << endl; #endif // The process mechanism only works correctly if the events are @@ -926,7 +926,7 @@ snd_seq_event_t *event = (snd_seq_event_t *)e; #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::sendEvent at " << eventTime << std::endl; + DEBUG << "DSSIPluginInstance::sendEvent at " << eventTime << endl; #endif snd_seq_event_t ev(*event); @@ -955,7 +955,7 @@ int controller = ev->data.control.param; #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::handleController " << controller << std::endl; + DEBUG << "DSSIPluginInstance::handleController " << controller << endl; #endif if (controller == 0) { // bank select MSB @@ -1020,13 +1020,13 @@ } #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::run(" << blockTime << ")" << std::endl; + DEBUG << "DSSIPluginInstance::run(" << blockTime << ")" << endl; #endif #ifdef DEBUG_DSSI_PROCESS if (m_eventBuffer.getReadSpace() > 0) { - std::cerr << "DSSIPluginInstance::run: event buffer has " - << m_eventBuffer.getReadSpace() << " event(s) in it" << std::endl; + DEBUG << "DSSIPluginInstance::run: event buffer has " + << m_eventBuffer.getReadSpace() << " event(s) in it" << endl; } #endif @@ -1044,8 +1044,8 @@ } #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::run: evTime " << evTime << ", blockTime " << blockTime << ", frameOffset " << frameOffset - << ", blockSize " << m_blockSize << std::endl; + DEBUG << "DSSIPluginInstance::run: evTime " << evTime << ", blockTime " << blockTime << ", frameOffset " << frameOffset + << ", blockSize " << m_blockSize << endl; std::cerr << "Type: " << int(ev->type) << ", pitch: " << int(ev->data.note.note) << ", velocity: " << int(ev->data.note.velocity) << std::endl; #endif @@ -1079,20 +1079,20 @@ int bank = m_pending.lsb + 128 * m_pending.msb; #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::run: making select_program(" << bank << "," << program << ") call" << std::endl; + DEBUG << "DSSIPluginInstance::run: making select_program(" << bank << "," << program << ") call" << endl; #endif m_pending.lsb = m_pending.msb = m_pending.program = -1; m_descriptor->select_program(m_instanceHandle, bank, program); #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::run: made select_program(" << bank << "," << program << ") call" << std::endl; + DEBUG << "DSSIPluginInstance::run: made select_program(" << bank << "," << program << ") call" << endl; #endif } #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::run: running with " << evCount << " events" - << std::endl; + DEBUG << "DSSIPluginInstance::run: running with " << evCount << " events" + << endl; #endif m_descriptor->run_synth(m_instanceHandle, count, @@ -1153,7 +1153,7 @@ PluginSet &s = m_groupMap[m_identifier]; #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::runGrouped(" << blockTime << "): this is " << this << "; " << s.size() << " elements in m_groupMap[" << m_identifier << "]" << std::endl; + DEBUG << "DSSIPluginInstance::runGrouped(" << blockTime << "): this is " << this << "; " << s.size() << " elements in m_groupMap[" << m_identifier << "]" << endl; #endif if (m_lastRunTime != blockTime) { @@ -1161,7 +1161,7 @@ DSSIPluginInstance *instance = *i; if (instance != this && instance->m_lastRunTime == blockTime) { #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::runGrouped(" << blockTime << "): plugin " << instance << " has already been run" << std::endl; + DEBUG << "DSSIPluginInstance::runGrouped(" << blockTime << "): plugin " << instance << " has already been run" << endl; #endif needRun = false; } @@ -1170,13 +1170,13 @@ if (!needRun) { #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::runGrouped(" << blockTime << "): already run, returning" << std::endl; + DEBUG << "DSSIPluginInstance::runGrouped(" << blockTime << "): already run, returning" << endl; #endif return; } #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::runGrouped(" << blockTime << "): I'm the first, running" << std::endl; + DEBUG << "DSSIPluginInstance::runGrouped(" << blockTime << "): I'm the first, running" << endl; #endif size_t index = 0; @@ -1194,7 +1194,7 @@ instances[index] = instance->m_instanceHandle; #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::runGrouped(" << blockTime << "): running " << instance << std::endl; + DEBUG << "DSSIPluginInstance::runGrouped(" << blockTime << "): running " << instance << endl; #endif if (instance->m_pending.program >= 0 && @@ -1220,8 +1220,8 @@ } #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::runGrouped: evTime " << evTime << ", frameOffset " << frameOffset - << ", block size " << m_blockSize << std::endl; + DEBUG << "DSSIPluginInstance::runGrouped: evTime " << evTime << ", frameOffset " << frameOffset + << ", block size " << m_blockSize << endl; #endif if (frameOffset >= int(m_blockSize)) break; @@ -1259,7 +1259,7 @@ { // This is called from a non-RT context (during instantiate) - std::cerr << "DSSIPluginInstance::requestMidiSend" << std::endl; + DEBUG << "DSSIPluginInstance::requestMidiSend" << endl; return 1; } @@ -1270,7 +1270,7 @@ { // This is likely to be called from an RT context - std::cerr << "DSSIPluginInstance::midiSend" << std::endl; + DEBUG << "DSSIPluginInstance::midiSend" << endl; } void @@ -1296,7 +1296,7 @@ DSSIPluginInstance::deactivate() { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::deactivate " << m_identifier << std::endl; + DEBUG << "DSSIPluginInstance::deactivate " << m_identifier << endl; #endif if (!m_descriptor || !m_descriptor->LADSPA_Plugin->deactivate) return; @@ -1306,7 +1306,7 @@ m_descriptor->LADSPA_Plugin->deactivate(m_instanceHandle); #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::deactivate " << m_identifier << " done" << std::endl; + DEBUG << "DSSIPluginInstance::deactivate " << m_identifier << " done" << endl; #endif m_bufferScavenger.scavenge(); @@ -1316,7 +1316,7 @@ DSSIPluginInstance::cleanup() { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::cleanup " << m_identifier << std::endl; + DEBUG << "DSSIPluginInstance::cleanup " << m_identifier << endl; #endif if (!m_descriptor) return; @@ -1331,7 +1331,7 @@ m_descriptor->LADSPA_Plugin->cleanup(m_instanceHandle); m_instanceHandle = 0; #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::cleanup " << m_identifier << " done" << std::endl; + DEBUG << "DSSIPluginInstance::cleanup " << m_identifier << " done" << endl; #endif } diff -r be43b2fe68e8 -r 573d45e9487b plugin/FeatureExtractionPluginFactory.cpp --- a/plugin/FeatureExtractionPluginFactory.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/plugin/FeatureExtractionPluginFactory.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -58,8 +58,7 @@ { if (pluginType == "vamp") { if (!_nativeInstance) { -// std::cerr << "FeatureExtractionPluginFactory::instance(" << pluginType.toStdString() -// << "): creating new FeatureExtractionPluginFactory" << std::endl; +// DEBUG << "FeatureExtractionPluginFactory::instance(" << pluginType// << "): creating new FeatureExtractionPluginFactory" << endl; _nativeInstance = new FeatureExtractionPluginFactory(); } return _nativeInstance; @@ -96,7 +95,7 @@ if (factory) { std::vector tmp = factory->getPluginIdentifiers(); for (size_t i = 0; i < tmp.size(); ++i) { -// std::cerr << "identifier: " << tmp[i].toStdString() << std::endl; +// std::cerr << "identifier: " << tmp[i] << std::endl; rv.push_back(tmp[i]); } } @@ -118,7 +117,7 @@ for (std::vector::iterator i = path.begin(); i != path.end(); ++i) { #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE - std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: scanning directory " << i->toStdString() << std::endl; + DEBUG << "FeatureExtractionPluginFactory::getPluginIdentifiers: scanning directory " << i-<< endl; #endif QDir pluginDir(*i, PLUGIN_GLOB, @@ -130,33 +129,33 @@ QString soname = pluginDir.filePath(pluginDir[j]); #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE - std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: trying potential library " << soname.toStdString() << std::endl; + DEBUG << "FeatureExtractionPluginFactory::getPluginIdentifiers: trying potential library " << soname << endl; #endif void *libraryHandle = DLOPEN(soname, RTLD_LAZY | RTLD_LOCAL); if (!libraryHandle) { - std::cerr << "WARNING: FeatureExtractionPluginFactory::getPluginIdentifiers: Failed to load library " << soname.toStdString() << ": " << DLERROR() << std::endl; + std::cerr << "WARNING: FeatureExtractionPluginFactory::getPluginIdentifiers: Failed to load library " << soname << ": " << DLERROR() << std::endl; continue; } #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE - std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: It's a library all right, checking for descriptor" << std::endl; + DEBUG << "FeatureExtractionPluginFactory::getPluginIdentifiers: It's a library all right, checking for descriptor" << endl; #endif VampGetPluginDescriptorFunction fn = (VampGetPluginDescriptorFunction) DLSYM(libraryHandle, "vampGetPluginDescriptor"); if (!fn) { - std::cerr << "WARNING: FeatureExtractionPluginFactory::getPluginIdentifiers: No descriptor function in " << soname.toStdString() << std::endl; + std::cerr << "WARNING: FeatureExtractionPluginFactory::getPluginIdentifiers: No descriptor function in " << soname << std::endl; if (DLCLOSE(libraryHandle) != 0) { - std::cerr << "WARNING: FeatureExtractionPluginFactory::getPluginIdentifiers: Failed to unload library " << soname.toStdString() << std::endl; + std::cerr << "WARNING: FeatureExtractionPluginFactory::getPluginIdentifiers: Failed to unload library " << soname << std::endl; } continue; } #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE - std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: Vamp descriptor found" << std::endl; + DEBUG << "FeatureExtractionPluginFactory::getPluginIdentifiers: Vamp descriptor found" << endl; #endif const VampPluginDescriptor *descriptor = 0; @@ -174,7 +173,7 @@ << descriptor->identifier << "\" at indices " << known[descriptor->identifier] << " and " << index << std::endl; - std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: Avoiding this library (obsolete API?)" << std::endl; + DEBUG << "FeatureExtractionPluginFactory::getPluginIdentifiers: Avoiding this library (obsolete API?)" << endl; ok = false; break; } else { @@ -194,14 +193,14 @@ ("vamp", soname, descriptor->identifier); rv.push_back(id); #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE - std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: Found plugin id " << id.toStdString() << " at index " << index << std::endl; + DEBUG << "FeatureExtractionPluginFactory::getPluginIdentifiers: Found plugin id " << id << " at index " << index << endl; #endif ++index; } } if (DLCLOSE(libraryHandle) != 0) { - std::cerr << "WARNING: FeatureExtractionPluginFactory::getPluginIdentifiers: Failed to unload library " << soname.toStdString() << std::endl; + std::cerr << "WARNING: FeatureExtractionPluginFactory::getPluginIdentifiers: Failed to unload library " << soname << std::endl; } } } @@ -217,9 +216,9 @@ QString file = ""; #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE - std::cerr << "FeatureExtractionPluginFactory::findPluginFile(\"" - << soname.toStdString() << "\", \"" << inDir.toStdString() << "\")" - << std::endl; + DEBUG << "FeatureExtractionPluginFactory::findPluginFile(\"" + << soname << "\", \"" << inDir << "\")" + << endl; #endif if (inDir != "") { @@ -234,8 +233,8 @@ if (QFileInfo(file).exists() && QFileInfo(file).isFile()) { #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE - std::cerr << "FeatureExtractionPluginFactory::findPluginFile: " - << "found trivially at " << file.toStdString() << std::endl; + DEBUG << "FeatureExtractionPluginFactory::findPluginFile: " + << "found trivially at " << file << endl; #endif return file; @@ -246,8 +245,8 @@ if (QFileInfo(file).baseName() == QFileInfo(soname).baseName()) { #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE - std::cerr << "FeatureExtractionPluginFactory::findPluginFile: " - << "found \"" << soname.toStdString() << "\" at " << file.toStdString() << std::endl; + DEBUG << "FeatureExtractionPluginFactory::findPluginFile: " + << "found \"" << soname << "\" at " << file << endl; #endif return file; @@ -255,8 +254,8 @@ } #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE - std::cerr << "FeatureExtractionPluginFactory::findPluginFile (with dir): " - << "not found" << std::endl; + DEBUG << "FeatureExtractionPluginFactory::findPluginFile (with dir): " + << "not found" << endl; #endif return ""; @@ -267,8 +266,8 @@ if (fi.isAbsolute() && fi.exists() && fi.isFile()) { #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE - std::cerr << "FeatureExtractionPluginFactory::findPluginFile: " - << "found trivially at " << soname.toStdString() << std::endl; + DEBUG << "FeatureExtractionPluginFactory::findPluginFile: " + << "found trivially at " << soname << endl; #endif return soname; } @@ -288,8 +287,8 @@ } #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE - std::cerr << "FeatureExtractionPluginFactory::findPluginFile: " - << "not found" << std::endl; + DEBUG << "FeatureExtractionPluginFactory::findPluginFile: " + << "not found" << endl; #endif return ""; @@ -311,20 +310,20 @@ QString type, soname, label; PluginIdentifier::parseIdentifier(identifier, type, soname, label); if (type != "vamp") { - std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Wrong factory for plugin type " << type.toStdString() << std::endl; + DEBUG << "FeatureExtractionPluginFactory::instantiatePlugin: Wrong factory for plugin type " << type << endl; return 0; } QString found = findPluginFile(soname); if (found == "") { - std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Failed to find library file " << soname.toStdString() << std::endl; + std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Failed to find library file " << soname << std::endl; return 0; } else if (found != soname) { #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE - std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Given library name was " << soname.toStdString() << ", found at " << found.toStdString() << std::endl; - std::cerr << soname.toStdString() << " -> " << found.toStdString() << std::endl; + DEBUG << "FeatureExtractionPluginFactory::instantiatePlugin: Given library name was " << soname << ", found at " << found << endl; + std::cerr << soname << " -> " << found << std::endl; #endif } @@ -334,7 +333,7 @@ void *libraryHandle = DLOPEN(soname, RTLD_LAZY | RTLD_LOCAL); if (!libraryHandle) { - std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Failed to load library " << soname.toStdString() << ": " << DLERROR() << std::endl; + std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Failed to load library " << soname << ": " << DLERROR() << std::endl; return 0; } @@ -342,7 +341,7 @@ DLSYM(libraryHandle, "vampGetPluginDescriptor"); if (!fn) { - std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: No descriptor function in " << soname.toStdString() << std::endl; + DEBUG << "FeatureExtractionPluginFactory::instantiatePlugin: No descriptor function in " << soname << endl; goto done; } @@ -352,7 +351,7 @@ } if (!descriptor) { - std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Failed to find plugin \"" << label.toStdString() << "\" in library " << soname.toStdString() << std::endl; + std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Failed to find plugin \"" << label << "\" in library " << soname << std::endl; goto done; } @@ -363,18 +362,18 @@ rv = new PluginDeletionNotifyAdapter(plugin, this); } -// std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Constructed Vamp plugin, rv is " << rv << std::endl; +// DEBUG << "FeatureExtractionPluginFactory::instantiatePlugin: Constructed Vamp plugin, rv is " << rv << endl; //!!! need to dlclose() when plugins from a given library are unloaded done: if (!rv) { if (DLCLOSE(libraryHandle) != 0) { - std::cerr << "WARNING: FeatureExtractionPluginFactory::instantiatePlugin: Failed to unload library " << soname.toStdString() << std::endl; + std::cerr << "WARNING: FeatureExtractionPluginFactory::instantiatePlugin: Failed to unload library " << soname << std::endl; } } -// std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Instantiated plugin " << label.toStdString() << " from library " << soname.toStdString() << ": descriptor " << descriptor << ", rv "<< rv << ", label " << rv->getName() << ", outputs " << rv->getOutputDescriptors().size() << std::endl; +// DEBUG << "FeatureExtractionPluginFactory::instantiatePlugin: Instantiated plugin " << label << " from library " << soname << ": descriptor " << descriptor << ", rv "<< rv << ", label " << rv->getName() << ", outputs " << rv->getOutputDescriptors().size() << endl; return rv; } @@ -384,7 +383,7 @@ { void *handle = m_handleMap[plugin]; if (handle) { -// std::cerr << "unloading library " << handle << " for plugin " << plugin << std::endl; +// DEBUG << "unloading library " << handle << " for plugin " << plugin << endl; DLCLOSE(handle); } m_handleMap.erase(plugin); @@ -416,12 +415,12 @@ QDir dir(path[i], "*.cat"); -// std::cerr << "LADSPAPluginFactory::generateFallbackCategories: directory " << path[i].toStdString() << " has " << dir.count() << " .cat files" << std::endl; +// DEBUG << "LADSPAPluginFactory::generateFallbackCategories: directory " << path[i] << " has " << dir.count() << " .cat files" << endl; for (unsigned int j = 0; j < dir.count(); ++j) { QFile file(path[i] + "/" + dir[j]); -// std::cerr << "LADSPAPluginFactory::generateFallbackCategories: about to open " << (path[i].toStdString() + "/" + dir[j].toStdString()) << std::endl; +// DEBUG << "LADSPAPluginFactory::generateFallbackCategories: about to open " << (path[i]+ "/" + dir[j]) << endl; if (file.open(QIODevice::ReadOnly)) { // std::cerr << "...opened" << std::endl; @@ -430,12 +429,12 @@ while (!stream.atEnd()) { line = stream.readLine(); -// std::cerr << "line is: \"" << line.toStdString() << "\"" << std::endl; +// std::cerr << "line is: \"" << line << "\"" << std::endl; QString id = PluginIdentifier::canonicalise (line.section("::", 0, 0)); QString cat = line.section("::", 1, 1); m_taxonomy[id] = cat; -// std::cerr << "FeatureExtractionPluginFactory: set id \"" << id.toStdString() << "\" to cat \"" << cat.toStdString() << "\"" << std::endl; +// std::cerr << "FeatureExtractionPluginFactory: set id \"" << id << "\" to cat \"" << cat << "\"" << std::endl; } } } diff -r be43b2fe68e8 -r 573d45e9487b plugin/FeatureExtractionPluginFactory.h --- a/plugin/FeatureExtractionPluginFactory.h Tue Jun 14 13:43:03 2011 +0100 +++ b/plugin/FeatureExtractionPluginFactory.h Tue Jun 14 14:47:59 2011 +0100 @@ -22,6 +22,8 @@ #include +#include "base/Debug.h" + class FeatureExtractionPluginFactory { public: diff -r be43b2fe68e8 -r 573d45e9487b plugin/LADSPAPluginFactory.cpp --- a/plugin/LADSPAPluginFactory.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/plugin/LADSPAPluginFactory.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -227,7 +227,7 @@ else logmax = log10f(maximum); } -// std::cerr << "LADSPAPluginFactory::getPortDefault: hint = " << d << std::endl; +// DEBUG << "LADSPAPluginFactory::getPortDefault: hint = " << d << endl; if (!LADSPA_IS_HINT_HAS_DEFAULT(d)) { @@ -349,8 +349,8 @@ m_instances.insert(instance); #ifdef DEBUG_LADSPA_PLUGIN_FACTORY - std::cerr << "LADSPAPluginFactory::instantiatePlugin(" - << identifier.toStdString() << ": now have " << m_instances.size() << " instances" << std::endl; + DEBUG << "LADSPAPluginFactory::instantiatePlugin(" + << identifier << ": now have " << m_instances.size() << " instances" << endl; #endif return instance; @@ -384,7 +384,7 @@ PluginIdentifier::parseIdentifier((*ii)->getPluginIdentifier(), itype, isoname, ilabel); if (isoname == soname) { #ifdef DEBUG_LADSPA_PLUGIN_FACTORY - std::cerr << "LADSPAPluginFactory::releasePlugin: dll " << soname.toStdString() << " is still in use for plugin " << ilabel.toStdString() << std::endl; + DEBUG << "LADSPAPluginFactory::releasePlugin: dll " << soname << " is still in use for plugin " << ilabel << endl; #endif stillInUse = true; break; @@ -394,15 +394,15 @@ if (!stillInUse) { if (soname != PluginIdentifier::BUILTIN_PLUGIN_SONAME) { #ifdef DEBUG_LADSPA_PLUGIN_FACTORY - std::cerr << "LADSPAPluginFactory::releasePlugin: dll " << soname.toStdString() << " no longer in use, unloading" << std::endl; + DEBUG << "LADSPAPluginFactory::releasePlugin: dll " << soname << " no longer in use, unloading" << endl; #endif unloadLibrary(soname); } } #ifdef DEBUG_LADSPA_PLUGIN_FACTORY - std::cerr << "LADSPAPluginFactory::releasePlugin(" - << identifier.toStdString() << ": now have " << m_instances.size() << " instances" << std::endl; + DEBUG << "LADSPAPluginFactory::releasePlugin(" + << identifier << ": now have " << m_instances.size() << " instances" << endl; #endif } @@ -415,7 +415,7 @@ if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { loadLibrary(soname); if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { - std::cerr << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: loadLibrary failed for " << soname.toStdString() << std::endl; + std::cerr << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: loadLibrary failed for " << soname << std::endl; return 0; } } @@ -426,7 +426,7 @@ DLSYM(libraryHandle, "ladspa_descriptor"); if (!fn) { - std::cerr << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: No descriptor function in library " << soname.toStdString() << std::endl; + std::cerr << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: No descriptor function in library " << soname << std::endl; return 0; } @@ -438,7 +438,7 @@ ++index; } - std::cerr << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: No such plugin as " << label.toStdString() << " in library " << soname.toStdString() << std::endl; + std::cerr << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: No such plugin as " << label << " in library " << soname << std::endl; return 0; } @@ -449,13 +449,13 @@ void *libraryHandle = DLOPEN(soName, RTLD_NOW); if (libraryHandle) { m_libraryHandles[soName] = libraryHandle; - std::cerr << "LADSPAPluginFactory::loadLibrary: Loaded library \"" << soName.toStdString() << "\"" << std::endl; + DEBUG << "LADSPAPluginFactory::loadLibrary: Loaded library \"" << soName << "\"" << endl; return; } if (QFileInfo(soName).exists()) { DLERROR(); - std::cerr << "LADSPAPluginFactory::loadLibrary: Library \"" << soName.toStdString() << "\" exists, but failed to load it" << std::endl; + std::cerr << "LADSPAPluginFactory::loadLibrary: Library \"" << soName << "\" exists, but failed to load it" << std::endl; return; } @@ -468,7 +468,7 @@ i != pathList.end(); ++i) { #ifdef DEBUG_LADSPA_PLUGIN_FACTORY - std::cerr << "Looking at: " << (*i).toStdString() << std::endl; + DEBUG << "Looking at: " << (*i) << endl; #endif QDir dir(*i, PLUGIN_GLOB, @@ -477,7 +477,7 @@ if (QFileInfo(dir.filePath(fileName)).exists()) { #ifdef DEBUG_LADSPA_PLUGIN_FACTORY - std::cerr << "Loading: " << fileName.toStdString() << std::endl; + std::cerr << "Loading: " << fileName << std::endl; #endif libraryHandle = DLOPEN(dir.filePath(fileName), RTLD_NOW); if (libraryHandle) { @@ -490,7 +490,7 @@ QString file = dir.filePath(dir[j]); if (QFileInfo(file).baseName() == base) { #ifdef DEBUG_LADSPA_PLUGIN_FACTORY - std::cerr << "Loading: " << file.toStdString() << std::endl; + std::cerr << "Loading: " << file << std::endl; #endif libraryHandle = DLOPEN(file, RTLD_NOW); if (libraryHandle) { @@ -501,7 +501,7 @@ } } - std::cerr << "LADSPAPluginFactory::loadLibrary: Failed to locate plugin library \"" << soName.toStdString() << "\"" << std::endl; + std::cerr << "LADSPAPluginFactory::loadLibrary: Failed to locate plugin library \"" << soName << "\"" << std::endl; } void @@ -509,7 +509,7 @@ { LibraryHandleMap::iterator li = m_libraryHandles.find(soName); if (li != m_libraryHandles.end()) { -// std::cerr << "unloading " << soname.toStdString() << std::endl; +// DEBUG << "unloading " << soname << endl; DLCLOSE(m_libraryHandles[soName]); m_libraryHandles.erase(li); } @@ -633,13 +633,13 @@ std::vector pathList = getPluginPath(); -// std::cerr << "LADSPAPluginFactory::discoverPlugins - " +// DEBUG << "LADSPAPluginFactory::discoverPlugins - " // << "discovering plugins; path is "; // for (std::vector::iterator i = pathList.begin(); // i != pathList.end(); ++i) { -// std::cerr << "[" << i->toStdString() << "] "; +// DEBUG << "[" << i-<< "] "; // } -// std::cerr << std::endl; +// DEBUG << endl; #ifdef HAVE_LRDF // read the description files @@ -684,7 +684,7 @@ if (!libraryHandle) { std::cerr << "WARNING: LADSPAPluginFactory::discoverPlugins: couldn't load plugin library " - << soname.toStdString() << " - " << DLERROR() << std::endl; + << soname << " - " << DLERROR() << std::endl; return; } @@ -692,7 +692,7 @@ DLSYM(libraryHandle, "ladspa_descriptor"); if (!fn) { - std::cerr << "WARNING: LADSPAPluginFactory::discoverPlugins: No descriptor function in " << soname.toStdString() << std::endl; + std::cerr << "WARNING: LADSPAPluginFactory::discoverPlugins: No descriptor function in " << soname << std::endl; return; } @@ -722,8 +722,8 @@ if (m_lrdfTaxonomy[descriptor->UniqueID] != "") { m_taxonomy[identifier] = m_lrdfTaxonomy[descriptor->UniqueID]; -// std::cerr << "set id \"" << identifier.toStdString() << "\" to cat \"" << m_taxonomy[identifier].toStdString() << "\" from LRDF" << std::endl; -// std::cout << identifier.toStdString() << "::" << m_taxonomy[identifier].toStdString() << std::endl; +// std::cerr << "set id \"" << identifier << "\" to cat \"" << m_taxonomy[identifier] << "\" from LRDF" << std::endl; +// std::cout << identifier << "::" << m_taxonomy[identifier] << std::endl; } QString category = m_taxonomy[identifier]; @@ -818,22 +818,22 @@ path.push_back(p); p.replace("/lib/", "/share/"); path.push_back(p); -// std::cerr << "LADSPAPluginFactory::generateFallbackCategories: path element " << p.toStdString() << std::endl; +// DEBUG << "LADSPAPluginFactory::generateFallbackCategories: path element " << p << endl; } path.push_back(pluginPath[i]); -// std::cerr << "LADSPAPluginFactory::generateFallbackCategories: path element " << pluginPath[i].toStdString() << std::endl; +// DEBUG << "LADSPAPluginFactory::generateFallbackCategories: path element " << pluginPath[i] << endl; } for (size_t i = 0; i < path.size(); ++i) { QDir dir(path[i], "*.cat"); -// std::cerr << "LADSPAPluginFactory::generateFallbackCategories: directory " << path[i].toStdString() << " has " << dir.count() << " .cat files" << std::endl; +// DEBUG << "LADSPAPluginFactory::generateFallbackCategories: directory " << path[i] << " has " << dir.count() << " .cat files" << endl; for (unsigned int j = 0; j < dir.count(); ++j) { QFile file(path[i] + "/" + dir[j]); -// std::cerr << "LADSPAPluginFactory::generateFallbackCategories: about to open " << (path[i].toStdString() + "/" + dir[j].toStdString()) << std::endl; +// DEBUG << "LADSPAPluginFactory::generateFallbackCategories: about to open " << (path[i]+ "/" + dir[j]) << endl; if (file.open(QIODevice::ReadOnly)) { // std::cerr << "...opened" << std::endl; @@ -842,12 +842,12 @@ while (!stream.atEnd()) { line = stream.readLine(); -// std::cerr << "line is: \"" << line.toStdString() << "\"" << std::endl; +// std::cerr << "line is: \"" << line << "\"" << std::endl; QString id = PluginIdentifier::canonicalise (line.section("::", 0, 0)); QString cat = line.section("::", 1, 1); m_taxonomy[id] = cat; -// std::cerr << "set id \"" << id.toStdString() << "\" to cat \"" << cat.toStdString() << "\"" << std::endl; +// std::cerr << "set id \"" << id << "\" to cat \"" << cat << "\"" << std::endl; } } } diff -r be43b2fe68e8 -r 573d45e9487b plugin/LADSPAPluginInstance.cpp --- a/plugin/LADSPAPluginInstance.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/plugin/LADSPAPluginInstance.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -207,8 +207,8 @@ for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { if (id == m_descriptor->PortNames[m_controlPortsIn[i].first]) { #ifdef DEBUG_LADSPA - std::cerr << "LADSPAPluginInstance::setParameter: Found id " - << id << " at control port " << i << std::endl; + DEBUG << "LADSPAPluginInstance::setParameter: Found id " + << id << " at control port " << i << endl; #endif setParameterValue(i, value); break; @@ -220,8 +220,8 @@ LADSPAPluginInstance::init(int idealChannelCount) { #ifdef DEBUG_LADSPA - std::cerr << "LADSPAPluginInstance::init(" << idealChannelCount << "): plugin has " - << m_descriptor->PortCount << " ports" << std::endl; + DEBUG << "LADSPAPluginInstance::init(" << idealChannelCount << "): plugin has " + << m_descriptor->PortCount << " ports" << endl; #endif // Discover ports numbers and identities @@ -232,12 +232,12 @@ if (LADSPA_IS_PORT_INPUT(m_descriptor->PortDescriptors[i])) { #ifdef DEBUG_LADSPA - std::cerr << "LADSPAPluginInstance::init: port " << i << " is audio in" << std::endl; + DEBUG << "LADSPAPluginInstance::init: port " << i << " is audio in" << endl; #endif m_audioPortsIn.push_back(i); } else { #ifdef DEBUG_LADSPA - std::cerr << "LADSPAPluginInstance::init: port " << i << " is audio out" << std::endl; + DEBUG << "LADSPAPluginInstance::init: port " << i << " is audio out" << endl; #endif m_audioPortsOut.push_back(i); } @@ -247,7 +247,7 @@ if (LADSPA_IS_PORT_INPUT(m_descriptor->PortDescriptors[i])) { #ifdef DEBUG_LADSPA - std::cerr << "LADSPAPluginInstance::init: port " << i << " is control in" << std::endl; + DEBUG << "LADSPAPluginInstance::init: port " << i << " is control in" << endl; #endif LADSPA_Data *data = new LADSPA_Data(0.0); m_controlPortsIn.push_back( @@ -256,7 +256,7 @@ } else { #ifdef DEBUG_LADSPA - std::cerr << "LADSPAPluginInstance::init: port " << i << " is control out" << std::endl; + DEBUG << "LADSPAPluginInstance::init: port " << i << " is control out" << endl; #endif LADSPA_Data *data = new LADSPA_Data(0.0); m_controlPortsOut.push_back( @@ -273,8 +273,8 @@ } #ifdef DEBUG_LADSPA else - std::cerr << "LADSPAPluginInstance::init - " - << "unrecognised port type" << std::endl; + DEBUG << "LADSPAPluginInstance::init - " + << "unrecognised port type" << endl; #endif } @@ -341,7 +341,7 @@ LADSPAPluginInstance::~LADSPAPluginInstance() { #ifdef DEBUG_LADSPA - std::cerr << "LADSPAPluginInstance::~LADSPAPluginInstance" << std::endl; + DEBUG << "LADSPAPluginInstance::~LADSPAPluginInstance" << endl; #endif if (m_instanceHandles.size() != 0) { // "isOK()" diff -r be43b2fe68e8 -r 573d45e9487b plugin/PluginXml.cpp --- a/plugin/PluginXml.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/plugin/PluginXml.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -81,9 +81,9 @@ for (Vamp::PluginBase::ParameterList::const_iterator i = parameters.begin(); i != parameters.end(); ++i) { -// std::cerr << "PluginXml::toXml: parameter name \"" +// DEBUG << "PluginXml::toXml: parameter name \"" // << i->name.c_str() << "\" has value " -// << m_plugin->getParameter(i->name) << std::endl; +// << m_plugin->getParameter(i->name) << endl; stream << QString("param-%1=\"%2\" ") .arg(stripInvalidParameterNameCharacters(QString(i->identifier.c_str()))) @@ -119,7 +119,7 @@ if (ATTRIBUTE != "" && ATTRIBUTE != ACCESSOR().c_str()) { \ std::cerr << "WARNING: PluginXml::setParameters: Plugin " \ << #ATTRIBUTE << " does not match (attributes have \"" \ - << ATTRIBUTE.toStdString() << "\", my " \ + << ATTRIBUTE << "\", my " \ << #ATTRIBUTE << " is \"" << ACCESSOR() << "\")" << std::endl; \ } @@ -174,18 +174,18 @@ (QString(i->identifier.c_str()))); if (attrs.value(pname) == "") { -// std::cerr << "PluginXml::setParameters: no parameter \"" << i->name << "\" (attribute \"" << name.toStdString() << "\")" << std::endl; +// DEBUG << "PluginXml::setParameters: no parameter \"" << i->name << "\" (attribute \"" << name << "\")" << endl; continue; } bool ok; float value = attrs.value(pname).trimmed().toFloat(&ok); if (ok) { -// std::cerr << "PluginXml::setParameters: setting parameter \"" -// << i->identifier << "\" to value " << value << std::endl; +// DEBUG << "PluginXml::setParameters: setting parameter \"" +// << i->identifier << "\" to value " << value << endl; m_plugin->setParameter(i->identifier, value); } else { - std::cerr << "WARNING: PluginXml::setParameters: Invalid value \"" << attrs.value(pname).toStdString() << "\" for parameter \"" << i->identifier << "\" (attribute \"" << pname.toStdString() << "\")" << std::endl; + std::cerr << "WARNING: PluginXml::setParameters: Invalid value \"" << attrs.value(pname) << "\" for parameter \"" << i->identifier << "\" (attribute \"" << pname << "\")" << std::endl; } } } @@ -199,13 +199,13 @@ int errorLine; int errorColumn; -// std::cerr << "PluginXml::setParametersFromXml: XML is \"" -// << xml.toLocal8Bit().data() << "\"" << std::endl; +// DEBUG << "PluginXml::setParametersFromXml: XML is \"" +// << xml.toLocal8Bit().data() << "\"" << endl; if (!doc.setContent(xml, false, &error, &errorLine, &errorColumn)) { - std::cerr << "PluginXml::setParametersFromXml: Error in parsing XML: " << error.toStdString() << " at line " << errorLine << ", column " << errorColumn << std::endl; + std::cerr << "PluginXml::setParametersFromXml: Error in parsing XML: " << error << " at line " << errorLine << ", column " << errorColumn << std::endl; std::cerr << "Input follows:" << std::endl; - std::cerr << xml.toStdString() << std::endl; + std::cerr << xml << std::endl; std::cerr << "Input ends." << std::endl; return; } @@ -217,8 +217,7 @@ for (unsigned int i = 0; i < attrNodes.length(); ++i) { QDomAttr attr = attrNodes.item(i).toAttr(); if (attr.isNull()) continue; -// std::cerr << "PluginXml::setParametersFromXml: Adding attribute \"" << attr.name().toStdString() -// << "\" with value \"" << attr.value().toStdString() << "\"" << std::endl; +// DEBUG << "PluginXml::setParametersFromXml: Adding attribute \"" << attr.name()// << "\" with value \"" << attr.value() << "\"" << endl; attrs.append(attr.name(), "", "", attr.value()); } diff -r be43b2fe68e8 -r 573d45e9487b plugin/RealTimePluginFactory.cpp --- a/plugin/RealTimePluginFactory.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/plugin/RealTimePluginFactory.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -44,16 +44,14 @@ { if (pluginType == "ladspa") { if (!_ladspaInstance) { -// std::cerr << "RealTimePluginFactory::instance(" << pluginType.toStdString() -// << "): creating new LADSPAPluginFactory" << std::endl; +// DEBUG << "RealTimePluginFactory::instance(" << pluginType// << "): creating new LADSPAPluginFactory" << endl; _ladspaInstance = new LADSPAPluginFactory(); _ladspaInstance->discoverPlugins(); } return _ladspaInstance; } else if (pluginType == "dssi") { if (!_dssiInstance) { -// std::cerr << "RealTimePluginFactory::instance(" << pluginType.toStdString() -// << "): creating new DSSIPluginFactory" << std::endl; +// DEBUG << "RealTimePluginFactory::instance(" << pluginType// << "): creating new DSSIPluginFactory" << endl; _dssiInstance = new DSSIPluginFactory(); _dssiInstance->discoverPlugins(); } diff -r be43b2fe68e8 -r 573d45e9487b plugin/RealTimePluginFactory.h --- a/plugin/RealTimePluginFactory.h Tue Jun 14 13:43:03 2011 +0100 +++ b/plugin/RealTimePluginFactory.h Tue Jun 14 14:47:59 2011 +0100 @@ -25,6 +25,8 @@ #include #include +#include "base/Debug.h" + class RealTimePluginInstance; class RealTimePluginDescriptor diff -r be43b2fe68e8 -r 573d45e9487b plugin/RealTimePluginInstance.cpp --- a/plugin/RealTimePluginInstance.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/plugin/RealTimePluginInstance.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -28,10 +28,10 @@ RealTimePluginInstance::~RealTimePluginInstance() { -// std::cerr << "RealTimePluginInstance::~RealTimePluginInstance" << std::endl; +// DEBUG << "RealTimePluginInstance::~RealTimePluginInstance" << endl; if (m_factory) { -// std::cerr << "Asking factory to release " << m_identifier.toStdString() << std::endl; +// DEBUG << "Asking factory to release " << m_identifier << endl; m_factory->releasePlugin(this, m_identifier); } diff -r be43b2fe68e8 -r 573d45e9487b plugin/plugins/SamplePlayer.cpp --- a/plugin/plugins/SamplePlayer.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/plugin/plugins/SamplePlayer.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -152,14 +152,14 @@ SamplePlayer::instantiate(const LADSPA_Descriptor *, unsigned long rate) { if (!hostDescriptor || !hostDescriptor->request_non_rt_thread) { - std::cerr << "SamplePlayer::instantiate: Host does not provide request_non_rt_thread, not instantiating" << std::endl; + DEBUG << "SamplePlayer::instantiate: Host does not provide request_non_rt_thread, not instantiating" << endl; return 0; } SamplePlayer *player = new SamplePlayer(rate); if (hostDescriptor->request_non_rt_thread(player, workThreadCallback)) { - std::cerr << "SamplePlayer::instantiate: Host rejected request_non_rt_thread call, not instantiating" << std::endl; + DEBUG << "SamplePlayer::instantiate: Host rejected request_non_rt_thread call, not instantiating" << endl; delete player; return 0; } @@ -321,7 +321,7 @@ if (player->m_pendingProgramChange >= 0) { #ifdef DEBUG_SAMPLE_PLAYER - std::cerr << "SamplePlayer::workThreadCallback: pending program change " << player->m_pendingProgramChange << std::endl; + DEBUG << "SamplePlayer::workThreadCallback: pending program change " << player->m_pendingProgramChange << endl; #endif player->m_mutex.lock(); @@ -364,8 +364,8 @@ m_samples.clear(); #ifdef DEBUG_SAMPLE_PLAYER - std::cerr << "SamplePlayer::searchSamples: Directory is \"" - << m_sampleDir.toLocal8Bit().data() << "\"" << std::endl; + DEBUG << "SamplePlayer::searchSamples: Directory is \"" + << m_sampleDir.toLocal8Bit().data() << "\"" << endl; #endif QDir dir(m_sampleDir, "*.wav"); diff -r be43b2fe68e8 -r 573d45e9487b rdf/PluginRDFDescription.cpp --- a/rdf/PluginRDFDescription.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/rdf/PluginRDFDescription.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -34,7 +34,7 @@ m_pluginUri = indexer->getURIForPluginId(pluginId); if (m_pluginUri == "") { cerr << "PluginRDFDescription: WARNING: No RDF description available for plugin ID \"" - << pluginId.toStdString() << "\"" << endl; + << pluginId << "\"" << endl; } else { // All the data we need should be in our RDF model already: // if it's not there, we don't know where to find it anyway @@ -299,14 +299,14 @@ if (!query.isOK()) { cerr << "ERROR: PluginRDFDescription::index: ERROR: Failed to query outputs for <" - << m_pluginUri.toStdString() << ">: " - << query.getErrorString().toStdString() << endl; + << m_pluginUri << ">: " + << query.getErrorString() << endl; return false; } if (results.empty()) { - cerr << "ERROR: PluginRDFDescription::indexURL: NOTE: No outputs defined for <" - << m_pluginUri.toStdString() << ">" << endl; + DEBUG << "ERROR: PluginRDFDescription::indexURL: NOTE: No outputs defined for <" + << m_pluginUri << ">" << endl; return false; } diff -r be43b2fe68e8 -r 573d45e9487b rdf/PluginRDFDescription.h --- a/rdf/PluginRDFDescription.h Tue Jun 14 13:43:03 2011 +0100 +++ b/rdf/PluginRDFDescription.h Tue Jun 14 14:47:59 2011 +0100 @@ -20,6 +20,8 @@ #include #include +#include "base/Debug.h" + class PluginRDFDescription { public: diff -r be43b2fe68e8 -r 573d45e9487b rdf/PluginRDFIndexer.cpp --- a/rdf/PluginRDFIndexer.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/rdf/PluginRDFIndexer.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -117,7 +117,7 @@ bool PluginRDFIndexer::indexConfiguredURLs() { - std::cerr << "PluginRDFIndexer::indexConfiguredURLs" << std::endl; + DEBUG << "PluginRDFIndexer::indexConfiguredURLs" << endl; QSettings settings; settings.beginGroup("RDF"); @@ -129,8 +129,8 @@ QString index = indices[i]; - std::cerr << "PluginRDFIndexer::indexConfiguredURLs: index url is " - << index.toStdString() << std::endl; + DEBUG << "PluginRDFIndexer::indexConfiguredURLs: index url is " + << index << endl; CachedFile cf(index); if (!cf.isOK()) continue; @@ -143,8 +143,8 @@ PlaylistFileReader::Playlist list = reader.load(); for (PlaylistFileReader::Playlist::const_iterator j = list.begin(); j != list.end(); ++j) { - std::cerr << "PluginRDFIndexer::indexConfiguredURLs: url is " - << j->toStdString() << std::endl; + DEBUG << "PluginRDFIndexer::indexConfiguredURLs: url is " + << j->toStdString() << endl; pullURL(*j); } } @@ -186,7 +186,7 @@ // Because we may want to refer to this document again, we // cache it locally if it turns out to exist. - cerr << "PluginRDFIndexer::getIdForPluginURI: NOTE: Failed to find a local RDF document describing plugin <" << uri.toStdString() << ">: attempting to retrieve one remotely by guesswork" << endl; + cerr << "PluginRDFIndexer::getIdForPluginURI: NOTE: Failed to find a local RDF document describing plugin <" << uri << ">: attempting to retrieve one remotely by guesswork" << endl; QString baseUrl = QUrl(uri).toString(QUrl::RemoveFragment); @@ -241,7 +241,7 @@ loadPrefixes(); -// std::cerr << "PluginRDFIndexer::indexURL(" << urlString.toStdString() << ")" << std::endl; +// DEBUG << "PluginRDFIndexer::indexURL(" << urlString << ")" << endl; QMutexLocker locker(&m_mutex); @@ -288,12 +288,12 @@ if (!query.isOK()) { cerr << "ERROR: PluginRDFIndexer::reindex: ERROR: Failed to query plugins from model: " - << query.getErrorString().toStdString() << endl; + << query.getErrorString() << endl; return false; } if (results.empty()) { - cerr << "PluginRDFIndexer::reindex: NOTE: no vamp:Plugin resources found in indexed documents" << endl; + DEBUG << "PluginRDFIndexer::reindex: NOTE: no vamp:Plugin resources found in indexed documents" << endl; return false; } @@ -308,14 +308,14 @@ QString identifier = (*i)["plugin_id"].value; if (identifier == "") { - cerr << "PluginRDFIndexer::reindex: NOTE: No vamp:identifier for plugin <" - << pluginUri.toStdString() << ">" + DEBUG << "PluginRDFIndexer::reindex: NOTE: No vamp:identifier for plugin <" + << pluginUri << ">" << endl; continue; } if (soUri == "") { - cerr << "PluginRDFIndexer::reindex: NOTE: No implementation library for plugin <" - << pluginUri.toStdString() << ">" + DEBUG << "PluginRDFIndexer::reindex: NOTE: No implementation library for plugin <" + << pluginUri << ">" << endl; continue; } @@ -334,8 +334,8 @@ SimpleSPARQLQuery::singleResultQuery(m, sonameQuery, "library_id"); QString soname = sonameValue.value; if (soname == "") { - cerr << "PluginRDFIndexer::reindex: NOTE: No identifier for library <" - << soUri.toStdString() << ">" + DEBUG << "PluginRDFIndexer::reindex: NOTE: No identifier for library <" + << soUri << ">" << endl; continue; } @@ -355,10 +355,10 @@ if (pluginUri != "") { if (m_uriToIdMap.find(pluginUri) != m_uriToIdMap.end()) { - cerr << "PluginRDFIndexer::reindex: WARNING: Found multiple plugins with the same URI:" << endl; - cerr << " 1. Plugin id \"" << m_uriToIdMap[pluginUri].toStdString() << "\"" << endl; - cerr << " 2. Plugin id \"" << pluginId.toStdString() << "\"" << endl; - cerr << "both claim URI <" << pluginUri.toStdString() << ">" << endl; + DEBUG << "PluginRDFIndexer::reindex: WARNING: Found multiple plugins with the same URI:" << endl; + cerr << " 1. Plugin id \"" << m_uriToIdMap[pluginUri] << "\"" << endl; + cerr << " 2. Plugin id \"" << pluginId << "\"" << endl; + cerr << "both claim URI <" << pluginUri << ">" << endl; } else { m_uriToIdMap[pluginUri] = pluginId; } @@ -366,7 +366,7 @@ } if (!foundSomething) { - cerr << "PluginRDFIndexer::reindex: NOTE: Plugins found, but none sufficiently described" << endl; + DEBUG << "PluginRDFIndexer::reindex: NOTE: Plugins found, but none sufficiently described" << endl; } return addedSomething; diff -r be43b2fe68e8 -r 573d45e9487b rdf/RDFFeatureWriter.cpp --- a/rdf/RDFFeatureWriter.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/rdf/RDFFeatureWriter.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -112,7 +112,7 @@ RDFFeatureWriter::setTrackMetadata(QString trackId, TrackMetadata metadata) { -// cerr << "setTrackMetadata: title = " << metadata.title.toStdString() << ", maker = " << metadata.maker.toStdString() << endl; +// cerr << "setTrackMetadata: title = " << metadata.title << ", maker = " << metadata.maker << endl; m_metadata[trackId] = metadata; } @@ -141,11 +141,11 @@ m_rdfDescriptions[pluginId] = PluginRDFDescription(pluginId); if (m_rdfDescriptions[pluginId].haveDescription()) { - cerr << "NOTE: Have RDF description for plugin ID \"" - << pluginId.toStdString() << "\"" << endl; + DEBUG << "NOTE: Have RDF description for plugin ID \"" + << pluginId << "\"" << endl; } else { - cerr << "NOTE: No RDF description for plugin ID \"" - << pluginId.toStdString() << "\"" << endl; + DEBUG << "NOTE: No RDF description for plugin ID \"" + << pluginId << "\"" << endl; if (!m_network) { cerr << " Consider using the --rdf-network option to retrieve plugin descriptions" << endl; cerr << " from the network where possible." << endl; @@ -262,7 +262,7 @@ // dirty grubby low-rent way of doing that. This function is // called by FileFeatureWriter::getOutputFile when in append mode. -// std::cerr << "reviewFileForAppending(" << filename.toStdString() << ")" << std::endl; +// std::cerr << "reviewFileForAppending(" << filename << ")" << std::endl; QFile file(filename); @@ -292,7 +292,7 @@ RDFFeatureWriter::writeSignalDescription(QTextStream *sptr, QString trackId) { -// std::cerr << "RDFFeatureWriter::writeSignalDescription" << std::endl; +// DEBUG << "RDFFeatureWriter::writeSignalDescription" << endl; QTextStream &stream = *sptr; @@ -348,7 +348,7 @@ (m_metadata.find(trackId) != m_metadata.end())); // cerr << "wantTrack = " << wantTrack << " (userSpecifiedTrack = " -// << userSpecifiedTrack << ", m_userMakerUri = " << m_userMakerUri.toStdString() << ", have metadata = " << (m_metadata.find(trackId) != m_metadata.end()) << ")" << endl; +// << userSpecifiedTrack << ", m_userMakerUri = " << m_userMakerUri << ", have metadata = " << (m_metadata.find(trackId) != m_metadata.end()) << ")" << endl; if (wantTrack) { // We only write a Track at all if we have some title/artist @@ -520,7 +520,7 @@ PluginRDFDescription &desc, QString timelineURI) { -// std::cerr << "RDFFeatureWriter::writeSparseRDF: have " << featureList.size() << " features" << std::endl; +// DEBUG << "RDFFeatureWriter::writeSparseRDF: have " << featureList.size() << " features" << endl; if (featureList.empty()) return; QTextStream &stream = *sptr; @@ -621,7 +621,7 @@ QString featureUri = desc.getOutputFeatureAttributeURI(outputId); if (featureUri == "") { - cerr << "RDFFeatureWriter::writeTrackLevelRDF: ERROR: No feature URI available -- this function should not have been called!" << endl; + DEBUG << "RDFFeatureWriter::writeTrackLevelRDF: ERROR: No feature URI available -- this function should not have been called!" << endl; return; } @@ -765,14 +765,14 @@ void RDFFeatureWriter::finish() { -// cerr << "RDFFeatureWriter::finish()" << endl; +// DEBUG << "RDFFeatureWriter::finish()" << endl; // close any open dense feature literals for (map::iterator i = m_openDenseFeatures.begin(); i != m_openDenseFeatures.end(); ++i) { -// cerr << "closing a stream" << endl; +// DEBUG << "closing a stream" << endl; StreamBuffer &b = i->second; *(b.first) << b.second << "\" ." << endl; } diff -r be43b2fe68e8 -r 573d45e9487b rdf/RDFImporter.cpp --- a/rdf/RDFImporter.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/rdf/RDFImporter.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -154,7 +154,7 @@ if (m_sampleRate == 0) { m_errorString = QString("Invalid audio data model (is audio file format supported?)"); - std::cerr << m_errorString.toStdString() << std::endl; + std::cerr << m_errorString << std::endl; return models; } @@ -219,14 +219,12 @@ QString signal = results[i]["signal"].value; QString source = results[i]["source"].value; - std::cerr << "NOTE: Seeking signal source \"" << source.toStdString() - << "\"..." << std::endl; + DEBUG << "NOTE: Seeking signal source \"" << source << "\"..." << endl; FileSource *fs = new FileSource(source, reporter); if (fs->isAvailable()) { - std::cerr << "NOTE: Source is available: Local filename is \"" - << fs->getLocalFilename().toStdString() - << "\"..." << std::endl; + DEBUG << "NOTE: Source is available: Local filename is \"" + << fs->getLocalFilename() << "\"..." << endl; } #ifdef NO_SV_GUI @@ -237,8 +235,7 @@ } #else if (!fs->isAvailable()) { - std::cerr << "NOTE: Signal source \"" << source.toStdString() - << "\" is not available, using file finder..." << std::endl; + DEBUG << "NOTE: Signal source \"" << source << "\" is not available, using file finder..." << endl; FileFinder *ff = FileFinder::getInstance(); if (ff) { QString path = ff->find(FileFinder::AudioFile, @@ -265,7 +262,7 @@ fs->waitForData(); WaveFileModel *newModel = new WaveFileModel(*fs, m_sampleRate); if (newModel->isOK()) { - std::cerr << "Successfully created wave file model from source at \"" << source.toStdString() << "\"" << std::endl; + std::cerr << "Successfully created wave file model from source at \"" << source << "\"" << std::endl; models.push_back(newModel); m_audioModelMap[signal] = newModel; if (m_sampleRate == 0) { @@ -428,7 +425,7 @@ "title"); if (v.value != "") { - std::cerr << "RDFImporterImpl::getDenseModelTitle: Title (from signal) \"" << v.value.toStdString() << "\"" << std::endl; + DEBUG << "RDFImporterImpl::getDenseModelTitle: Title (from signal) \"" << v.value << "\"" << endl; m->setObjectName(v.value); return; } @@ -439,12 +436,12 @@ "title"); if (v.value != "") { - std::cerr << "RDFImporterImpl::getDenseModelTitle: Title (from signal type) \"" << v.value.toStdString() << "\"" << std::endl; + DEBUG << "RDFImporterImpl::getDenseModelTitle: Title (from signal type) \"" << v.value << "\"" << endl; m->setObjectName(v.value); return; } - std::cerr << "RDFImporterImpl::getDenseModelTitle: No title available for feature <" << featureUri.toStdString() << ">" << std::endl; + DEBUG << "RDFImporterImpl::getDenseModelTitle: No title available for feature <" << featureUri << ">" << endl; } void @@ -473,7 +470,7 @@ SimpleSPARQLQuery::singleResultQuery (s, dimensionsQuery.arg(m_uristring).arg(featureUri), "dimensions"); - cerr << "Dimensions = \"" << dimensionsValue.value.toStdString() << "\"" + cerr << "Dimensions = \"" << dimensionsValue.value << "\"" << endl; if (dimensionsValue.value != "") { @@ -658,7 +655,7 @@ SimpleSPARQLQuery query(s, queryString); query.setProgressReporter(reporter); -// cerr << "Query will be: " << queryString.toStdString() << endl; +// cerr << "Query will be: " << queryString << endl; SimpleSPARQLQuery::ResultList results = query.execute(); @@ -738,13 +735,13 @@ (rangeResults[0]["time"].value.toStdString()); duration = RealTime::fromXsdDuration (rangeResults[0]["duration"].value.toStdString()); -// std::cerr << "duration string " << rangeResults[0]["duration"].value.toStdString() << std::endl; +// std::cerr << "duration string " << rangeResults[0]["duration"].value << std::endl; haveTime = true; haveDuration = true; } else { QString timestring = SimpleSPARQLQuery::singleResultQuery (s, timeQueryString.arg(thinguri), "time").value; -// std::cerr << "timestring = " << timestring.toStdString() << std::endl; +// DEBUG << "timestring = " << timestring << endl; if (timestring != "") { time = RealTime::fromXsdDuration(timestring.toStdString()); haveTime = true; @@ -773,11 +770,10 @@ modelMap[timeline][type][dimensions].end()) { /* - std::cerr << "Creating new model: source = " << source.toStdString() - << ", type = " << type.toStdString() << ", dimensions = " + DEBUG << "Creating new model: source = " << source << ", type = " << type << ", dimensions = " << dimensions << ", haveDuration = " << haveDuration << ", time = " << time << ", duration = " << duration - << std::endl; + << endl; */ if (!haveDuration) { @@ -878,7 +874,7 @@ std::vector &values, QString label) { -// std::cerr << "RDFImporterImpl::fillModel: adding point at frame " << ftime << std::endl; +// DEBUG << "RDFImporterImpl::fillModel: adding point at frame " << ftime << endl; SparseOneDimensionalModel *sodm = dynamic_cast(model); @@ -1030,8 +1026,8 @@ } } - std::cerr << "NOTE: RDFImporter::identifyDocumentType: haveAudio = " - << haveAudio << std::endl; + DEBUG << "NOTE: RDFImporter::identifyDocumentType: haveAudio = " + << haveAudio << endl; value = SimpleSPARQLQuery::singleResultQuery @@ -1064,8 +1060,8 @@ } } - std::cerr << "NOTE: RDFImporter::identifyDocumentType: haveAnnotations = " - << haveAnnotations << std::endl; + DEBUG << "NOTE: RDFImporter::identifyDocumentType: haveAnnotations = " + << haveAnnotations << endl; SimpleSPARQLQuery::closeSingleSource(url); diff -r be43b2fe68e8 -r 573d45e9487b rdf/RDFTransformFactory.cpp --- a/rdf/RDFTransformFactory.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/rdf/RDFTransformFactory.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -168,7 +168,7 @@ m_isRDF = true; if (transformResults.empty()) { - cerr << "RDFTransformFactory: NOTE: No RDF/TTL transform descriptions found in document at <" << m_urlString.toStdString() << ">" << endl; + DEBUG << "RDFTransformFactory: NOTE: No RDF/TTL transform descriptions found in document at <" << m_urlString << ">" << endl; return transforms; } @@ -195,8 +195,8 @@ QString pluginId = indexer->getIdForPluginURI(pluginUri); if (pluginId == "") { cerr << "RDFTransformFactory: WARNING: Unknown plugin <" - << pluginUri.toStdString() << "> for transform <" - << transformUri.toStdString() << ">, skipping this transform" + << pluginUri << "> for transform <" + << transformUri << ">, skipping this transform" << endl; continue; } @@ -284,14 +284,14 @@ transform.setDuration (RealTime::fromXsdDuration(v.value.toStdString())); } else { - cerr << "RDFTransformFactory: ERROR: Inconsistent optionals lists (unexpected optional \"" << optional.toStdString() << "\"" << endl; + cerr << "RDFTransformFactory: ERROR: Inconsistent optionals lists (unexpected optional \"" << optional << "\"" << endl; } } } } - cerr << "RDFTransformFactory: NOTE: Transform is: " << endl; - cerr << transform.toXmlString().toStdString() << endl; + DEBUG << "RDFTransformFactory: NOTE: Transform is: " << endl; + cerr << transform.toXmlString() << endl; transforms.push_back(transform); } @@ -399,7 +399,7 @@ s << uri << " a vamp:Transform ;" << endl; s << " vamp:plugin <" << QUrl(pluginUri).toEncoded().data() << "> ;" << endl; } else { - std::cerr << "WARNING: RDFTransformFactory::writeTransformToRDF: No plugin URI available for plugin id \"" << pluginId.toStdString() << "\", writing synthetic plugin and library resources" << std::endl; + std::cerr << "WARNING: RDFTransformFactory::writeTransformToRDF: No plugin URI available for plugin id \"" << pluginId << "\", writing synthetic plugin and library resources" << std::endl; QString type, soname, label; PluginIdentifier::parseIdentifier(pluginId, type, soname, label); s << uri << "_plugin a vamp:Plugin ;" << endl; @@ -416,7 +416,7 @@ QString outputUri = description.getOutputUri(outputId); if (transform.getOutput() != "" && outputUri == "") { - std::cerr << "WARNING: RDFTransformFactory::writeTransformToRDF: No output URI available for transform output id \"" << transform.getOutput().toStdString() << "\", writing a synthetic output resource" << std::endl; + std::cerr << "WARNING: RDFTransformFactory::writeTransformToRDF: No output URI available for transform output id \"" << transform.getOutput() << "\", writing a synthetic output resource" << std::endl; } if (transform.getStepSize() != 0) { diff -r be43b2fe68e8 -r 573d45e9487b rdf/SimpleSPARQLQuery.cpp --- a/rdf/SimpleSPARQLQuery.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/rdf/SimpleSPARQLQuery.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -163,7 +163,7 @@ } QString err; if (!loadUri(model, fromUri, err)) { - std::cerr << "SimpleSPARQLQuery: ERROR: Failed to parse into new model: " << err.toStdString() << std::endl; + std::cerr << "SimpleSPARQLQuery: ERROR: Failed to parse into new model: " << err << std::endl; librdf_free_model(model); librdf_free_storage(storage); m_ownModelUris[fromUri] = 0; @@ -178,17 +178,17 @@ WredlandWorldWrapper::freeModel(QString forUri) { #ifdef DEBUG_SIMPLE_SPARQL_QUERY - std::cerr << "SimpleSPARQLQuery::freeModel: Model uri = \"" << forUri.toStdString() << "\"" << std::endl; + DEBUG << "SimpleSPARQLQuery::freeModel: Model uri = \"" << forUri << "\"" << endl; #endif QMutexLocker locker(&m_mutex); if (forUri == "") { - std::cerr << "SimpleSPARQLQuery::freeModel: ERROR: Can't free default model" << std::endl; + DEBUG << "SimpleSPARQLQuery::freeModel: ERROR: Can't free default model" << endl; return; } if (m_ownModelUris.find(forUri) == m_ownModelUris.end()) { #ifdef DEBUG_SIMPLE_SPARQL_QUERY - std::cerr << "SimpleSPARQLQuery::freeModel: NOTE: Unknown or already-freed model (uri = \"" << forUri.toStdString() << "\")" << std::endl; + DEBUG << "SimpleSPARQLQuery::freeModel: NOTE: Unknown or already-freed model (uri = \"" << forUri << "\")" << endl; #endif return; } @@ -221,7 +221,7 @@ } #ifdef DEBUG_SIMPLE_SPARQL_QUERY - std::cerr << "About to parse \"" << uri.toStdString() << "\"" << std::endl; + std::cerr << "About to parse \"" << uri << "\"" << std::endl; #endif Profiler p("SimpleSPARQLQuery: Parse URI into LIBRDF model"); @@ -379,7 +379,7 @@ #ifdef DEBUG_SIMPLE_SPARQL_QUERY if (m_errorString != "") { std::cerr << "SimpleSPARQLQuery::execute: error returned: \"" - << m_errorString.toStdString() << "\"" << std::endl; + << m_errorString << "\"" << std::endl; } #endif } @@ -388,7 +388,7 @@ SimpleSPARQLQuery::Impl::executeDirectParser() { #ifdef DEBUG_SIMPLE_SPARQL_QUERY - std::cerr << "SimpleSPARQLQuery::executeDirectParser: Query is: \"" << m_query.toStdString() << "\"" << std::endl; + DEBUG << "SimpleSPARQLQuery::executeDirectParser: Query is: \"" << m_query << "\"" << endl; #endif ResultList list; @@ -399,13 +399,13 @@ QString fromUri; if (fromRE.indexIn(m_query) < 0) { - std::cerr << "SimpleSPARQLQuery::executeDirectParser: Query contains no FROM clause, nothing to parse from" << std::endl; + DEBUG << "SimpleSPARQLQuery::executeDirectParser: Query contains no FROM clause, nothing to parse from" << endl; return list; } else { fromUri = fromRE.cap(1); #ifdef DEBUG_SIMPLE_SPARQL_QUERY - std::cerr << "SimpleSPARQLQuery::executeDirectParser: FROM URI is <" - << fromUri.toStdString() << ">" << std::endl; + DEBUG << "SimpleSPARQLQuery::executeDirectParser: FROM URI is <" + << fromUri << ">" << endl; #endif } @@ -416,7 +416,7 @@ SimpleSPARQLQuery::Impl::executeDatastore() { #ifdef DEBUG_SIMPLE_SPARQL_QUERY - std::cerr << "SimpleSPARQLQuery::executeDatastore: Query is: \"" << m_query.toStdString() << "\"" << std::endl; + DEBUG << "SimpleSPARQLQuery::executeDatastore: Query is: \"" << m_query << "\"" << endl; #endif ResultList list; @@ -437,7 +437,7 @@ if (counter.find(m_query) == counter.end()) counter[m_query] = 1; else ++counter[m_query]; std::cerr << "Counter for this query: " << counter[m_query] << std::endl; - std::cerr << "Base URI is: \"" << modelUri.toStdString() << "\"" << std::endl; + std::cerr << "Base URI is: \"" << modelUri << "\"" << std::endl; #endif { @@ -498,7 +498,7 @@ if (!node) { #ifdef DEBUG_SIMPLE_SPARQL_QUERY - std::cerr << i << ". " << key.toStdString() << " -> (nil)" << std::endl; + std::cerr << i << ". " << key << " -> (nil)" << std::endl; #endif resultmap[key] = Value(); continue; @@ -543,7 +543,7 @@ } #ifdef DEBUG_SIMPLE_SPARQL_QUERY - cerr << i << ". " << key.toStdString() << " -> " << text.toStdString() << " (type " << type << ")" << endl; + cerr << i << ". " << key << " -> " << text << " (type " << type << ")" << endl; #endif resultmap[key] = Value(type, text); @@ -576,7 +576,7 @@ librdf_free_query(query); #ifdef DEBUG_SIMPLE_SPARQL_QUERY - cerr << "SimpleSPARQLQuery::executeDatastore: All results retrieved (" << resultCount << " of them)" << endl; + DEBUG << "SimpleSPARQLQuery::executeDatastore: All results retrieved (" << resultCount << " of them)" << endl; #endif return list; @@ -599,7 +599,7 @@ } if (!m_redland->loadUriIntoDefaultModel(sourceUri, err)) { - std::cerr << "SimpleSPARQLQuery::addSourceToModel: Failed to add source URI \"" << sourceUri.toStdString() << ": " << err.toStdString() << std::endl; + std::cerr << "SimpleSPARQLQuery::addSourceToModel: Failed to add source URI \"" << sourceUri << ": " << err << std::endl; return false; } return true; @@ -620,8 +620,8 @@ SimpleSPARQLQuery q(type, query); ResultList results = q.execute(); if (!q.isOK()) { - cerr << "SimpleSPARQLQuery::singleResultQuery: ERROR: " - << q.getErrorString().toStdString() << endl; + DEBUG << "SimpleSPARQLQuery::singleResultQuery: ERROR: " + << q.getErrorString() << endl; return Value(); } if (results.empty()) { diff -r be43b2fe68e8 -r 573d45e9487b rdf/SimpleSPARQLQuery.h --- a/rdf/SimpleSPARQLQuery.h Tue Jun 14 13:43:03 2011 +0100 +++ b/rdf/SimpleSPARQLQuery.h Tue Jun 14 14:47:59 2011 +0100 @@ -20,6 +20,8 @@ #include #include +#include "base/Debug.h" + class ProgressReporter; class SimpleSPARQLQuery diff -r be43b2fe68e8 -r 573d45e9487b svcore.pro --- a/svcore.pro Tue Jun 14 13:43:03 2011 +0100 +++ b/svcore.pro Tue Jun 14 14:47:59 2011 +0100 @@ -27,6 +27,7 @@ base/AudioPlaySource.h \ base/Clipboard.h \ base/Command.h \ + base/Debug.h \ base/Exceptions.h \ base/LogRange.h \ base/Pitch.h \ @@ -62,6 +63,7 @@ SOURCES += base/AudioLevel.cpp \ base/Clipboard.cpp \ base/Command.cpp \ + base/Debug.cpp \ base/Exceptions.cpp \ base/LogRange.cpp \ base/Pitch.cpp \ diff -r be43b2fe68e8 -r 573d45e9487b system/System.cpp --- a/system/System.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/system/System.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -219,7 +219,7 @@ if (elements.size() > 2) unit = elements[2]; int size = elements[1].toInt(); // std::cerr << "have size \"" << size << "\", unit \"" -// << unit.toStdString() << "\"" << std::endl; +// << unit << "\"" << std::endl; if (unit.toLower() == "gb") size = size * 1024; else if (unit.toLower() == "mb") size = size; else if (unit.toLower() == "kb") size = size / 1024; diff -r be43b2fe68e8 -r 573d45e9487b system/System.h --- a/system/System.h Tue Jun 14 13:43:03 2011 +0100 +++ b/system/System.h Tue Jun 14 14:47:59 2011 +0100 @@ -16,6 +16,8 @@ #ifndef _SYSTEM_H_ #define _SYSTEM_H_ +#include "base/Debug.h" + #ifdef _WIN32 #include diff -r be43b2fe68e8 -r 573d45e9487b transform/CSVFeatureWriter.cpp --- a/transform/CSVFeatureWriter.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/transform/CSVFeatureWriter.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -64,7 +64,7 @@ { FileFeatureWriter::setParameters(params); - cerr << "CSVFeatureWriter::setParameters" << endl; + DEBUG << "CSVFeatureWriter::setParameters" << endl; for (map::iterator i = params.begin(); i != params.end(); ++i) { cerr << i->first << " -> " << i->second << endl; diff -r be43b2fe68e8 -r 573d45e9487b transform/FeatureExtractionModelTransformer.cpp --- a/transform/FeatureExtractionModelTransformer.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/transform/FeatureExtractionModelTransformer.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -43,7 +43,7 @@ m_descriptor(0), m_outputFeatureNo(0) { -// std::cerr << "FeatureExtractionModelTransformer::FeatureExtractionModelTransformer: plugin " << pluginId.toStdString() << ", outputName " << m_transform.getOutput().toStdString() << std::endl; +// DEBUG << "FeatureExtractionModelTransformer::FeatureExtractionModelTransformer: plugin " << pluginId << ", outputName " << m_transform.getOutput() << endl; QString pluginId = transform.getPluginIdentifier(); @@ -86,9 +86,9 @@ return; } - std::cerr << "Initialising feature extraction plugin with channels = " + DEBUG << "Initialising feature extraction plugin with channels = " << channelCount << ", step = " << m_transform.getStepSize() - << ", block = " << m_transform.getBlockSize() << std::endl; + << ", block = " << m_transform.getBlockSize() << endl; if (!m_plugin->initialise(channelCount, m_transform.getStepSize(), @@ -152,7 +152,7 @@ } for (size_t i = 0; i < outputs.size(); ++i) { -// std::cerr << "comparing output " << i << " name \"" << outputs[i].identifier << "\" with expected \"" << m_transform.getOutput().toStdString() << "\"" << std::endl; +// DEBUG << "comparing output " << i << " name \"" << outputs[i].identifier << "\" with expected \"" << m_transform.getOutput() << "\"" << endl; if (m_transform.getOutput() == "" || outputs[i].identifier == m_transform.getOutput().toStdString()) { m_outputFeatureNo = i; @@ -378,7 +378,7 @@ FeatureExtractionModelTransformer::~FeatureExtractionModelTransformer() { -// std::cerr << "FeatureExtractionModelTransformer::~FeatureExtractionModelTransformer()" << std::endl; +// DEBUG << "FeatureExtractionModelTransformer::~FeatureExtractionModelTransformer()" << endl; delete m_plugin; delete m_descriptor; } @@ -386,12 +386,12 @@ DenseTimeValueModel * FeatureExtractionModelTransformer::getConformingInput() { -// std::cerr << "FeatureExtractionModelTransformer::getConformingInput: input model is " << getInputModel() << std::endl; +// DEBUG << "FeatureExtractionModelTransformer::getConformingInput: input model is " << getInputModel() << endl; DenseTimeValueModel *dtvm = dynamic_cast(getInputModel()); if (!dtvm) { - std::cerr << "FeatureExtractionModelTransformer::getConformingInput: WARNING: Input model is not conformable to DenseTimeValueModel" << std::endl; + DEBUG << "FeatureExtractionModelTransformer::getConformingInput: WARNING: Input model is not conformable to DenseTimeValueModel" << endl; } return dtvm; } @@ -405,7 +405,7 @@ if (!m_output) return; while (!input->isReady() && !m_abandoned) { - std::cerr << "FeatureExtractionModelTransformer::run: Waiting for input model to be ready..." << std::endl; + DEBUG << "FeatureExtractionModelTransformer::run: Waiting for input model to be ready..." << endl; usleep(500000); } if (m_abandoned) return; @@ -499,9 +499,9 @@ contextStart + contextDuration) break; } -// std::cerr << "FeatureExtractionModelTransformer::run: blockFrame " +// DEBUG << "FeatureExtractionModelTransformer::run: blockFrame " // << blockFrame << ", endFrame " << endFrame << ", blockSize " -// << blockSize << std::endl; +// << blockSize << endl; long completion = (((blockFrame - contextStart) / stepSize) * 99) / @@ -519,7 +519,7 @@ } error = fftModels[ch]->getError(); if (error != "") { - std::cerr << "FeatureExtractionModelTransformer::run: Abandoning, error is " << error.toStdString() << std::endl; + std::cerr << "FeatureExtractionModelTransformer::run: Abandoning, error is " << error << std::endl; m_abandoned = true; m_message = error; } @@ -636,8 +636,8 @@ { size_t inputRate = m_input.getModel()->getSampleRate(); -// std::cerr << "FeatureExtractionModelTransformer::addFeature(" -// << blockFrame << ")" << std::endl; +// DEBUG << "FeatureExtractionModelTransformer::addFeature(" +// << blockFrame << ")" << endl; int binCount = 1; if (m_descriptor->hasFixedBinCount) { @@ -777,7 +777,7 @@ model->setColumn(frame / model->getResolution(), values); } else { - std::cerr << "FeatureExtractionModelTransformer::addFeature: Unknown output model type!" << std::endl; + DEBUG << "FeatureExtractionModelTransformer::addFeature: Unknown output model type!" << endl; } } @@ -789,8 +789,8 @@ binCount = m_descriptor->binCount; } -// std::cerr << "FeatureExtractionModelTransformer::setCompletion(" -// << completion << ")" << std::endl; +// DEBUG << "FeatureExtractionModelTransformer::setCompletion(" +// << completion << ")" << endl; if (isOutput()) { diff -r be43b2fe68e8 -r 573d45e9487b transform/FileFeatureWriter.cpp --- a/transform/FileFeatureWriter.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/transform/FileFeatureWriter.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -46,7 +46,7 @@ } else if (m_support & SupportOneFileTotal) { m_singleFileName = QString("output.%1").arg(m_extension); } else { - cerr << "FileFeatureWriter::FileFeatureWriter: ERROR: Invalid support specification " << support << endl; + DEBUG << "FileFeatureWriter::FileFeatureWriter: ERROR: Invalid support specification " << support << endl; } } } @@ -60,8 +60,8 @@ } while (!m_files.empty()) { if (m_files.begin()->second) { - cerr << "FileFeatureWriter::~FileFeatureWriter: NOTE: Closing feature file \"" - << m_files.begin()->second->fileName().toStdString() << "\"" << endl; + DEBUG << "FileFeatureWriter::~FileFeatureWriter: NOTE: Closing feature file \"" + << m_files.begin()->second->fileName() << "\"" << endl; delete m_files.begin()->second; } m_files.erase(m_files.begin()); @@ -128,7 +128,7 @@ if (m_support & SupportOneFilePerTrackTransform && m_support & SupportOneFilePerTrack) { if (m_singleFileName != "") { - cerr << "FileFeatureWriter::setParameters: WARNING: Both one-file and many-files parameters provided, ignoring many-files" << endl; + DEBUG << "FileFeatureWriter::setParameters: WARNING: Both one-file and many-files parameters provided, ignoring many-files" << endl; } else { m_manyFiles = true; } @@ -142,7 +142,7 @@ // OneFilePerTrack), so we need to be able to // override it // if (m_manyFiles) { -// cerr << "FileFeatureWriter::setParameters: WARNING: Both many-files and one-file parameters provided, ignoring one-file" << endl; +// DEBUG << "FileFeatureWriter::setParameters: WARNING: Both many-files and one-file parameters provided, ignoring one-file" << endl; // } else { m_singleFileName = i->second.c_str(); // } @@ -151,7 +151,7 @@ } else if (i->first == "stdout") { if (m_support & SupportOneFileTotal) { if (m_singleFileName != "") { - cerr << "FileFeatureWriter::setParameters: WARNING: Both stdout and one-file provided, ignoring stdout" << endl; + DEBUG << "FileFeatureWriter::setParameters: WARNING: Both stdout and one-file provided, ignoring stdout" << endl; } else { m_stdout = true; } @@ -170,8 +170,8 @@ { if (m_singleFileName != "") { if (QFileInfo(m_singleFileName).exists() && !(m_force || m_append)) { - cerr << endl << "FileFeatureWriter: ERROR: Specified output file \"" << m_singleFileName.toStdString() << "\" exists and neither --" << getWriterTag().toStdString() << "-force nor --" << getWriterTag().toStdString() << "-append flag is specified -- not overwriting" << endl; - cerr << "NOTE: To find out how to fix this problem, read the help for the --" << getWriterTag().toStdString() << "-force" << endl << "and --" << getWriterTag().toStdString() << "-append options" << endl; + cerr << endl << "FileFeatureWriter: ERROR: Specified output file \"" << m_singleFileName << "\" exists and neither --" << getWriterTag() << "-force nor --" << getWriterTag() << "-append flag is specified -- not overwriting" << endl; + DEBUG << "NOTE: To find out how to fix this problem, read the help for the --" << getWriterTag() << "-force" << endl << "and --" << getWriterTag() << "-append options" << endl; return ""; } return m_singleFileName; @@ -193,14 +193,14 @@ infilename = scheme + ":" + infilename; // DOS drive! } -// cerr << "trackId = " << trackId.toStdString() << ", url = " << url.toString().toStdString() << ", infilename = " -// << infilename.toStdString() << ", basename = " << basename.toStdString() << ", m_baseDir = " << m_baseDir.toStdString() << endl; +// cerr << "trackId = " << trackId << ", url = " << url.toString() << ", infilename = " +// << infilename << ", basename = " << basename << ", m_baseDir = " << m_baseDir << endl; if (m_baseDir != "") dirname = QFileInfo(m_baseDir).absoluteFilePath(); else if (local) dirname = QFileInfo(infilename).absolutePath(); else dirname = QDir::currentPath(); -// cerr << "dirname = " << dirname.toStdString() << endl; +// cerr << "dirname = " << dirname << endl; QString filename; @@ -215,8 +215,8 @@ filename = QDir(dirname).filePath(filename); if (QFileInfo(filename).exists() && !(m_force || m_append)) { - cerr << endl << "FileFeatureWriter: ERROR: Output file \"" << filename.toStdString() << "\" exists (for input file or URL \"" << trackId.toStdString() << "\" and transform \"" << transformId.toStdString() << "\") and neither --" << getWriterTag().toStdString() << "-force nor --" << getWriterTag().toStdString() << "-append is specified -- not overwriting" << endl; - cerr << "NOTE: To find out how to fix this problem, read the help for the --" << getWriterTag().toStdString() << "-force" << endl << "and --" << getWriterTag().toStdString() << "-append options" << endl; + cerr << endl << "FileFeatureWriter: ERROR: Output file \"" << filename << "\" exists (for input file or URL \"" << trackId << "\" and transform \"" << transformId << "\") and neither --" << getWriterTag() << "-force nor --" << getWriterTag() << "-append is specified -- not overwriting" << endl; + DEBUG << "NOTE: To find out how to fix this problem, read the help for the --" << getWriterTag() << "-force" << endl << "and --" << getWriterTag() << "-append options" << endl; return ""; } @@ -263,11 +263,11 @@ return 0; } - cerr << "FileFeatureWriter: NOTE: Using output filename \"" - << filename.toStdString() << "\"" << endl; + DEBUG << "FileFeatureWriter: NOTE: Using output filename \"" + << filename << "\"" << endl; if (m_append) { - cerr << "FileFeatureWriter: NOTE: Calling reviewFileForAppending" << endl; + DEBUG << "FileFeatureWriter: NOTE: Calling reviewFileForAppending" << endl; reviewFileForAppending(filename); } @@ -329,7 +329,7 @@ void FileFeatureWriter::finish() { -// cerr << "FileFeatureWriter::finish()" << endl; +// DEBUG << "FileFeatureWriter::finish()" << endl; if (m_singleFileName != "" || m_stdout) return; @@ -340,8 +340,8 @@ } while (!m_files.empty()) { if (m_files.begin()->second) { - cerr << "FileFeatureWriter::finish: NOTE: Closing feature file \"" - << m_files.begin()->second->fileName().toStdString() << "\"" << endl; + DEBUG << "FileFeatureWriter::finish: NOTE: Closing feature file \"" + << m_files.begin()->second->fileName() << "\"" << endl; delete m_files.begin()->second; } m_files.erase(m_files.begin()); diff -r be43b2fe68e8 -r 573d45e9487b transform/ModelTransformerFactory.cpp --- a/transform/ModelTransformerFactory.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/transform/ModelTransformerFactory.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -87,7 +87,7 @@ bool ok = true; QString configurationXml = m_lastConfigurations[transform.getIdentifier()]; - std::cerr << "last configuration: " << configurationXml.toStdString() << std::endl; + std::cerr << "last configuration: " << configurationXml << std::endl; Vamp::PluginBase *plugin = 0; @@ -181,8 +181,8 @@ new RealTimeEffectModelTransformer(input, transform); } else { - std::cerr << "ModelTransformerFactory::createTransformer: Unknown transform \"" - << transform.getIdentifier().toStdString() << "\"" << std::endl; + DEBUG << "ModelTransformerFactory::createTransformer: Unknown transform \"" + << transform.getIdentifier() << "\"" << endl; return transformer; } @@ -195,7 +195,7 @@ const ModelTransformer::Input &input, QString &message) { - std::cerr << "ModelTransformerFactory::transform: Constructing transformer with input model " << input.getModel() << std::endl; + DEBUG << "ModelTransformerFactory::transform: Constructing transformer with input model " << input.getModel() << endl; ModelTransformer *t = createTransformer(transform, input); if (!t) return 0; @@ -236,7 +236,7 @@ QObject *s = sender(); ModelTransformer *transformer = dynamic_cast(s); -// std::cerr << "ModelTransformerFactory::transformerFinished(" << transformer << ")" << std::endl; +// DEBUG << "ModelTransformerFactory::transformerFinished(" << transformer << ")" << endl; if (!transformer) { std::cerr << "WARNING: ModelTransformerFactory::transformerFinished: sender is not a transformer" << std::endl; diff -r be43b2fe68e8 -r 573d45e9487b transform/RealTimeEffectModelTransformer.cpp --- a/transform/RealTimeEffectModelTransformer.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/transform/RealTimeEffectModelTransformer.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -43,14 +43,14 @@ if (!m_transform.getBlockSize()) m_transform.setBlockSize(1024); -// std::cerr << "RealTimeEffectModelTransformer::RealTimeEffectModelTransformer: plugin " << pluginId.toStdString() << ", output " << output << std::endl; +// DEBUG << "RealTimeEffectModelTransformer::RealTimeEffectModelTransformer: plugin " << pluginId << ", output " << output << endl; RealTimePluginFactory *factory = RealTimePluginFactory::instanceFor(pluginId); if (!factory) { std::cerr << "RealTimeEffectModelTransformer: No factory available for plugin id \"" - << pluginId.toStdString() << "\"" << std::endl; + << pluginId << "\"" << std::endl; return; } @@ -64,7 +64,7 @@ if (!m_plugin) { std::cerr << "RealTimeEffectModelTransformer: Failed to instantiate plugin \"" - << pluginId.toStdString() << "\"" << std::endl; + << pluginId << "\"" << std::endl; return; } @@ -110,7 +110,7 @@ DenseTimeValueModel *dtvm = dynamic_cast(getInputModel()); if (!dtvm) { - std::cerr << "RealTimeEffectModelTransformer::getConformingInput: WARNING: Input model is not conformable to DenseTimeValueModel" << std::endl; + DEBUG << "RealTimeEffectModelTransformer::getConformingInput: WARNING: Input model is not conformable to DenseTimeValueModel" << endl; } return dtvm; } @@ -122,7 +122,7 @@ if (!input) return; while (!input->isReady() && !m_abandoned) { - std::cerr << "RealTimeEffectModelTransformer::run: Waiting for input model to be ready..." << std::endl; + DEBUG << "RealTimeEffectModelTransformer::run: Waiting for input model to be ready..." << endl; usleep(500000); } if (m_abandoned) return; diff -r be43b2fe68e8 -r 573d45e9487b transform/Transform.cpp --- a/transform/Transform.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/transform/Transform.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -54,10 +54,10 @@ if (!doc.setContent(xml, false, &error, &errorLine, &errorColumn)) { std::cerr << "Transform::Transform: Error in parsing XML: " - << error.toStdString() << " at line " << errorLine + << error << " at line " << errorLine << ", column " << errorColumn << std::endl; std::cerr << "Input follows:" << std::endl; - std::cerr << xml.toStdString() << std::endl; + std::cerr << xml << std::endl; std::cerr << "Input ends." << std::endl; return; } @@ -124,11 +124,11 @@ m_duration == t.m_duration && m_sampleRate == t.m_sampleRate; /* - std::cerr << "Transform::operator==: identical = " << identical << std::endl; + DEBUG << "Transform::operator==: identical = " << identical << endl; std::cerr << "A = " << std::endl; - std::cerr << toXmlString().toStdString() << std::endl; + std::cerr << toXmlString() << std::endl; std::cerr << "B = " << std::endl; - std::cerr << t.toXmlString().toStdString() << std::endl; + std::cerr << t.toXmlString() << std::endl; */ return identical; } @@ -260,8 +260,7 @@ void Transform::setParameter(QString name, float value) { -// std::cerr << "Transform::setParameter(" << name.toStdString() -// << ") -> " << value << std::endl; +// DEBUG << "Transform::setParameter(" << name// << ") -> " << value << endl; m_parameters[name] = value; } @@ -280,8 +279,7 @@ void Transform::setConfigurationValue(QString name, QString value) { - std::cerr << "Transform::setConfigurationValue(" << name.toStdString() - << ") -> " << value.toStdString() << std::endl; + DEBUG << "Transform::setConfigurationValue(" << name << ") -> " << value << endl; m_configuration[name] = value; } @@ -463,8 +461,8 @@ str == "standard deviation" || str == "sd") return StandardDeviation; if (str == "count") return Count; if (str == "") return NoSummary; - std::cerr << "Transform::stringToSummaryType: unknown summary type \"" - << str.toStdString() << "\"" << std::endl; + DEBUG << "Transform::stringToSummaryType: unknown summary type \"" + << str << "\"" << endl; return NoSummary; } @@ -483,8 +481,8 @@ case Count: return "count"; case NoSummary: return ""; default: - std::cerr << "Transform::summaryTypeToString: unexpected summary type " - << int(type) << std::endl; + DEBUG << "Transform::summaryTypeToString: unexpected summary type " + << int(type) << endl; return ""; } } diff -r be43b2fe68e8 -r 573d45e9487b transform/TransformFactory.cpp --- a/transform/TransformFactory.cpp Tue Jun 14 13:43:03 2011 +0100 +++ b/transform/TransformFactory.cpp Tue Jun 14 14:47:59 2011 +0100 @@ -52,7 +52,7 @@ void TransformFactory::deleteInstance() { - std::cerr << "TransformFactory::deleteInstance called" << std::endl; + DEBUG << "TransformFactory::deleteInstance called" << endl; delete m_instance; m_instance = 0; } @@ -70,12 +70,12 @@ m_exiting = true; if (m_thread) { #ifdef DEBUG_TRANSFORM_FACTORY - std::cerr << "TransformFactory::~TransformFactory: waiting on thread" << std::endl; + DEBUG << "TransformFactory::~TransformFactory: waiting on thread" << endl; #endif m_thread->wait(); delete m_thread; #ifdef DEBUG_TRANSFORM_FACTORY - std::cerr << "TransformFactory::~TransformFactory: waited and done" << std::endl; + DEBUG << "TransformFactory::~TransformFactory: waited and done" << endl; #endif } } @@ -113,7 +113,7 @@ for (TransformDescriptionMap::const_iterator i = m_transforms.begin(); i != m_transforms.end(); ++i) { #ifdef DEBUG_TRANSFORM_FACTORY - cerr << "inserting transform into set: id = " << i->second.identifier.toStdString() << endl; + DEBUG << "inserting transform into set: id = " << i->second.identifier << endl; #endif dset.insert(i->second); } @@ -122,7 +122,7 @@ for (std::set::const_iterator i = dset.begin(); i != dset.end(); ++i) { #ifdef DEBUG_TRANSFORM_FACTORY - cerr << "inserting transform into list: id = " << i->identifier.toStdString() << endl; + DEBUG << "inserting transform into list: id = " << i->identifier << endl; #endif list.push_back(*i); } @@ -159,7 +159,7 @@ for (TransformDescriptionMap::const_iterator i = m_uninstalledTransforms.begin(); i != m_uninstalledTransforms.end(); ++i) { #ifdef DEBUG_TRANSFORM_FACTORY - cerr << "inserting transform into set: id = " << i->second.identifier.toStdString() << endl; + DEBUG << "inserting transform into set: id = " << i->second.identifier << endl; #endif dset.insert(i->second); } @@ -168,7 +168,7 @@ for (std::set::const_iterator i = dset.begin(); i != dset.end(); ++i) { #ifdef DEBUG_TRANSFORM_FACTORY - cerr << "inserting transform into uninstalled list: id = " << i->identifier.toStdString() << endl; + DEBUG << "inserting transform into uninstalled list: id = " << i->identifier << endl; #endif list.push_back(*i); } @@ -478,7 +478,7 @@ !plugin->getParameterDescriptors().empty()); #ifdef DEBUG_TRANSFORM_FACTORY - cerr << "Feature extraction plugin transform: " << transformId.toStdString() << " friendly name: " << friendlyName.toStdString() << endl; + cerr << "Feature extraction plugin transform: " << transformId << " friendly name: " << friendlyName << endl; #endif transforms[transformId] = @@ -530,7 +530,7 @@ //!!! if (descriptor->controlOutputPortCount == 0 || // descriptor->audioInputPortCount == 0) continue; -// std::cout << "TransformFactory::populateRealTimePlugins: plugin " << pluginId.toStdString() << " has " << descriptor->controlOutputPortCount << " control output ports, " << descriptor->audioOutputPortCount << " audio outputs, " << descriptor->audioInputPortCount << " audio inputs" << endl; +// std::cout << "TransformFactory::populateRealTimePlugins: plugin " << pluginId << " has " << descriptor->controlOutputPortCount << " control output ports, " << descriptor->audioOutputPortCount << " audio outputs, " << descriptor->audioInputPortCount << " audio inputs" << endl; QString pluginName = descriptor->name.c_str(); QString category = factory->getPluginCategory(pluginId); @@ -659,9 +659,8 @@ QString name = desc.getPluginName(); #ifdef DEBUG_TRANSFORM_FACTORY if (name == "") { - std::cerr << "TransformFactory::populateUninstalledTransforms: " - << "No name available for plugin " << i->toStdString() - << ", skipping" << std::endl; + DEBUG << "TransformFactory::populateUninstalledTransforms: " + << "No name available for plugin " << i- << ", skipping" << endl; continue; } #endif @@ -678,8 +677,8 @@ if (m_transforms.find(tid) != m_transforms.end()) { #ifdef DEBUG_TRANSFORM_FACTORY - std::cerr << "TransformFactory::populateUninstalledTransforms: " - << tid.toStdString() << " is installed; adding info url if appropriate, skipping rest" << std::endl; + DEBUG << "TransformFactory::populateUninstalledTransforms: " + << tid << " is installed; adding info url if appropriate, skipping rest" << endl; #endif if (infoUrl != "") { if (m_transforms[tid].infoUrl == "") { @@ -690,8 +689,8 @@ } #ifdef DEBUG_TRANSFORM_FACTORY - std::cerr << "TransformFactory::populateUninstalledTransforms: " - << "adding " << tid.toStdString() << std::endl; + DEBUG << "TransformFactory::populateUninstalledTransforms: " + << "adding " << tid << endl; #endif QString oname = desc.getOutputName(*j); @@ -953,9 +952,9 @@ for (Vamp::PluginBase::ParameterList::const_iterator i = parameters.begin(); i != parameters.end(); ++i) { pmap[i->identifier.c_str()] = plugin->getParameter(i->identifier); -// std::cerr << "TransformFactory::setParametersFromPlugin: parameter " +// DEBUG << "TransformFactory::setParametersFromPlugin: parameter " // << i->identifier << " -> value " << -// pmap[i->identifier.c_str()] << std::endl; +// pmap[i->identifier.c_str()] << endl; } transform.setParameters(pmap); @@ -1068,9 +1067,9 @@ Vamp::PluginBase *plugin = instantiateDefaultPluginFor (t.getIdentifier(), 0); if (!plugin) { - cerr << "TransformFactory::getPluginConfigurationXml: " + DEBUG << "TransformFactory::getPluginConfigurationXml: " << "Unable to instantiate plugin for transform \"" - << t.getIdentifier().toStdString() << "\"" << endl; + << t.getIdentifier() << "\"" << endl; return xml; } @@ -1090,9 +1089,9 @@ Vamp::PluginBase *plugin = instantiateDefaultPluginFor (t.getIdentifier(), 0); if (!plugin) { - cerr << "TransformFactory::setParametersFromPluginConfigurationXml: " + DEBUG << "TransformFactory::setParametersFromPluginConfigurationXml: " << "Unable to instantiate plugin for transform \"" - << t.getIdentifier().toStdString() << "\"" << endl; + << t.getIdentifier() << "\"" << endl; return; } @@ -1146,7 +1145,7 @@ if (!m_uninstalledTransformsMutex.tryLock()) { // uninstalled transforms are being populated; this may take some time, // and they aren't critical, but we will speed them up if necessary - std::cerr << "TransformFactory::search: Uninstalled transforms mutex is held, skipping" << std::endl; + DEBUG << "TransformFactory::search: Uninstalled transforms mutex is held, skipping" << endl; m_populatingSlowly = false; return results; }