Device creation/initialization of engines
Device creation/initialization of engines
- Subject: Device creation/initialization of engines
- From: "Sean Morrell" <email@hidden>
- Date: Tue, 16 Oct 2001 12:51:32 -0700
I'm writing a driver for an audio device where all channels of the device
must be running in the same format and sample rate. From what I can tell,
the AppleUSBAudio driver and maybe the IOKit audio classes model each
stream/channel as a separate entity with respect to format. With our
device however, any change made to the format must be done to all
channels. Additionally, the channels must be changed in a certain order.
So I need all format changes routed to the device object, rather than each
engine handling this itself. The device object will then change the
format of all channels in the device specific order. Originally I was
redirecting calls to IOAudioEngine::performFormatChange to a class derived
from IOAudioDevice. But this introduces another complexity during
initialization of the engines. It is documentated that after
initialization, the engine must be ready to provide audio services. And
part of initialization is to set the stream format. However, as described
above I cannot set the format for a stream/channel without setting it for
all channels. This requires waiting for all engine objects to be created
by the system. My first attempt was to wait (with IOSyncer) at the point
where the stream format is set, until all engines have been loaded. But
the engines must be created and initialized by the same thread, since no
other engines are created after the first engine goes into a wait state.
All of this leads me to another approach. I would like the audio device
object to create and initialize the engine objects, instead of the system
through personality matching. This would give me greater control over the
initialization phase. And makes more sense anyway, since the channels of
the device are not entirely separate entities from a control standpoint.
Now to my questions. Where would I find information or an example of a
device object creating and initializing engines? How do I obtain the USB
provider to be passed to IOAudioEngine::start(IOService*)? How do I
obtain the dictionary passed to IOAudioEngine::init(OSDictionary*)? Of
course, I would take any suggestions on getting my first approach above
working as well.
Thanks,
Sean