Am 11.06.20 um 11:59 schrieb Kjetil Matheussen:
On Thu, Jun 11, 2020 at 11:55 AM Kjetil Matheussen
<k.s.matheussen(a)gmail.com> wrote:
On Thu, May 14, 2020 at 6:37 PM Christopher Arndt <chris(a)chrisarndt.de> wrote:
Last time I checked (2012), rtmidi allocated memory here and there
from the system in the realtime thread when sending and receiving MIDI
messages.
Yes, it's still using std::vector to store messages in:
https://github.com/thestk/rtmidi/blob/master/RtMidi.cpp#L640
If I interpret the code correctly, you could prevent allocations, if you
call
data->rtMidiIn->message.reserve(4)
in 'MidiInJack::initialize'
(
https://github.com/thestk/rtmidi/blob/master/RtMidi.cpp#L3088) and
ignore SysEx messages. The usual (or at least a common) way to use
RtMidi is to copy it into your project anway, so you can make any
changes you like to it.
BTW, I would never use 'getMessage', but attach a callback via
'RtMidiIn::setCallback'.
If you need to handle SysEx messages, you could set the maximum capacity
with 'reserve' to the size of the biggest SysEx message you expect to
handle.
Chris