summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Schürmann <daschuer@mixxx.org>2015-12-19 14:35:02 +0100
committerDaniel Schürmann <daschuer@mixxx.org>2015-12-19 14:35:02 +0100
commit770de57ee158f6ac94d110b8367fd11732912769 (patch)
treec00092753fc23459a24ac8e3312a971ea9bbed65 /src
parent86f41e207561e9b4f1dcc76ef3a3c94e57f237e4 (diff)
parent469a37f11239b8c700fac98ad5d78d0299f934c2 (diff)
Merge remote-tracking branch 'upstream/1.12' into controllerpoll
Conflicts: src/controllers/midi/midicontroller.cpp
Diffstat (limited to 'src')
-rw-r--r--src/SConscript32
-rw-r--r--src/controllers/bulk/bulkcontroller.cpp13
-rw-r--r--src/controllers/controller.cpp18
-rw-r--r--src/controllers/controller.h6
-rw-r--r--src/controllers/controllerdebug.h44
-rw-r--r--src/controllers/controllerengine.cpp51
-rw-r--r--src/controllers/controllerengine.h8
-rw-r--r--src/controllers/controlpickermenu.cpp8
-rw-r--r--src/controllers/hid/hidcontroller.cpp26
-rw-r--r--src/controllers/midi/hss1394controller.cpp6
-rw-r--r--src/controllers/midi/midicontroller.cpp28
-rw-r--r--src/controllers/midi/midioutputhandler.cpp13
-rw-r--r--src/controllers/midi/portmidicontroller.cpp13
-rw-r--r--src/controllers/midi/portmidicontroller.h4
-rw-r--r--src/controllers/softtakeover.cpp64
-rw-r--r--src/controllers/softtakeover.h19
-rw-r--r--src/defs_version.h2
-rw-r--r--src/engine/sidechain/enginenetworkstream.cpp13
-rw-r--r--src/engine/sidechain/engineshoutcast.cpp4
-rw-r--r--src/engine/sidechain/engineshoutcast.h3
-rw-r--r--src/library/browse/browsethread.cpp2
-rw-r--r--src/skin/tooltips.cpp160
-rw-r--r--src/sounddevicenetwork.cpp2
-rw-r--r--src/soundmanager.cpp6
-rw-r--r--src/test/SoftTakeoverTestCaseMatrix.csv52
-rw-r--r--src/test/SoftTakeoverTruthTable.csv31
-rw-r--r--src/test/controllerengine_test.cpp3
-rw-r--r--src/test/mathutiltest.cpp54
-rw-r--r--src/test/softtakeover_test.cpp605
-rw-r--r--src/test/super_link_test.cpp8
-rw-r--r--src/util/fpclassify.cpp46
-rw-r--r--src/util/fpclassify.h38
-rw-r--r--src/util/math.h13
-rw-r--r--src/util/time.cpp4
-rw-r--r--src/util/time.h29
-rw-r--r--src/waveform/vsyncthread.cpp5
-rw-r--r--src/waveform/vsyncthread.h20
-rw-r--r--src/widget/wpushbutton.cpp15
38 files changed, 1262 insertions, 206 deletions
diff --git a/src/SConscript b/src/SConscript
index 3e23d10123..e59c61e657 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -166,10 +166,21 @@ def ubuntu_construct_version(build, mixxx_version, branch_name, vcs_revision,
# unix_share_path = flags['prefix'] + "/share"
# unix_bin_path = flags['prefix'] + "/bin"
+bundle_pdbs = build.platform_is_windows and (
+ build.build_is_debug or
+ SCons.ARGUMENTS.get('bundle_pdbs', '') in ('yes', 'y', '1'))
+
#Mixxx binary
binary_files = [mixxx_bin];
if test_bin is not None:
binary_files.append(test_bin)
+ if bundle_pdbs:
+ binary_files.append(
+ Glob(os.path.join(build.build_dir, 'mixxx-test.pdb')))
+
+if bundle_pdbs:
+ binary_files.append(
+ Glob(os.path.join(build.build_dir, 'mixxx.pdb')))
#Soundsource plugins
soundsource_plugin_files = soundsource_plugins
@@ -206,8 +217,8 @@ dotdesktop_files = Glob('#res/linux/mixxx.desktop')
#.appdata.xml file for KDE/GNOME AppStream iniative
dotappstream_files = Glob('#res/linux/mixxx.appdata.xml')
-#udev rule file for HID controllers
-hidudev_files = Glob('#res/linux/mixxx-usb-hid.rules')
+#udev rule file for USB HID and Bulk controllers
+hidudev_files = Glob('#res/linux/mixxx.usb.rules')
#Icon file for menu entry
icon_files = Glob('#res/images/mixxx-icon.png')
@@ -220,10 +231,6 @@ image_files = Glob('#res/images/preferences/*') # These are compiled in to the
# TODO: Use reference to SharedLibrary for libsndfile and others, glob only gets
# all files on 2+ builds after a clean.
dll_files = []
-bundle_pdbs = build.platform_is_windows and (
- build.build_is_debug or
- SCons.ARGUMENTS.get('bundle_pdbs', '') in ('yes', 'y', '1'))
-
if build.toolchain_is_msvs:
mixxx_winlib_path = SCons.ARGUMENTS.get('winlib', '..\\..\\..\\mixxx-win32lib-msvc90-release')
# skip the MSVC DLLs incase they're in there too
@@ -311,7 +318,11 @@ if build.platform_is_linux or build.platform_is_bsd:
docs = env.Install(os.path.join(unix_share_path, 'doc', 'mixxx'), docs_files)
icon = env.Install(os.path.join(unix_share_path, 'pixmaps'), icon_files)
promotracks = env.Install(os.path.join(unix_share_path, 'mixxx', 'promo'), promotracks_files)
- hidudev = env.Install('/etc/udev/rules.d', hidudev_files)
+
+ # NOTE(rryan): Hack to detect when we're Debian packaging.
+ building_debian_package = 'debian/tmp/usr' in install_root
+ udev_root = '/etc/udev/rules.d'
+ hidudev = env.Install(udev_root, hidudev_files)
#Makes each of those Install builders get fired off when you run "scons install" :)
env.Alias('install', binary)
@@ -327,7 +338,8 @@ if build.platform_is_linux or build.platform_is_bsd:
env.Alias('install', icon)
env.Alias('install', promotracks)
env.Alias('install', vamp_plugin)
- if os.access('/etc/udev/rules.d', os.W_OK):
+
+ if not building_debian_package and os.access(udev_root, os.W_OK):
env.Alias('install', hidudev)
#Delete the old Mixxx installation (because SCONS won't overwrite it)
@@ -742,6 +754,7 @@ def BuildUbuntuPackage(target, source, env):
print "* Copying Debian build directory from build/debian to debian (cwd: %s)" % os.getcwd()
print
os.system('cp -r build/debian .')
+ os.system('cp res/linux/mixxx.usb.rules ./debian/mixxx.mixxx-usb.udev')
for ubuntu_distro in ubuntu_distros:
# if a control.$distro file exists, use it
@@ -769,7 +782,8 @@ def BuildUbuntuPackage(target, source, env):
print "* Starting pbuilder ... (cwd: %s)" % os.getcwd()
print
- command = ["ARCH=%s" % arch,
+ command = ["MIXXX_BUILD=%s" % build.build,
+ "ARCH=%s" % arch,
"DIST=%s" % ubuntu_distro]
if package_target == 'source':
diff --git a/src/controllers/bulk/bulkcontroller.cpp b/src/controllers/bulk/bulkcontroller.cpp
index 52e4ef4e72..4d038961c5 100644
--- a/src/controllers/bulk/bulkcontroller.cpp
+++ b/src/controllers/bulk/bulkcontroller.cpp
@@ -10,6 +10,7 @@
#include "controllers/bulk/bulkcontroller.h"
#include "controllers/bulk/bulksupported.h"
#include "controllers/defs_controllers.h"
+#include "controllers/controllerdebug.h"
#include "util/compatibility.h"
#include "util/trace.h"
@@ -210,7 +211,7 @@ int BulkController::close() {
disconnect(m_pReader, SIGNAL(incomingData(QByteArray)),
this, SLOT(receive(QByteArray)));
m_pReader->stop();
- if (debugging()) qDebug() << " Waiting on reader to finish";
+ controllerDebug(" Waiting on reader to finish");
m_pReader->wait();
delete m_pReader;
m_pReader = NULL;
@@ -221,9 +222,7 @@ int BulkController::close() {
stopEngine();
// Close device
- if (debugging()) {
- qDebug() << " Closing device";
- }
+ controllerDebug(" Closing device");
libusb_close(m_phandle);
m_phandle = NULL;
setOpen(false);
@@ -251,8 +250,8 @@ void BulkController::send(QByteArray data) {
if (ret < 0) {
qWarning() << "Unable to send data to" << getName()
<< "serial #" << m_sUID;
- } else if (debugging()) {
- qDebug() << ret << "bytes sent to" << getName()
- << "serial #" << m_sUID;
+ } else {
+ controllerDebug(ret << "bytes sent to" << getName()
+ << "serial #" << m_sUID);
}
}
diff --git a/src/controllers/controller.cpp b/src/controllers/controller.cpp
index 22face5d06..c7adce6506 100644
--- a/src/controllers/controller.cpp
+++ b/src/controllers/controller.cpp
@@ -9,6 +9,7 @@
#include <QScriptValue>
#include "controllers/controller.h"
+#include "controllers/controllerdebug.h"
#include "controllers/defs_controllers.h"
Controller::Controller()
@@ -17,12 +18,7 @@ Controller::Controller()
m_bIsOutputDevice(false),
m_bIsInputDevice(false),
m_bIsOpen(false),
- m_bDebug(false),
m_bLearning(false) {
- // Get --controllerDebug command line option
- QStringList commandLineArgs = QApplication::arguments();
- m_bDebug = commandLineArgs.contains("--controllerDebug", Qt::CaseInsensitive) ||
- commandLineArgs.contains("--midiDebug", Qt::CaseInsensitive);
}
Controller::~Controller() {
@@ -32,9 +28,7 @@ Controller::~Controller() {
void Controller::startEngine()
{
- if (debugging()) {
- qDebug() << " Starting engine";
- }
+ controllerDebug(" Starting engine");
if (m_pEngine != NULL) {
qWarning() << "Controller: Engine already exists! Restarting:";
stopEngine();
@@ -43,9 +37,7 @@ void Controller::startEngine()
}
void Controller::stopEngine() {
- if (debugging()) {
- qDebug() << " Shutting down engine";
- }
+ controllerDebug(" Shutting down engine");
if (m_pEngine == NULL) {
qWarning() << "Controller::stopEngine(): No engine exists!";
return;
@@ -106,7 +98,7 @@ void Controller::receive(const QByteArray data) {
}
int length = data.size();
- if (debugging()) {
+ if (ControllerDebug::enabled()) {
// Formatted packet display
QString message = QString("%1: %2 bytes:\n").arg(m_sDeviceName).arg(length);
for(int i=0; i<length; i++) {
@@ -117,7 +109,7 @@ void Controller::receive(const QByteArray data) {
.arg((unsigned char)(data.at(i)), 2, 16, QChar('0')).toUpper()
.arg(spacer);
}
- qDebug() << message;
+ controllerDebug(message);
}
foreach (QString function, m_pEngine->getScriptFunctionPrefixes()) {
diff --git a/src/controllers/controller.h b/src/controllers/controller.h
index acd0d9ada7..ea0d84d0c6 100644
--- a/src/controllers/controller.h
+++ b/src/controllers/controller.h
@@ -58,9 +58,6 @@ class Controller : public QObject, ConstControllerPresetVisitor {
inline QString getCategory() const {
return m_sDeviceCategory;
}
- inline bool debugging() const {
- return m_bDebug;
- }
virtual bool isMappable() const = 0;
inline bool isLearning() const {
return m_bLearning;
@@ -150,9 +147,6 @@ class Controller : public QObject, ConstControllerPresetVisitor {
bool m_bIsInputDevice;
// Indicates whether or not the device has been opened for input/output.
bool m_bIsOpen;
- // Specifies whether or not we should dump incoming data to the console at
- // runtime. This is useful for end-user debugging and script-writing.
- bool m_bDebug;
bool m_bLearning;
friend class ControllerManager; // accesses lots of our stuff, but in the same thread
diff --git a/src/controllers/controllerdebug.h b/src/controllers/controllerdebug.h
new file mode 100644
index 0000000000..33688230ff
--- /dev/null
+++ b/src/controllers/controllerdebug.h
@@ -0,0 +1,44 @@
+#ifndef CONTROLLERDEBUG_H
+#define CONTROLLERDEBUG_H
+
+#include <QDebug>
+#include <QApplication>
+
+class ControllerDebug {
+ public:
+ static ControllerDebug& instance() {
+ static ControllerDebug instance;
+ return instance;
+ }
+
+ static bool enabled() {
+ return instance().m_enabled;
+ }
+
+ static void setEnabled(bool enabled) {
+ instance().m_enabled = enabled;
+ }
+
+ private:
+ ControllerDebug() {
+ // Get --controllerDebug command line option
+ QStringList commandLineArgs = QApplication::arguments();
+ m_enabled = commandLineArgs.contains("--controllerDebug", Qt::CaseInsensitive) ||
+ commandLineArgs.contains("--midiDebug", Qt::CaseInsensitive);
+ }
+
+ // Specifies whether or not we should dump incoming data to the console at
+ // runtime. This is useful for end-user debugging and script-writing.
+ bool m_enabled;
+};
+
+// Usage
+// controllerDebug("hello" << "world");
+#define controllerDebug(stream) \
+{ \
+ if (ControllerDebug::enabled()) { \
+ QDebug(QtDebugMsg) << stream; \
+ } \
+} \
+
+#endif // CONTROLLERDEBUG_H
diff --git a/src/controllers/controllerengine.cpp b/src/controllers/controllerengine.cpp
index 63d54c2e58..200fe5dafd 100644
--- a/src/controllers/controllerengine.cpp
+++ b/src/controllers/controllerengine.cpp
@@ -9,6 +9,7 @@
#include "controllers/controllerengine.h"
#include "controllers/controller.h"
+#include "controllers/controllerdebug.h"
#include "controlobject.h"
#include "controlobjectthread.h"
#include "errordialoghandler.h"
@@ -31,7 +32,6 @@ const double kAlphaBetaDt = kScratchTimerMs / 1000.0;
ControllerEngine::ControllerEngine(Controller* controller)
: m_pEngine(NULL),
m_pController(controller),
- m_bDebug(false),
m_bPopups(false),
m_pBaClass(NULL) {
// Handle error dialog buttons
@@ -93,9 +93,7 @@ void ControllerEngine::callFunctionOnObjects(QList<QString> scriptFunctionPrefix
qWarning() << "ControllerEngine:" << prefixName << "has no" << function << " method";
continue;
}
- if (m_bDebug) {
- qDebug() << "ControllerEngine: Executing" << prefixName << "." << function;
- }
+ controllerDebug("ControllerEngine: Executing" << prefixName << "." << function);
init.call(prefix, args);
}
}
@@ -212,11 +210,7 @@ void ControllerEngine::initializeScriptEngine() {
Output: -
-------- ------------------------------------------------------ */
void ControllerEngine::loadScriptFiles(QList<QString> scriptPaths,
- const QList<ControllerPreset::ScriptFileInfo>& scripts) {
- // Set the Debug flag
- if (m_pController)
- m_bDebug = m_pController->debugging();
-
+ const QList<ControllerPreset::ScriptFileInfo>& scripts) {
qDebug() << "ControllerEngine: Loading & evaluating all script code";
m_lastScriptPaths = scriptPaths;
@@ -277,7 +271,7 @@ void ControllerEngine::initializeScripts(const QList<ControllerPreset::ScriptFil
QScriptValueList args;
args << QScriptValue(m_pController->getName());
- args << QScriptValue(m_bDebug);
+ args << QScriptValue(ControllerDebug::enabled());
// Call the init method for all the prefixes.
callFunctionOnObjects(m_scriptFunctionPrefixes, "init", args);
@@ -542,8 +536,9 @@ bool ControllerEngine::checkException() {
errorText = tr("Uncaught exception at line %1 in passed code: %2")
.arg(QString::number(line), errorMessage);
- scriptErrorDialog(m_bDebug ? QString("%1\nBacktrace:\n%2")
- .arg(errorText, backtrace.join("\n")) : errorText);
+ scriptErrorDialog(ControllerDebug::enabled() ?
+ QString("%1\nBacktrace:\n%2")
+ .arg(errorText, backtrace.join("\n")) : errorText);
return true;
}
return false;
@@ -1104,11 +1099,10 @@ int ControllerEngine::beginTimer(int interval, QScriptValue timerCallback,
m_timers[timerId] = info;
if (timerId == 0) {
qWarning() << "Script timer could not be created";
- } else if (m_bDebug) {
- if (oneShot)
- qDebug() << "Starting one-shot timer:" << timerId;
- else
- qDebug() << "Starting timer:" << timerId;
+ } else if (oneShot) {
+ controllerDebug("Starting one-shot timer:" << timerId);
+ } else {
+ controllerDebug("Starting timer:" << timerId);
}
return timerId;
}
@@ -1123,10 +1117,7 @@ void ControllerEngine::stopTimer(int timerId) {
qWarning() << "Killing timer" << timerId << ": That timer does not exist!";
return;
}
- if (m_bDebug) {
- qDebug() << "Killing timer:" << timerId;
- }
-
+ controllerDebug("Killing timer:" << timerId);
killTimer(timerId);
m_timers.remove(timerId);
}
@@ -1440,6 +1431,24 @@ void ControllerEngine::softTakeover(QString group, QString name, bool set) {
}
/* -------- ------------------------------------------------------
+ Purpose: Ignores the next value for the given ControlObject
+ This should be called before or after an absolute physical
+ control (slider or knob with hard limits) is changed to operate
+ on a different ControlObject, allowing it to sync up to the
+ soft-takeover state without an abrupt jump.
+ Input: ControlObject group and key values
+ Output: -
+ -------- ------------------------------------------------------ */
+void ControllerEngine::softTakeoverIgnoreNextValue(QString group, QString name) {
+ ControlObject* pControl = ControlObject::getControl(ConfigKey(group, name));
+ if (!pControl) {
+ return;
+ }
+
+ m_st.ignoreNext(pControl);
+}
+
+/* -------- ------------------------------------------------------
Purpose: [En/dis]ables spinback effect for the channel
Input: deck, activate/deactivate, factor (optional),
delay (optional), rate (optional)
diff --git a/src/controllers/controllerengine.h b/src/controllers/controllerengine.h
index 878c1f2615..51e8df001e 100644
--- a/src/controllers/controllerengine.h
+++ b/src/controllers/controllerengine.h
@@ -70,10 +70,6 @@ class ControllerEngine : public QObject {
// Get the errors for a source file that was evaluated()'d
const QStringList getErrors(QString filename);
- void setDebug(bool bDebug) {
- m_bDebug = bDebug;
- }
-
void setPopups(bool bPopups) {
m_bPopups = bPopups;
}
@@ -107,6 +103,7 @@ class ControllerEngine : public QObject {
Q_INVOKABLE void scratchDisable(int deck, bool ramp = true);
Q_INVOKABLE bool isScratching(int deck);
Q_INVOKABLE void softTakeover(QString group, QString name, bool set);
+ Q_INVOKABLE void softTakeoverIgnoreNextValue(QString group, QString name);
Q_INVOKABLE void brake(int deck, bool activate, double factor=0.9, double rate=1.0);
Q_INVOKABLE void spinback(int deck, bool activate, double factor=1.8, double rate=-10.0);
@@ -169,7 +166,6 @@ class ControllerEngine : public QObject {
double getDeckRate(const QString& group);
Controller* m_pController;
- bool m_bDebug;
bool m_bPopups;
QMultiHash<ConfigKey, ControllerEngineConnection> m_connectedControls;
QList<QString> m_scriptFunctionPrefixes;
@@ -186,7 +182,7 @@ class ControllerEngine : public QObject {
// 256 (default) available virtual decks is enough I would think.
// If more are needed at run-time, these will move to the heap automatically
QVarLengthArray<int> m_intervalAccumulator;
- QVarLengthArray<uint> m_lastMovement;
+ QVarLengthArray<qint64> m_lastMovement;
QVarLengthArray<double> m_dx, m_rampTo, m_rampFactor;
QVarLengthArray<bool> m_ramp, m_brakeActive;
QVarLengthArray<AlphaBetaFilter*> m_scratchFilters;
diff --git a/src/controllers/controlpickermenu.cpp b/src/controllers/controlpickermenu.cpp
index 566d966d4c..9f0332ab64 100644
--- a/src/controllers/controlpickermenu.cpp
+++ b/src/controllers/controlpickermenu.cpp
@@ -203,7 +203,7 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent)
addDeckControl("cue_default", tr("Cue"), tr("Cue button"), cueMenu);
addDeckControl("cue_set", tr("Set Cue"), tr("Set cue point"), cueMenu);
addDeckControl("cue_goto", tr("Go-To Cue"), tr("Go to cue point"), cueMenu);
- addDeckControl("cue_gotoandplay", tr("Go-To Cue And Play"),
+ addDeckAndSamplerAndPreviewDeckControl("cue_gotoandplay", tr("Go-To Cue And Play"),
tr("Go to cue point and play"), cueMenu);
addDeckControl("cue_gotoandstop", tr("Go-To Cue And Stop"),
tr("Go to cue point and stop"), cueMenu);
@@ -448,11 +448,11 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent)
effectUnitMenu);
addPrefixedControl(effectUnitGroup, "enabled",
tr("Toggle Unit"),
- tr("Toggle effect unit"), descriptionPrefix,
+ tr("Enable or disable effect processing"), descriptionPrefix,
effectUnitMenu, false);
addPrefixedControl(effectUnitGroup, "mix",
tr("Dry/Wet"),
- tr("Dry/Wet"), descriptionPrefix,
+ tr("Adjust the balance between the original (dry) and processed (wet) signal."), descriptionPrefix,
effectUnitMenu, true);
addPrefixedControl(effectUnitGroup, "super1",
tr("Super Knob"),
@@ -623,7 +623,7 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent)
addPrefixedControl(parameterSlotGroup, parameterSlotItemPrefix + "_link_type",
tr("Super Knob Mode"),
- tr("3-state Super Knob Link Toggle (unlinked, linear, inverse)"),
+ tr("Set how linked effect parameters change when turning the Super Knob."),
parameterDescriptionPrefix,
parameterSlotMenu);
diff --git a/src/controllers/hid/hidcontroller.cpp b/src/controllers/hid/hidcontroller.cpp
index 0ffea7b775..7175d85b93 100644
--- a/src/controllers/hid/hidcontroller.cpp
+++ b/src/controllers/hid/hidcontroller.cpp
@@ -14,6 +14,7 @@
#include "controllers/defs_controllers.h"
#include "util/compatibility.h"
#include "util/trace.h"
+#include "controllers/controllerdebug.h"
HidReader::HidReader(hid_device* device)
: QThread(),
@@ -213,17 +214,14 @@ int HidController::open() {
}
// Open device by path
- if (debugging()) {
- qDebug() << "Opening HID device"
- << getName() << "by HID path" << hid_path;
- }
+ controllerDebug("Opening HID device" << getName() << "by HID path" << hid_path);
+
m_pHidDevice = hid_open_path(hid_path);
// If that fails, try to open device with vendor/product/serial #
if (m_pHidDevice == NULL) {
- if (debugging())
- qDebug() << "Failed. Trying to open with make, model & serial no:"
- << hid_vendor_id << hid_product_id << hid_serial;
+ controllerDebug("Failed. Trying to open with make, model & serial no:"
+ << hid_vendor_id << hid_product_id << hid_serial);
m_pHidDevice = hid_open(hid_vendor_id, hid_product_id, hid_serial_raw);
}
@@ -279,7 +277,7 @@ int HidController::close() {
this, SLOT(receive(QByteArray)));
m_pReader->stop();
hid_set_nonblocking(m_pHidDevice, 1); // Quit blocking
- if (debugging()) qDebug() << " Waiting on reader to finish";
+ controllerDebug(" Waiting on reader to finish");
m_pReader->wait();
delete m_pReader;
m_pReader = NULL;
@@ -290,9 +288,7 @@ int HidController::close() {
stopEngine();
// Close device
- if (debugging()) {
- qDebug() << " Closing device";
- }
+ controllerDebug(" Closing device");
hid_close(m_pHidDevice);
setOpen(false);
return 0;
@@ -317,7 +313,7 @@ void HidController::send(QByteArray data, unsigned int reportID) {
int result = hid_write(m_pHidDevice, (unsigned char*)data.constData(), data.size());
if (result == -1) {
- if (debugging()) {
+ if (ControllerDebug::enabled()) {
qWarning() << "Unable to send data to" << getName()
<< "serial #" << hid_serial << ":"
<< safeDecodeWideString(hid_error(m_pHidDevice), 512);
@@ -325,10 +321,10 @@ void HidController::send(QByteArray data, unsigned int reportID) {
qWarning() << "Unable to send data to" << getName() << ":"
<< safeDecodeWideString(hid_error(m_pHidDevice), 512);
}
- } else if (debugging()) {
- qDebug() << result << "bytes sent to" << getName()
+ } else {
+ controllerDebug(result << "bytes sent to" << getName()
<< "serial #" << hid_serial
- << "(including report ID of" << reportID << ")";
+ << "(including report ID of" << reportID << ")");
}
}
diff --git a/src/controllers/midi/hss1394controller.cpp b/src/controllers/midi/hss1394controller.cpp
index de6ec4ab39..b1bc533459 100644
--- a/src/controllers/midi/hss1394controller.cpp
+++ b/src/controllers/midi/hss1394controller.cpp
@@ -6,6 +6,7 @@
*/
#include "controllers/midi/hss1394controller.h"
+#include "controllers/controllerdebug.h"
DeviceChannelListener::DeviceChannelListener(QObject* pParent, QString name)
: QObject(pParent),
@@ -88,9 +89,8 @@ int Hss1394Controller::open() {
return -1;
}
- if (debugging()) {
- qDebug() << "Hss1394Controller: Opening" << getName() << "index" << m_iDeviceIndex;
- }
+ controllerDebug("Hss1394Controller: Opening" << getName() << "index"
+ << m_iDeviceIndex);
using namespace hss1394;
diff --git a/src/controllers/midi/midicontroller.cpp b/src/controllers/midi/midicontroller.cpp
index 7797ea5b38..77b0d9115d 100644
--- a/src/controllers/midi/midicontroller.cpp
+++ b/src/controllers/midi/midicontroller.cpp
@@ -10,6 +10,7 @@
#include "controllers/midi/midiutils.h"
#include "controllers/defs_controllers.h"
+#include "controllers/controllerdebug.h"
#include "controlobject.h"
#include "errordialoghandler.h"
#include "playermanager.h"
@@ -93,16 +94,14 @@ void MidiController::createOutputHandlers() {
double min = mapping.output.min;
double max = mapping.output.max;
- if (debugging()) {
- qDebug() << QString(
+ controllerDebug(QString(
"Creating output handler for %1,%2 between %3 and %4 to MIDI out: 0x%5 0x%6, on: 0x%7 off: 0x%8")
- .arg(group, key,
- QString::number(min), QString::number(max),
- QString::number(status, 16).toUpper(),
- QString::number(control, 16).toUpper().rightJustified(2,'0'),
- QString::number(on, 16).toUpper().rightJustified(2,'0'),
- QString::number(off, 16).toUpper().rightJustified(2,'0'));
- }
+ .arg(group, key,
+ QString::number(min), QString::number(max),
+ QString::number(status, 16).toUpper(),
+ QString::number(control, 16).toUpper().rightJustified(2,'0'),
+ QString::number(on, 16).toUpper().rightJustified(2,'0'),
+ QString::number(off, 16).toUpper().rightJustified(2,'0')));
MidiOutputHandler* moh = new MidiOutputHandler(this, mapping);
if (!moh->validate()) {
@@ -114,7 +113,7 @@ void MidiController::createOutputHandlers() {
qWarning() << errorLog;
int deckNum = 0;
- if (debugging()) {
+ if (ControllerDebug::enabled()) {
failures.append(errorLog);
} else if (PlayerManager::isDeckGroup(group, &deckNum)) {
int numDecks = PlayerManager::numDecks();
@@ -245,10 +244,7 @@ void MidiController::receive(unsigned char status, unsigned char control,
unsigned char channel = MidiUtils::channelFromStatus(status);
unsigned char opCode = MidiUtils::opCodeFromStatus(status);
- if (debugging()) {
- qDebug() << formatMidiMessage(
- status, control, value, channel, opCode, timestamp);
- }
+ controllerDebug(formatMidiMessage(status, control, value, channel, opCode, timestamp));
MidiKey mappingKey(status, control);
@@ -508,9 +504,7 @@ QString formatSysexMessage(QString controllerName, const QByteArray& data) {
}
void MidiController::receive(QByteArray data) {
- if (debugging()) {
- qDebug() <<