-
Notifications
You must be signed in to change notification settings - Fork 299
Description
I'm developing a Java library that binds RtMidi to Java using JNA, everything so far works very well except for one issue.
Steps to reproduce the problem.
Whenever I create an RtMidiInPtr using either rtmidi_in_create() or rtmidi_in_create_default() after I send enough messages to fill the queue (RtMidi's default is 100, but set anything over 0, 0 causes a segfault later in MidiInApi::MidiQueue::push(MidiInApi::MidiMessage const&)), any further messages will print to the console MidiInAlsa: message queue limit reached!!.
Expected behavior and actual behavior.
I'm unsure if this is supposed to be a genuine error, indicating undefined behavior or just a warning, so far I have been able to do everything perfectly fine with this message printing to the console every time I send a MIDI message, so it seems to me it's more of a developer warning rather than an error, but please correct me if I'm wrong.
If I am correct I think it would be better to replace the code here:
// As long as we haven't reached our queue size limit, push the message.
if ( !data->queue.push( message ) )
std::cerr << "\nMidiInAlsa: message queue limit reached!!\n\n";with something similar to what's found elsewhere like this:
#if defined(__RTMIDI_DEBUG__)
// As long as we haven't reached our queue size limit, push the message.
if ( !data->queue.push( message ) )
std::cerr << "\nMidiInAlsa: message queue limit reached!!\n\n";
#endifThis matters because users of my library may be confused (as I was) about the severity of this error, but more importantly because it floods the console output when debugging.
I would make this change myself but I'm unsure about whether this is intentional behavior and I'm just missing something but also because I'm not very comfortable with C++.
Specifications like the version of the project, operating system, or hardware.
Release 4.0.0 built as a .so library librtmidi.so for linux-x86-64 with ALSA and JACK installed.
You can see the .so here: https://github.com/basshelal/JNARtMidi/tree/e3a761aa98a915dc1c8b98a3c6be08f94a72292d/bin/linux-x86-64
Many thanks for your efforts
😊