As discussed in the chapter “Audio Family Design,” writing an audio driver using the Audio family requires, in object-oriented terms, that you do some certain things in your code:
Create a subclass of IOAudioDevice which, among other things, initializes the hardware and registers for sleep/wake notifications.
Create a subclass of IOAudioEngine which, among other things, initializes the I/O engine and stops and starts it.
Create, configure, and attach to the IOAudioEngine object the number of IOAudioStream and IOAudioControl objects appropriate to your driver.
Respond to value changes in the IOAudioControl objects.
In a separate code module (but as part of the IOAudioEngine subclass implementation), implement the driver’s clipping and converting routines.
This chapter will guide you through these implementation steps. It uses as a code source the SamplePCIAudioDriver example project (located in /Developer/Examples/Kernel/IOKit/Audio/Templates when you install the Developer package). In the interest of brevity, this chapter does not use all the code found in that project and strips the comments from the code. Refer to the SamplePCIAudioDriver project for the full range of code and comments on it.
Setting Up the Project
Implementing an IOAudioDevice Subclass
Implementing an IOAudioEngine Subclass
Clipping and Converting Samples
Debugging and Testing the Driver
Last updated: 2006-01-10