-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Outgoing MIDI debugging messages #1004
Changes from all commits
8fcf96c
6aa4607
258556e
653136a
047de0b
f698d84
6033525
6d9f433
6e8b4d0
4d708cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,6 +85,9 @@ void Controller::send(QList<int> data, unsigned int length) { | |
// If you change this implementation, also change it in HidController (That | ||
// function is required due to HID devices having report IDs) | ||
|
||
// The length parameter is here for backwards compatibility for when scripts | ||
// were required to specify it. | ||
length = data.size(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. length is not used before, I think you can remove the parameter. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is Q_INVOKABLE. The length parameter has been required for scripts, so I'm leaving it for backwards compatibility. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll add a comment to clarify that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aaaa. wait. or you could use the minimum of both, to keep the old functionality. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think the |
||
QByteArray msg(length, 0); | ||
for (unsigned int i = 0; i < length; ++i) { | ||
msg[i] = data.at(i); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
* @brief HSS1394-based MIDI backend | ||
*/ | ||
|
||
#include "controllers/midi/midiutils.h" | ||
#include "controllers/midi/hss1394controller.h" | ||
#include "controllers/controllerdebug.h" | ||
#include "util/time.h" | ||
|
@@ -168,18 +169,15 @@ int Hss1394Controller::close() { | |
return 0; | ||
} | ||
|
||
void Hss1394Controller::sendWord(unsigned int word) { | ||
unsigned char data[3]; | ||
data[0] = word & 0xFF; | ||
data[1] = (word >> 8) & 0xFF; | ||
data[2] = (word >> 16) & 0xFF; | ||
|
||
QString message = QString("%1 %2 %3").arg( | ||
QString("%1").arg(data[0], 2, 16, QChar('0')), | ||
QString("%1").arg(data[1], 2, 16, QChar('0')), | ||
QString("%1").arg(data[2], 2, 16, QChar('0'))); | ||
void Hss1394Controller::sendShortMsg(unsigned char status, unsigned char byte1, | ||
unsigned char byte2) { | ||
unsigned char data[3] = { status, byte1, byte2 }; | ||
|
||
int bytesSent = m_pChannel->SendChannelBytes(data, 3); | ||
controllerDebug(MidiUtils::formatMidiMessage(getName(), | ||
status, byte1, byte2, | ||
MidiUtils::channelFromStatus(status), | ||
MidiUtils::opCodeFromStatus(status))); | ||
|
||
//if (bytesSent != 3) { | ||
// qDebug()<<"ERROR: Sent" << bytesSent << "of 3 bytes:" << message; | ||
|
@@ -191,6 +189,7 @@ void Hss1394Controller::send(QByteArray data) { | |
int bytesSent = m_pChannel->SendChannelBytes( | ||
(unsigned char*)data.constData(), data.size()); | ||
|
||
controllerDebug(MidiUtils::formatSysexMessage(getName(), data)); | ||
//if (bytesSent != length) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Pegasus-RPG why is this commented out? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't remember. Am I listed as the last person to touch that line? If so, maybe the HSS1394 spec said that it wasn't implemented and always returns 0 or something. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that line hasn't been modified since you created the file. If the hss1394 library actually does indicate an error somehow, it would be good to handle that. |
||
// qDebug()<<"ERROR: Sent" << bytesSent << "of" << length << "bytes (SysEx)"; | ||
// //m_pChannel->Flush(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,6 @@ | |
#include "controllers/midi/midimessage.h" | ||
#include "controllers/midi/midioutputhandler.h" | ||
#include "controllers/softtakeover.h" | ||
#include "util/duration.h" | ||
|
||
class MidiController : public Controller { | ||
Q_OBJECT | ||
|
@@ -57,11 +56,15 @@ class MidiController : public Controller { | |
unsigned char value); | ||
|
||
protected: | ||
Q_INVOKABLE void sendShortMsg( | ||
unsigned char status, unsigned char byte1, unsigned char byte2); | ||
Q_INVOKABLE virtual void sendShortMsg(unsigned char status, | ||
unsigned char byte1, unsigned char byte2) = 0; | ||
|
||
// Alias for send() | ||
Q_INVOKABLE inline void sendSysexMsg(QList<int> data, unsigned int length) { | ||
send(data, length); | ||
// The length parameter is here for backwards compatibility for when scripts | ||
// were required to specify it. | ||
Q_INVOKABLE inline void sendSysexMsg(QList<int> data, unsigned int length = 0) { | ||
Q_UNUSED(length); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same here, all the length and int to char looks scary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was wondering that as well, but I am being careful not to break the QtScript interface. I could try making sendSysexMsg accept a QByteArray and test if it works. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's because QtScript passes the data as a QList. It was quite difficult getting this translation to work properly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @daschuer QtScript can't pass us anything other than a list of ints, so that's why. The length argument was always unnecessary (and error prone) because the real length is already stored in the list itself. I can't remember if QtScript will drop extra arguments when calling C++ objects. Javascript certainly will if you're calling a normally JS function with more arguments than it expects. @Be-ing did you test that? We have a more efficient ByteArray class available to scripts that we use for passing bytearrays into the script engine: |
||
send(data); | ||
} | ||
|
||
protected slots: | ||
|
@@ -89,7 +92,6 @@ class MidiController : public Controller { | |
const QByteArray& data, | ||
mixxx::Duration timestamp); | ||
|
||
virtual void sendWord(unsigned int word) = 0; | ||
double computeValue(MidiOptions options, double _prevmidivalue, double _newmidivalue); | ||
void createOutputHandlers(); | ||
void updateAllOutputs(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should also mention this in the header definition of send() and belongs in the header at the definition of Controller::send and MidiController::sendSysexMessage.