/* Get user's choice of speech engine, and save its ID. */ id = SpeechVoiceDlg() IF id == "" THEN DO SAY "Error getting speech device ID, or user cancelled" RETURN ENDIf the user selects a particular engine (ie, he didn't cancel, nor was there an error), then SpeechVoiceDlg() returns the id that you will pass to SpeechOpen() as so:
/* Get user's choice of speech engine, and save its ID. */ id = SpeechVoiceDlg() IF id == "" THEN DO SAY "Error getting speech device ID, or user cancelled" RETURN END /* Open that speech engine, and save its voice parameter. */ voice = SpeechOpen(id) IF voice == "" THEN DO SAY "Error opening/initializing the speech voice!" RETURN END /* Here you may now call other REXX Speech functions. */If successful, SpeechOpen() will open/initialize that voice and return the voice parameter to it. You may then call other REXX Speech functions, passing that voice parameter.
When done using the speech engine, you should close it with a call to SpeechClose() as so:
/* Close the speech engine. */ SpeechClose(voice)
If you simply wish to open and use the default speech device on a system (instead of making the user choose one), then simply omit the first argument passed to SpeechOpen(). In that case, SpeechOpen() will open/initialize the default speech engine and return its voice parameter as so:
/* Open the default speech engine, and save its voice parameter. */ voice = SpeechOpen() IF voice == "" THEN DO SAY "Error opening/initializing the default speech voice!" RETURN END /* Here you may now call other REXX Speech functions. */