Casting ( and limiting) MIDIMessage to a 4 byte struct


#1

I need to pass the info inside MIDIMessages to a seperate process outside the JUCE app, and was thinking that since i probably dont need messages that go over 4 bytes in length ( i THINK i can just filter them out )
that i can just cast MIDIMessage class instances to a 4 byte struct. Is this safe?

My receiving ( non JUCE ) process will emulate a kind of “generic” GM2 midi module - and i reckon i dont need to receive any of the SYSEX or other string based midi messages that are over 4 bytes in length - ie variable length.

Am i wrong ?

Of course i realise i COULD just recast these structs back to MIDIMessage classes at the other end but

A) i dont think this is safe since the variable length data referenced by pointer inside the original MIDIMessage instances wont be accessible by the same pointer in a different process.

B) my non-JUCE app isnt written in C++ ! ( but can call and use C functions and structs )