Unsolved QElapsedTimer issue : code works on LINUX but not on MAC OS
-
While it's strange, I wouldn't make the success of the initialization based on such a timer.
I'd rather have a signal telling the initialization is done once you received the MIDI message(s) you need. Then you can trigger the next step of your application.
-
Thanks for the suggestion. I have thought of counting the received MIDI messages to make sure all the expected messages have been received and then trigger an even. I might go that way if i can't find a solution that avoids doing that.
-
Aren't you waiting on a set of known messages ?
-
Yes, but I wanted to avoid putting a treatment specific to the initialization process in a function that is receiving the MIDI messages during normal operation of the program.
-
You can write an initializer class that does only this and once done the messages are routed to your usual class.
-
Not so sure what you mean. Had a look on the WEB but did not find much.
The things is the MIDI reception is triggered by the MIDI lib (RTMIDI) when is callback the function it is setup to call back (MIDIcallback) and this function is not part of a class. So I would immagine that having an initializer class implies that having this MIDIcallback function inside that class. Just guessing here. -
You can pass anything you want in the userData parameter so you could use that to pass a custom Midi message handler.
In that handler you'll check the message that you receive and once you got all the initialization messages you can emit something like a "initialized" signal and then process the rest of the message normally.
-
Yes userData could be used, but it's allready used to pass the pointer to the QtMainWindow since the function send "reception" messages to a few QDialogs.
-
You can pass a custom struct that contains all the pointers to objects you need.
-
True. I though about it at one point but didn't want to bother with it at the time ... I might just have to do that.
Thanks a lot for all your help.
But in the end, it seems the initial problem ( delay() not returning ) might be specific to Qt5.5.1 on mac. I will try it out with Qt5.6. Who knows it might work. ;)