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

From: Jeff McClintock <jef@email-addr-hidden>
Date: Mon Feb 18 2013 - 22:18:44 EET

Message: 7

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

From: Paul Coccoli < <mailto:pcoccoli@email-addr-hidden> pcoccoli@email-addr-hidden>

 

>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

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Tue Feb 19 00:15:03 2013

This archive was generated by hypermail 2.1.8 : Tue Feb 19 2013 - 00:15:03 EET