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

From: Paul Coccoli <pcoccoli@email-addr-hidden>
Date: Mon Feb 18 2013 - 00:10:11 EET

On Sun, Feb 17, 2013 at 4:45 PM, Harry van Haaren <harryhaaren@email-addr-hidden> wrote:
>
> On Sun, Feb 17, 2013 at 9:20 PM, Paul Coccoli <pcoccoli@email-addr-hidden> wrote:
>>
>> JACK ringbuffers are
>> ideally suited to passing simple types (like floats), and not vairable
>> sized things (like different derived Event classes). Your enum for
>> event types is a bit of a red flag, too. While its perfectly valid,
>> "type flags" like this more often than not accompany inflexible,
>> tightly coupled code (which may be fine in a small audio app, but few
>> apps stay small).
>
>
> Apologies, forgot this section:
> Yes indeed all "Event" types will be contained in a single enum, and hence
> adding / removing
> events will cause a recompile. While unfortunate, I don't know how to go
> about making this
> cleaner. #define's anybody?

The only reason you need this is because you memcpy the object.
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.
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Mon Feb 18 00:15:06 2013

This archive was generated by hypermail 2.1.8 : Mon Feb 18 2013 - 00:15:06 EET