Important: Inside Macintosh: Sound is deprecated as of Mac OS X v10.5. For new audio development in Mac OS X, use Core Audio. See the Audio page in the ADC Reference Library.
Chapter 5 - Sound Components
This chapter describes sound components, which are code modules used by the Sound Manager to manipulate audio data or to communicate with sound output devices. Current versions of the Sound Manager allow you to write two kinds of sound components:
You need to read this chapter only if you are developing a sound output device or if you want to implement a custom compression and decompression scheme for audio data. For example, you might write a codec to handle 16-bit audio data compression and decompression. (The MACE algorithms currently compress and expand only 8-bit data at ratios of 3:1 and 6:1.)
- compression and decompression components (codecs), which allow you to implement audio data compression and decompression algorithms different from those provided by the Sound Manager's MACE (Macintosh Audio Compression and Expansion) capabilities
- sound output device components, which send audio data directly to sound output devices
To use this chapter, you should already be familiar with the general operation of the Sound Manager, as described in the chapter "Introduction to Sound on the Macintosh" in this book. Because sound components are components, you also need to be familiar with the Component Manager, described in Inside Macintosh: More Macintosh Toolbox. If you are developing a sound output device component, you need to be familiar with the process of installing a driver and handling interrupts created by your hardware device. See Inside Macintosh: Devices for complete information on devices and device drivers.
- IMPORTANT
- Sound components are loaded and managed by the Sound Manager and operate transparently to applications. Applications that want to create sounds must use Sound Manager routines to do so. The routines described in this chapter are intended for use exclusively by sound components.
If you're developing a sound output device, you might also need to write a control panel extension that installs a custom subpanel into the Sound control panel. For example, your subpanel could allow the user to set various characteristics of the sound your output device is creating. For complete information on writing control panel subpanels, see the chapter "Control Panel Extensions" in Inside Macintosh: Operating System Utilities.
This chapter begins with a general description of sound components and how they are managed by the Sound Manager. Then it provides instructions on how to write a sound component. The section "Sound Components Reference" beginning on page 5-22 describes the sound component selectors your component might need to handle and the component-defined routines that your sound component should call in response to those the sound component selectors. It also describes a small number of Sound Manager utility routines that your sound component can use.
- Note
- Pascal interfaces for sound components are not currently available. As a result, this chapter provides all source code examples and reference materials in C.
Chapter Contents
- About Sound Components
- Sound Component Chains
- The Apple Mixer
- The Data Stream
- Writing a Sound Component
- Creating a Sound Component
- Specifying Sound Component Capabilities
- Dispatching to Sound Component-Defined Routines
- Registering and Opening a Sound Component
- Finding and Changing Component Capabilities
- Sound Components Reference
- Constants
- Sound Component Information Selectors
- Audio Data Types
- Sound Component Features Flags
- Action Flags
- Data Format Flags
- Data Structures
- Sound Component Data Records
- Sound Parameter Blocks
- Sound Information Lists
- Compression Information Records
- Sound Manager Utilities
- Opening and Closing the Apple Mixer Component
- Saving and Restoring Sound Component Preferences
- Sound Component-Defined Routines
- Managing Sound Components
- Creating and Removing Audio Sources
- Getting and Setting Sound Component Information
- Managing Source Data
- Summary of Sound Components
- C Summary
- Constants
- Data Types
- Sound Manager Utilities
- Sound Component-Defined Routines
- Assembly-Language Summary
- Data Structures