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;TheMyHasSpeech
function defined in Listing 1-7 uses theGestalt
function to determine whether the Speech Manager is available. TheMyHasSpeech
function tests the gestaltSpeechMgrPresent bit and returnsTRUE
if and only if the Speech Manager is present. If theGestalt
function cannot obtain the desired information and returns a result code other thannoErr
, theMyHasSpeech
function assumes that the Speech Manager is not available and therefore returnsFALSE
.