|
|
Log In | Not a Member? |
Contact ADC |
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.
Checking For Sound-Recording Equipment
Before allowing a user to record a sound, you must ensure that sound-recording hardware and software are installed. You can record sound through the microphone built into several Macintosh models, or through third-party sound input devices. Because low-level sound input device drivers handle communication between your application and the sound recording hardware, you do not need to know what type of microphone is available. Listing 1-3 defines a function that determines whether sound recording hardware is available.Listing 1-3 Determining whether sound recording equipment is available
FUNCTION MyHasSoundInput: Boolean; VAR myFeature: LongInt; myErr: OSErr; BEGIN myErr := Gestalt(gestaltSoundAttr, myFeature); IF myErr = noErr THEN {test sound input device bit} MyHasSoundInput := BTst(myFeature, gestaltHasSoundInputDevice) ELSE MyHasSoundInput := FALSE; {no sound features available} END;TheMyHasSoundInputfunction defined in Listing 1-3 uses theGestaltfunction to determine whether sound input hardware is available and usable on the current Macintosh computer.MyHasSoundInputtests thegestaltHasSoundInputDevicebit and returnsTRUEif you can record sounds.MyHasSoundInputreturnsFALSEif you cannot record sounds (either because no sound input device exists or because the Sound Input Manager is not available).
- Note
- For more information on the
Gestaltfunction, see Inside Macintosh: Operating System Utilities.![]()
Get information on Apple products.
Visit the Apple Store online or at retail locations. 1-800-MY-APPLE Copyright © 2007 Apple Inc. All rights reserved. | Terms of use | Privacy Notice |