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 2 - Sound Manager
This chapter describes the Sound Manager, the part of the Macintosh system software that controls the production and manipulation of sounds on Macintosh computers. You can use the Sound Manager to create a wide variety of sounds and to manipulate sounds in many ways. The Sound Manager is also used by other parts of the Macintosh system software that produce sounds, such as the Speech Manager and QuickTime.To use this chapter, you should already be familiar with the information in the chapter "Introduction to Sound on the Macintosh" earlier in this book, especially with the portions of that chapter that describe the Macintosh sound architecture and the routines related to sound output. That chapter shows how your application can play a sound resource or a sound file synchronously (that is, with other processing suspended while the sound plays).
You should read this chapter if you need a greater degree of control over sound output than the routines described in that introductory chapter provide. For example, if you want to play sounds asynchronously or to exercise very fine control over the process of sound production, this chapter contains information you need.
This chapter begins by describing the capabilities of the Sound Manager and the role of sound commands and sound channels in producing sound. Then it explains how you can use the Sound Manager to
You're not likely to use all of these capabilities in a single application. In general, you should read the section "About the Sound Manager" and then turn to the parts of the section "Using the Sound Manager" that describe the features you want to use in your application. The section "Sound Storage Formats" beginning on page 2-73 explains in detail the format of sound resources and sound files. You can find a complete reference to the Sound Manager data structures and routines in the section "Sound Manager Reference" beginning on page 2-89.
- create and manage sound channels
- obtain information about available sound features and sound channels
- play notes and other sounds at various frequencies and volumes
- play one or more sounds asynchronously
- parse sound resources and sound files to obtain information about them
- compress and expand sound data
- use double buffers to bypass the normal play-from-disk routines
- IMPORTANT
- This chapter describes the capabilities and programming interfaces of version 3.0 of the Sound Manager. See the chapter "Introduction to Sound on the Macintosh" for some information on how version 3.0 differs from earlier versions. The capabilities and performance of version 3.0 are significantly better than those of all previous Sound Manager versions, even though their programming interfaces are largely identical. This chapter occasionally warns you about techniques or routines that cannot be used in versions prior to 3.0, but it does not provide an exhaustive comparison of all available versions.
Chapter Contents
- About the Sound Manager
- Sound Data
- Square-Wave Data
- Wave-Table Data
- Sampled-Sound Data
- Sound Commands
- Sound Channels
- Sound Compression and Expansion
- Using the Sound Manager
- Managing Sound Channels
- Allocating Sound Channels
- Initializing Sound Channels
- Releasing Sound Channels
- Manipulating a Sound That Is Playing
- Stopping Sound Channels
- Pausing and Restarting Sound Channels
- Synchronizing Sound Channels
- Managing Sound Volumes
- Obtaining Sound-Related Information
- Obtaining Information About Available Sound Features
- Obtaining Version Information
- Testing for Multichannel Sound and Play-From-Disk Capabilities
- Obtaining Information About a Single Sound Channel
- Obtaining Information About All Sound Channels
- Determining and Changing the Status of the System Alert Sound
- Playing Notes
- Installing Voices Into Channels
- Looping a Sound Indefinitely
- Playing Sounds Asynchronously
- Using Callback Procedures
- Synchronizing Sound With Other Actions
- Managing an Asynchronous Play From Disk
- Playing Selections
- Managing Multiple Sound Channels
- Parsing Sound Resources and Sound Files
- Obtaining a Pointer to a Sound Header
- Playing Sounds Using Low-Level Routines
- Finding a Chunk in a Sound File
- Compressing and Expanding Sounds
- Using Double Buffers
- Setting Up Double Buffers
- Writing a Doubleback Procedure
- Sound Storage Formats
- Sound Resources
- The Format 1 Sound Resource
- The Format 2 Sound Resource
- Sound Files
- Chunk Organization and Data Types
- The Form Chunk
- The Format Version Chunk
- The Common Chunk
- The Sound Data Chunk
- Format of Entire Sound Files
- Sound Manager Reference
- Constants
- Gestalt Selector and Response Bits
- Channel Initialization Parameters
- Sound Command Numbers
- Chunk IDs
- Data Structures
- Sound Command Records
- Audio Selection Records
- Sound Channel Status Records
- Sound Manager Status Records
- Sound Channel Records
- Sound Header Records
- Extended Sound Header Records
- Compressed Sound Header Records
- Sound Double Buffer Header Records
- Sound Double Buffer Records
- Chunk Headers
- Form Chunks
- Format Version Chunks
- Common Chunks
- Extended Common Chunks
- Sound Data Chunks
- Version Records
- Leftover Blocks
- State Blocks
- Sound Manager Routines
- Playing Sound Resources
- Playing From Disk
- Allocating and Releasing Sound Channels
- Sending Commands to a Sound Channel
- Obtaining Information
- Controlling Volume Levels
- Compressing and Expanding Audio Data
- Managing Double Buffers
- Performing Unsigned Fixed-Point Arithmetic
- Linking Modifiers to Sound Channels
- Application-Defined Routines
- Completion Routines
- Callback Procedures
- Doubleback Procedures
- Resources
- The Sound Resource
- Summary of the Sound Manager
- Pascal Summary
- Constants
- Data Types
- Sound Manager Routines
- Application-Defined Routines
- C Summary
- Constants
- Data Types
- Sound Manager Routines
- Application-Defined Routines
- Assembly-Language Summary
- Data Structures
- Trap Macros
- Result Codes