Tom, Thanks. Now, I understand the reason why which makes sense to me.
Our software offers a feature called "recording" where the content of a midi event is presented to the user for manipulating, changable by tools etc. E.g. for a Note_On event the user can change the velocity of a single note resp. a single Note_On midi event. For sysex events advanced users can manipulate the sysex event content as well. So far, for recording we use the Windows mmeapi interface as midi input interface. Currently, we enhance the software with the jack interface where we also use fluidsynth's jack capabilities. The feature for the user is the perform the same recording for jack which is available from the Windows mmeapi software. This lead to the question how to access sysex events when a midi events comes in from the fluid jack midi input. The relevant buffer sizes are pretty small (max. ~ 30 bytes). A typical user scenario for a Yamaha keyboard user is to switch instruments on his keyboard where in addition to a controller change and program change sysex events determine the changed sound. In those scenarios the longest sysex event which I have ever seen is in those ~30 bytes range. For the time being we have created a trivial workaround by casting the equivalent fluid_midi_event_t structure and accessing paramptr and the param1 for the length. I understand that a general solution is more complex and would be an overkill for our needs. Our workaround is so simple that we can live with that. Reinhold -----Ursprüngliche Nachricht----- Von: Tom M. [mailto:tom.m...@googlemail.com] Gesendet: Mittwoch, 12. Oktober 2022 17:54 An: FluidSynth mailing list; Reinhold Hoffmann Betreff: Re: [fluid-dev] Missing function fluid_midi_event_get_sysex I think I've seen this question already 4 years ago. I didn't know back then why it was done that way, neither do I know now. I assumed that this function wasn't made public because fluidsynth is not supposed to be a MIDI parser. Particularly, there is an internal MIDI parser, but this one has a limited buffer, causing potentially too long SysEx messages to be cut off: https://github.com/FluidSynth/fluidsynth/blob/1fc6f0935bacc6fb3e38b7bebe8b24 f6cf110dab/src/midi/fluid_midi.c#L2744-L2749 This "parser" may or may not be used depending on where the fluid_midi_event_t is coming from. I understand that there is a corresponding setter function fluid_midi_event_set_sysex(), but unfortunately, this function is broken by design: A dynamically malloc()ed and user provided buffer could be freed internally by fluidsynth's version of free(). Allocating some data in one domain, carrying it in a different domain and freeing it with different means could lead to heap corruption, when two different memory runtimes are in use. This is a common problem on Windows. So my question would be, for what purpose you intend to use fluid_midi_event_get_sysex()? And whether or not you would be happy only getting the first 1024 bytes of the SysEx message? Tom _______________________________________________ fluid-dev mailing list fluid-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/fluid-dev