home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-09-02 | 2.3 KB | 70 lines | [TEXT/MPS ] |
- PROCEDURE TTextEntryDialog.GetTextBBAtItemBB(VAR theText:Str255;ItemNo:INTEGER);
- VAR
- CharIndex , theType:INTEGER;(* gives the type of the item requested *)
- theTextHdl:Handle;(* gives a handle to the item *)
- txtBox:Rect;(* gives the display rectangle of the item *)
- theChannel: SpeechChannel;
- theVoiceSpecPtr: VoiceSpecPtr;
- theVoiceSpec: VoiceSpec;
-
-
-
- myErr: OSErr;
- finalTicks,textlen,delayLen: LONGINT;
- theTextPtr:Ptr;
- {
- Comment on string lengths:
- Pasted from Spinside mac
- Toolbox utilities:
- String 'STR ' m bytes The string (1-byte length
- followed by the characters)
- THE MEMORY MANAGER
- Str255 = STRING[255];
- My remarks (PMS):
- 8bits specify 2^8=256 possibilities (less one possibility of string 0 length) or 255
- }
- voiceCount:integer;
- BEGIN
-
- {Standard calls to get text from a dialogue box I made:}
-
- GetDItem (fDialog, ItemNo, theType, theTextHdl, txtBox);
- GetIText (theTextHdl, theText);
-
- {Following are speech commands,
- Put speech.p in Lab 7 folder,
- so PMake would see it without too much auxiliary scripting:}
-
- {Some sort of initialization needed even if not do loop of all:}
- myErr := CountVoices (voiceCount);
-
- {Type transfer from generic pointer:}
- theVoiceSpecPtr := VoiceSpecPtr(@theVoiceSpec);
-
- {Liked the deep voice, most like Schwartznegger's:}
- myErr := GetIndVoice (6, theVoiceSpecPtr);
- myErr := NewSpeechChannel (theVoiceSpecPtr, theChannel);
-
-
- {Note: @theText= @theText[0] would tell length of text, since theText:Str255,
- so we use @theText[1] to start reading where we want to below:}
- theTextPtr:=Ptr(@theText[1]);
-
- {Since we started reading at the right byte, we have the expected text length:}
- textlen:=Ord4(LENGTH(theText));
-
- {OK now we have set up and it can speak:}
- myErr := SpeakText (theChannel,theTextPtr,textlen);
-
- {The need for the following wait loop shows
- that statements following speech
- can happen concurrently, that is,
- are immediately executed during speech!
- Don't want to dispose his speech while the speaker is speaking!}
-
- while (NOT (SpeechBusy = 0)) do
- Delay(15, delayLen);
- myErr := DisposeSpeechChannel (theChannel);
-
- END;
-