Re: AU instrument multiple instantiation issues (threading?)
Re: AU instrument multiple instantiation issues (threading?)
- Subject: Re: AU instrument multiple instantiation issues (threading?)
- From: Brian Willoughby <email@hidden>
- Date: Fri, 23 Jul 2010 05:41:02 -0700
On Jul 23, 2010, at 02:30, Jon Crooke wrote:
so i'm approaching completion of my first AU synth, and have begun
to test it in various DAWs and have discovered what must be some
kind of very large flaw in my design: it does not appear to support
multiple instantiation correctly. this is not something i
previously thought would be an issue, but it seems that i must have
been entirely wrong about this. the issue:
single instantiation of the instrument works fine, however a second
instantiation causes stuttering of the audio. instantiating a
second instrument fires up the second core, so clearly they are
running on separate threads. it seems like the issue is accessing
the instrument's wavetables, however, shouldn't these
instantiations and their data be entirely separate processes?
internally the instrument has static class methods for accessing
this data, so i am aware that this is a threading bottleneck, but
since the instrument itself is only single threaded i didn't expect
this to be an issue.
In the strictest programming definition of "process," you've got it
backwards. The AU host is one process, and all of the AudioUnits in
one host will be part of that one process. Not only that, but the
entire AU graph in a host is historically run on a single thread
within the host process. Any threading must be of your own creation.
I'm fairly certain that you cannot use static class data, at least
not if that data involves state which can change.
If you design your classes from the mindset of a single process and
single thread, then your AU should work properly in every host. Just
don't make the mistake of assuming that you can depend upon a single
process and single thread, especially for communication between
engine and UI. Perhaps that is where your confusion originates: We
often discuss the required separation between AU engine and UI,
pointing out that they may run in a separate process, but that is no
indication that two instances of the engine will always run in
separate processes. The two questions are actually completely
independent.
Brian Willoughby
Sound Consulting
_______________________________________________
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