Skip to content

Commit

Permalink
Surrounded all std::err calls regarding message queue limit reached w…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
basshelal committed Mar 27, 2021
1 parent d2dd50d commit 97166e2
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions RtMidi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,8 +829,12 @@ static void midiInputCallback( const MIDIPacketList *list, void *procRef, void *
}
else {
// As long as we haven't reached our queue size limit, push the message.
if ( !data->queue.push( message ) )
if (!data->queue.push(message))
{
#if defined(__RTMIDI_DEBUG__)
std::cerr << "\nMidiInCore: message queue limit reached!!\n\n";
#endif
}
}
message.bytes.clear();
}
Expand Down Expand Up @@ -888,8 +892,12 @@ static void midiInputCallback( const MIDIPacketList *list, void *procRef, void *
}
else {
// As long as we haven't reached our queue size limit, push the message.
if ( !data->queue.push( message ) )
if (!data->queue.push(message))
{
#if defined(__RTMIDI_DEBUG__)
std::cerr << "\nMidiInCore: message queue limit reached!!\n\n";
#endif
}
}
message.bytes.clear();
}
Expand Down Expand Up @@ -1725,8 +1733,12 @@ static void *alsaMidiHandler( void *ptr )
}
else {
// As long as we haven't reached our queue size limit, push the message.
if ( !data->queue.push( message ) )
if (!data->queue.push(message))
{
#if defined(__RTMIDI_DEBUG__)
std::cerr << "\nMidiInAlsa: message queue limit reached!!\n\n";
#endif
}
}
}

Expand Down Expand Up @@ -2529,8 +2541,12 @@ static void CALLBACK midiInputCallback( HMIDIIN /*hmin*/,
}
else {
// As long as we haven't reached our queue size limit, push the message.
if ( !data->queue.push( apiData->message ) )
if (!data->queue.push(apiData->message))
{
#if defined(__RTMIDI_DEBUG__)
std::cerr << "\nMidiInWinMM: message queue limit reached!!\n\n";
#endif
}
}

// Clear the vector for the next input message.
Expand Down Expand Up @@ -3070,8 +3086,12 @@ static int jackProcessIn( jack_nframes_t nframes, void *arg )
}
else {
// As long as we haven't reached our queue size limit, push the message.
if ( !rtData->queue.push( message ) )
if (!rtData->queue.push(message))
{
#if defined(__RTMIDI_DEBUG__)
std::cerr << "\nMidiInJack: message queue limit reached!!\n\n";
#endif
}
}
}
}
Expand Down

0 comments on commit 97166e2

Please # to comment.