Skip to content
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

Merged
merged 10 commits into from
Dec 21, 2016
Merged

Conversation

Be-ing
Copy link
Contributor

@Be-ing Be-ing commented Sep 8, 2016

unsigned char status, unsigned char control,
unsigned char value, unsigned char channel,
unsigned char opCode, mixxx::Duration timestamp) {
QString t;
Copy link
Contributor Author

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?

Copy link
Member

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 .

@Be-ing Be-ing force-pushed the outgoing_midi_debug branch 2 times, most recently from bc410d9 to 6490153 Compare September 10, 2016 05:04
@Be-ing Be-ing force-pushed the outgoing_midi_debug branch from 6490153 to 047de0b Compare September 10, 2016 05:06
@Pegasus-RPG
Copy link
Member

For reference, the HSS1394 library code is available here: https://launchpad.net/hss1394
Code browsing: http://bazaar.launchpad.net/~mixxxdevelopers/hss1394/trunk/files

@@ -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);
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

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,
Copy link
Member

@Pegasus-RPG Pegasus-RPG Sep 10, 2016

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?

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Contributor Author

@Be-ing Be-ing Sep 10, 2016

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().

Copy link
Member

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.

@Be-ing
Copy link
Contributor Author

Be-ing commented Sep 10, 2016

@Pegasus-RPG can you test that this hasn't broken anything for HSS1394 controllers?

@Pegasus-RPG
Copy link
Member

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.)

@Be-ing
Copy link
Contributor Author

Be-ing commented Sep 10, 2016

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.

Copy link
Member

@rryan rryan left a 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);
Copy link
Member

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:"
Copy link
Member

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
Copy link
Member

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.

@Be-ing
Copy link
Contributor Author

Be-ing commented Dec 18, 2016

Thanks for reviewing. I'll get back to work on this in a bit after the new effects interface and Deere redesign.

@Be-ing Be-ing force-pushed the outgoing_midi_debug branch from 336b978 to 6e8b4d0 Compare December 20, 2016 22:18
@Be-ing
Copy link
Contributor Author

Be-ing commented Dec 21, 2016

Merge conflicts resolved.

@Be-ing Be-ing force-pushed the outgoing_midi_debug branch from 463f34d to 4d708cd Compare December 21, 2016 00:21
@rryan
Copy link
Member

rryan commented Dec 21, 2016

Thanks, LGTM

@rryan rryan merged commit 17cd046 into mixxxdj:master Dec 21, 2016
@Be-ing Be-ing deleted the outgoing_midi_debug branch February 1, 2017 01:22
esbrandt added a commit to esbrandt/manual that referenced this pull request Jun 24, 2017
``--debugAssertBreak``
``--logLevel``
``--controllerDebug``
mixxxdj/mixxx#1265
mixxxdj/mixxx/mixxxdj#118
mixxxdj/mixxx#1004
@esbrandt esbrandt mentioned this pull request Jun 24, 2017
37 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants