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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-audio-dev@...>
Date: Monday, February 18, 2013 - 8:19 pm

This is a multi-part message in MIME format.

------=_NextPart_000_0022_01CE0E82.1DE2C020
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

Message: 7

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

From: Paul Coccoli < pcoccoli@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

------=_NextPart_000_0022_01CE0E82.1DE2C020
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Message: 7Date: Sun, 17 Feb 2013 17:10:11 =
-0500From: Paul Coccoli <pcoccoli@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 =3D =
MessageQueToGui();        strm =
<< id_to_long("mbox");       strm =
<< (int) ( sizeof(wchar_t) * msg.size() + sizeof(int) + sizeof(icontype)); // message length.       strm =
<< msg;       strm =
<< icontype;  Jeff
------=_NextPart_000_0022_01CE0E82.1DE2C020--

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]