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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Paul Coccoli <pcoccoli@...>
Cc: <linux-audio-dev@...>
Date: Sunday, February 17, 2013 - 9:41 pm

--f46d0408d69b2e89b604d5f2796a
Content-Type: text/plain; charset=ISO-8859-1

On Sun, Feb 17, 2013 at 9:20 PM, Paul Coccoli wrote:

> This scheme sounds error prone. In general, copying C++ objects via

Nope, write them one sizeof( event->size() ) at a time.
I'm very interested in why copying C++ objects like this is a bad idea.
Its been discussed on list before (
http://linux-audio.4202.n7.nabble.com/Inter-thread-Communication-Design-...
).
This seemed to be the best simple RT safe solution. If you have suggestions
/ improvements I'd love to hear them.

JACK ringbuffers are

> What about passing pointers via the ringbuffer?

Pointers to an Event? Just makes it more hassle to send an Event from the
RT thread.
Involves taking X memory from a mem-pool, and then using placement new to
construct
the EventPlay(), and then send the pointer trough the ringbuffer. More
complicated IMO.

> To free the event objects, you could pass them back via a second

Indeed, that would be necessary. Again, more complications. That said, it
can be done,
and would involve less "traffic" trough the ringbuffer, and also "fixed
size" traffic": pointers to EventBase.

--f46d0408d69b2e89b604d5f2796a
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On Sun, Feb 17, 2013 at 9:20 PM, Paul Co=
ccoli <pcoccoli@gmail.com> wrote:
This scheme sounds error prone. =A0In general, copying C++ objects via
memcpy (or writing them 1 byte at a time into the ringbuffer, which is
what I think you're proposing) is a bad idea. =A0Nope=
, write them one =A0 sizeof( event->size() ) at a time.I'm very =
interested in why copying C++ objects like this is a bad idea.Its been =
discussed on list before (http://linux-audio=
.4202.n7.nabble.com/Inter-thread-Communication-Design-Approach-td68710.html=
).
This seemed to be the best simple RT safe solution. If you have suggestions=
/ improvements I'd love to hear them.
JACK ringbuffers are
ideally suited to passing simple types (like floats), and not vairable
sized things (like different derived Event classes). =A0Your enum for
event types is a bit of a red flag, too. =A0While its perfectly valid,
"type flags" like this more often than not accompany inflexible,<=
br>
tightly coupled code (which may be fine in a small audio app, but few
apps stay small).=A0
What about passing pointers via the ringbuffer? =A0Pointe=
rs to an Event? Just makes it more hassle to send an Event from the RT thre=
ad.Involves taking X memory from a mem-pool, and then using placement n=
ew to construct
the EventPlay(), and then send the pointer trough the ringbuffer. More comp=
licated IMO.=A0To free the event=
=A0
objects, you could pass them back via a second ringbuffer so the RT
threads aren't responsible for deleting them.
Indeed, that would be necessary. Again, more complicatio=
ns. That said, it can be done,and would involve less "traffic&quot=
; trough the ringbuffer, and also "fixed size" traffic": poi=
nters to EventBase.

--f46d0408d69b2e89b604d5f2796a--

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

Messages in current thread:
Re: [LAD] making sense of Jack MIDI; or, is this an appropri..., Harry van Haaren, (Sun Feb 17, 9:41 pm)
Re: [LAD] making sense of Jack MIDI; or, is this an appropri..., Pedro Lopez-Cabanillas, (Fri Feb 15, 5:53 pm)
Re: [LAD] making sense of Jack MIDI; or, is this an appropri..., Pedro Lopez-Cabanillas, (Sat Feb 16, 12:16 pm)
Re: [LAD] making sense of Jack MIDI; or, is this an appropri..., Pedro Lopez-Cabanillas, (Sat Feb 16, 5:22 pm)
Re: [LAD] making sense of Jack MIDI; or, is this an appropri..., Pedro Lopez-Cabanillas, (Sat Feb 16, 9:39 am)
Re: [LAD] making sense of Jack MIDI; or, is this an appropri..., Pedro Lopez-Cabanillas, (Sat Feb 16, 10:03 am)
Re: [LAD] making sense of Jack MIDI; or, is this an appropri..., Pedro Lopez-Cabanillas, (Sat Feb 16, 11:03 am)
Re: [LAD] making sense of Jack MIDI; or, is this an appropri..., Pedro Lopez-Cabanillas, (Fri Feb 15, 7:15 pm)