Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TTS in VFP
Message
From
20/02/2006 21:22:50
 
 
To
20/02/2006 19:34:27
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Environment versions
Visual FoxPro:
VFP 7
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01097628
Message ID:
01097638
Views:
13
Hello,

"This task is achieved binding with EVENTHANLDER statement the object Voice with one of its methods called ISpVoice_Word so."

ISpVoice is not an Event interface, the Word event is part of the "_ISpeechVoiceEvents" interface, you'll have to IMPLEMENT this one.

The VFP Object Browser can create a blueprint eventhandler class for you, you can drag & drop the "_ISpeechVoiceEvents" interface from the object browser's treeview into an open prg editing window and FoxPro will generate a class for you:
DEFINE CLASS myclass AS session OLEPUBLIC

	IMPLEMENTS _ISpeechVoiceEvents IN "c:\programme\gemeinsame dateien\microsoft shared\speech\sapi.dll"

	PROCEDURE _ISpeechVoiceEvents_StartStream(StreamNumber AS Number, StreamPosition AS VARIANT) AS VOID;
 				HELPSTRING "StartStream"
	* add user code here
	ENDPROC

	PROCEDURE _ISpeechVoiceEvents_EndStream(StreamNumber AS Number, StreamPosition AS VARIANT) AS VOID;
 				HELPSTRING "EndStream"
	* add user code here
	ENDPROC

	PROCEDURE _ISpeechVoiceEvents_VoiceChange(StreamNumber AS Number, StreamPosition AS VARIANT, VoiceObjectToken AS VARIANT) AS VOID;
 				HELPSTRING "VoiceChange"
	* add user code here
	ENDPROC

	PROCEDURE _ISpeechVoiceEvents_Bookmark(StreamNumber AS Number, StreamPosition AS VARIANT, Bookmark AS STRING, BookmarkId AS Number) AS VOID;
 				HELPSTRING "Bookmark"
	* add user code here
	ENDPROC

	PROCEDURE _ISpeechVoiceEvents_Word(StreamNumber AS Number, StreamPosition AS VARIANT, CharacterPosition AS Number, Length AS Number) AS VOID;
 				HELPSTRING "Word"
	* add user code here
	ENDPROC

	PROCEDURE _ISpeechVoiceEvents_Sentence(StreamNumber AS Number, StreamPosition AS VARIANT, CharacterPosition AS Number, Length AS Number) AS VOID;
 				HELPSTRING "Sentence"
	* add user code here
	ENDPROC

	PROCEDURE _ISpeechVoiceEvents_Phoneme(StreamNumber AS Number, StreamPosition AS VARIANT, Duration AS Number, NextPhoneId AS INTEGER, Feature AS VARIANT, CurrentPhoneId AS INTEGER) AS VOID;
 				HELPSTRING "Phoneme"
	* add user code here
	ENDPROC

	PROCEDURE _ISpeechVoiceEvents_Viseme(StreamNumber AS Number, StreamPosition AS VARIANT, Duration AS Number, NextVisemeId AS VARIANT, Feature AS VARIANT, CurrentVisemeId AS VARIANT) AS VOID;
 				HELPSTRING "Viseme"
	* add user code here
	ENDPROC

	PROCEDURE _ISpeechVoiceEvents_AudioLevel(StreamNumber AS Number, StreamPosition AS VARIANT, AudioLevel AS Number) AS VOID;
 				HELPSTRING "AudioLevel"
	* add user code here
	ENDPROC

	PROCEDURE _ISpeechVoiceEvents_EnginePrivate(StreamNumber AS Number, StreamPosition AS Number, EngineData AS VARIANT) AS VOID;
 				HELPSTRING "EnginePrivate"
	* add user code here
	ENDPROC

ENDDEFINE
"In the init method of the form must appear
loVoiceEngine= CREATEOBJECT("SAPI.SpVoice")
LOCAL oEvents
oEvents = NEWOBJECT("voice_methods") && generate error
EVENTHANDLER(loVoiceEngine, oEvents)"

you'll have to store the SAPI.SPVoice object and
it's eventhandler into form properties (or somewhere else where they persist).
LOCAL variables go out of scope after the method returns and
your objects will be released automatically,
which is probably not your intention.

Regards
Christian
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform