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 Speech Capabilities
Because the Speech Manager is not available in all system software versions, your application should always check for speech capabilities before attempting to use them. Listing 1-7 defines a function that determines whether the Speech Manager is available.Listing 1-7 Checking for speech generation capabilities
FUNCTION MyHasSpeech: Boolean; VAR myFeature: LongInt; {feature being tested} myErr: OSErr; BEGIN myErr := Gestalt(gestaltSpeechAttr, myFeature); IF myErr = noErr THEN {test Speech Manager-present bit} MyHasSpeech := BTst(myFeature, gestaltSpeechMgrPresent) ELSE MyHasSpeech := FALSE; {no speech features available} END;TheMyHasSpeechfunction defined in Listing 1-7 uses theGestaltfunction to determine whether the Speech Manager is available. TheMyHasSpeechfunction tests the gestaltSpeechMgrPresent bit and returnsTRUEif and only if the Speech Manager is present. If theGestaltfunction cannot obtain the desired information and returns a result code other thannoErr, theMyHasSpeechfunction assumes that the Speech Manager is not available and therefore returnsFALSE.