Re: MusicEventIterator questions
Re: MusicEventIterator questions
- Subject: Re: MusicEventIterator questions
- From: Ross Bencina <email@hidden>
- Date: Wed, 20 Mar 2013 03:26:07 +1100
On 20/03/2013 1:05 AM, Paul Davis wrote:
On Tue, Mar 19, 2013 at 7:42 AM, Ross Bencina
<email@hidden <mailto:email@hidden>> wrote:
Hi Aran,
I agree with Paul that if the idea is to have a single mutable data
structure that is accessible from multiple threads that's kind of hard.
But the way I would do it is have two single-threaded data
structures and propogate changes via a FIFO:
there is an alternate approach too that also uses a FIFO. the "audio"
thread (running in an RT context, the one where rendering is done)
doesn't need to know about anything that, well, anything that it doesn't
need to know about. it only cares about "now", meaning specific data
required to render audio for the current block of time.
Modulo some "schedule ahead" extra safety margin. You're basically
trading latency for ease of implementation.
so you can leave your fancy-pants data structure in non-RT land, and
just make sure that a "linearized" version of gets pushed into a FIFO
where the audio thread can pull from. that way, you can use mutexes or
whatever synchronization mechanisms you want in non-RT land, and the
audio thread just gets a simplified, accurate, "windowed" snapshot of it
to use for rendering.
This requires to choose the window length correctly. It needs to be long
enough to anticipate any disruption in the non-real-time context, and
short enough to retain interactive response.
This is going to work better for some kind of applications than others.
of course, this gets complex when you jump around on the timeline and
have to refill the FIFO correctly,
It also gets difficult if you want to have lowest latency MIDI control
over algorithmic sequence generation (for example).
That said, it's what Supercollider3 does (splits lang and even
scheduling into a seperate thread from audio).
and in this sense, Ross' idea has a
different kind of simplicity on its side.
It's definitely a "kind of" simplicity :)
Ross.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden