-
-
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
Conversation
unsigned char status, unsigned char control, | ||
unsigned char value, unsigned char channel, | ||
unsigned char opCode, mixxx::Duration timestamp) { | ||
QString t; |
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.
Any suggestions for a better variable name here?
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.
Not really. .. "msg2" or something that is not "time" related .
bc410d9
to
6490153
Compare
and fix some spacing
6490153
to
047de0b
Compare
For reference, the HSS1394 library code is available here: https://launchpad.net/hss1394 |
@@ -51,7 +51,8 @@ class Hss1394Controller : public MidiController { | |||
virtual int close(); | |||
|
|||
private: | |||
void sendWord(unsigned int word); | |||
void sendShortMsg(unsigned char status, unsigned char byte1, | |||
unsigned char byte2); |
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.
What gain is there in eliminating the ability to send data words?
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.
The way it was before, with sendShortMsg() passing the computed word to sendWord(), the sendWord() function that actually did the sending would have to undo the operations of sendShortMsg() to print the three separate MIDI bytes.
https://github.com/mixxxdj/mixxx/pull/1004/files#diff-0212d99488d889be2b8194be8f10eed0R178
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.
That may be the case in HSS1394Controller, but not in PortMidiController. https://github.com/mixxxdj/mixxx/pull/1004/files#diff-ab47417f917c4a5cea304eded0d68381R213
I guess it doesn't much matter since there's no engine.sendWord() function for scripts.
and minor code formatting
unsigned char status, unsigned char control, | ||
unsigned char value, unsigned char channel, | ||
unsigned char opCode, mixxx::Duration timestamp) { | ||
QString MidiController::formatMidiMessage(const QString& controllerName, |
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'm curious why you've added the class name to the definitions. Isn't it implied?
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.
No, it isn't implied. That was actually confusing me for a bit before I got help in ##c++-basic on Freenode. I was getting a linker error when I added it to the class as a protected member function but didn't add the class name to the definition.
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.
How were you able to build before then?
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.
It wasn't in the header. It was only defined in the .cpp file, but I had to make it a protected member of the class to reuse it in PortMidiController::sendShortMsg() and Hss1394Controller::sendShortMsg().
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.
Nit: since formatMidiMessage/formatSysexMessage don't use any member variables/methods of MidiController, they could move to MidiUtils (src/controllers/midi/midiutils.h). Would be cleaner that way.
@Pegasus-RPG can you test that this hasn't broken anything for HSS1394 controllers? |
I can, but it may be a few days. In the meantime, can you create test fixtures that create virtual HSS1394 controllers and I'll populate them with MIDI data and expected results? (I'm still new to creating tests.) |
I'll look into it, but a lot of the PortMidiController tests are segfaulting on my system (on this branch and master), so I'm not sure I'll figure out how to set it up right. I did notice Travis is having trouble compiling tests on this branch, so I'll look into that as well. |
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.
This will be a big help for script authors, thanks for working on it.
RE: HSS1394, this looks like a safe change to me.
status, byte1, byte2, | ||
MidiUtils::channelFromStatus(status), | ||
MidiUtils::opCodeFromStatus(status)) | ||
<< "\nPortMidi error:" << Pm_GetErrorText(err); |
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.
On Windows it's \r\n. Instead I would either keep them on the same line or make a separate qWarning if you want it on a separate line (I don't think QtDebug supports std::endl).
if (err != pmNoError) { | ||
if (err == pmNoError) { | ||
controllerDebug(formatSysexMessage(getName(), data)); | ||
} else { | ||
qWarning() << "PortMidi sendSysexMsg error:" |
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.
Do you want to print the formatted message on error here too?
@@ -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 |
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.
Thanks for reviewing. I'll get back to work on this in a bit after the new effects interface and Deere redesign. |
… to MidiUtils plus miscellaneous small fixes
336b978
to
6e8b4d0
Compare
Merge conflicts resolved. |
463f34d
to
4d708cd
Compare
Thanks, LGTM |
``--debugAssertBreak`` ``--logLevel`` ``--controllerDebug`` mixxxdj/mixxx#1265 mixxxdj/mixxx/mixxxdj#118 mixxxdj/mixxx#1004
implements https://bugs.launchpad.net/mixxx/+bug/1473695