-
Notifications
You must be signed in to change notification settings - Fork 275
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
Surrounded all std::err calls regarding message queue limit reached with debug check to prevent flooding of output console #244
base: master
Are you sure you want to change the base?
Conversation
…ith a #if defined(__RTMIDI_DEBUG__) in order to prevent console flooding when message queue limit is reached, this fixes the issue I filed here: thestk#236
It seems to me that overfilling the queue is a fairly big problem, as messages are then discarded. While printing a message about that problem to std::cerr is perhaps not the best option, I don't think I would want to hide it behind a RTMIDI_DEBUG flag, as most people probably don't compile with that defined. The point is that the user/developer should attempt to keep the queue as empty as possible, no? I took a quick look at issue #236 but it seems to me the problem reported there is more related to usage than a problem with RtMidi. It would be nice if this "error" could be reported through an error callback function but it might take some work to allow that to happen (since it is inside a system callback). |
Thanks for the clarification and for getting back to me. If the queue is so important, then yes I agree, hiding it behind the debug flag is a bad idea. A question regarding the queue though: How is the queue important from an API point of view, particularly the C interface (I'm building bindings using the C interface)? From what I could gather, it is only useful for C API users in I ask because my bindings don't implement If I am right and the queue is only useful for C interface users in I'll probably have to solve this issue by making users of my bindings have a flag to suppress the output messages of RtMidi. I use JNR to do the Java to native (C) calling so I'll have to figure out some way to hide these queue messages from the Java console. |
The end user usually can't empty the queue in time. So the people to address are the developers. The best thing RtMidi can do is to inform the calling software. Flooding the logs is never a good idea. If the real cause for the queue overflow is reported it will easily get lost or overseen. |
I'm not sure what @keinstein is suggesting in the previous comment. To me, the end users of RtMidi are the developers. And why can't people empty the queue in time? The queue can be made larger if that seems to be a problem, though personally I would use the callback scheme rather than the queue if I was developing a MIDI program. |
I'm suggesting to report to the calling software and not to the user of that software. RtMidi is often hidden in some interactive GUI. The end users usually don't see any messages regarding the queue. In their opinion the software should handle these issues (like increasing buffers etc.). But the software dosn't know about the problem because the problem is reported to the end user bypassing the software and thus bypassing the influence area of the developer. I see only two solutions: Error callbacks or error flags. @garyscavone I agree with you, that callbacks more follow the realtime paradigm. The queue comes into play when developers don't need exact timing and don't want or can't restrict themselves to functions with predictable run time. Especially JACK is very picky when it comes to violations of the time constraints. |
Fixes #236
Surrounded all std::err calls regarding message queue limit reached with a #if defined(RTMIDI_DEBUG) in order to prevent console flooding when message queue limit is reached.
I filed this issue a while back and no one responded to me whether I was correct or not in my observations/assumptions so I took matters to my own hands.