[LAD] making sense of Jack MIDI; or, is this an appropriate use

Jeff McClintock jef at synthedit.com
Mon Feb 18 20:18:44 UTC 2013


Message: 7

Date: Sun, 17 Feb 2013 17:10:11 -0500

From: Paul Coccoli < <mailto:pcoccoli at gmail.com> pcoccoli at gmail.com>

 

>You're effectively serializing your object and passing them over the
ringbuffer.  If you do it this way, you should at least consider explicitly
embedding the type and length as the first member of EventBase (and have
each derived class set their own type and length in their constructors), and
reading those before touching the object you read.

 

Very good, that's what I do. The event is serialised to the ringbuffer, one
member at a time (so I don't rely on a particular memory layout, or padding.
The Type of message and the length are the first two values. (this example
sends some text to the GUI to display a message box)..

       my_output_stream& strm = MessageQueToGui();

 

       strm << id_to_long("mbox");

       strm << (int) ( sizeof(wchar_t) * msg.size() + sizeof(int) +
sizeof(icontype)); // message length.

       strm << msg;

       strm << icontype;

 

 

Jeff

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-dev/attachments/20130219/ad8a85ee/attachment.html>


More information about the Linux-audio-dev mailing list