For wine we have to install Sapi5, if not exist. To do this use this in linux terminal: winetricks speechsdk
The difficult part was the number and the wrap in screen. Text is written word by word as object sp (an SAPI.SpVoice) speak words. Scrolling happen normally after last line. Symbols like comma and parenthesis can't displayed (are not words).
New M2000 version need for each parameter of an event handler function, for COM objects, to use & for ByRef or as-is a variable fo ByValue pass. Old versions have to use always by ref (using &). So here we have all passing by value for working with Version 10.
The difficult part was the number and the wrap in screen. Text is written word by word as object sp (an SAPI.SpVoice) speak words. Scrolling happen normally after last line. Symbols like comma and parenthesis can't displayed (are not words).
New M2000 version need for each parameter of an event handler function, for COM objects, to use & for ByRef or as-is a variable fo ByValue pass. Old versions have to use always by ref (using &). So here we have all passing by value for working with Version 10.
Module
UsingEvents {
Form 60, 32
Declare WithEvents sp "SAPI.SpVoice"
That$={Rosetta Code is a programming chrestomathy site.
The idea is to present solutions to the same task in as many different languages as possible, to demonstrate how languages are similar and different, and to aid a person with a grounding in one approach to a problem in learning another. Rosetta Code currently has 913 tasks, 214 draft tasks, and is aware of 707 languages, though we do not (and cannot) have solutions to every task in every language.}
EndStream=False
LastPosition=-1
TxtWidth=0
Function sp_Word {
Read New StreamNumber, StreamPosition, CharacterPosition, Length
Rem: Print StreamNumber, StreamPosition , CharacterPosition, Length
If LastPosition=CharacterPosition Then exit
LastPosition=CharacterPosition
Local f$=" "
If TxtWidth=CharacterPosition+length Then f$=". "
If length+pos+2>width then Print
Print Mid$(That$, CharacterPosition+1, Length);f$;
If f$=". " Then Print
Refresh
}
Function sp_EndStream {
Refresh
EndStream=True
}
Function sp_Sentence {
Read New StreamNumber, StreamPosition, CharacterPosition, Length
if Length>0 and not CharacterPosition=0 then Print
Print " ";
TxtWidth=CharacterPosition+Length-1
}
Const SVEEndInputStream = 4
Const SVEWordBoundary = 32
Const SVESentenceBoundary = 128
Const SVSFlagsAsync = 1&
With sp, "EventInterests", SVEWordBoundary+SVEEndInputStream+SVESentenceBoundary
Method sp, "Speak", That$, SVSFlagsAsync
While Not EndStream {Wait 10}
Wait 100
}
UsingEvents
Form 60, 32
Declare WithEvents sp "SAPI.SpVoice"
That$={Rosetta Code is a programming chrestomathy site.
The idea is to present solutions to the same task in as many different languages as possible, to demonstrate how languages are similar and different, and to aid a person with a grounding in one approach to a problem in learning another. Rosetta Code currently has 913 tasks, 214 draft tasks, and is aware of 707 languages, though we do not (and cannot) have solutions to every task in every language.}
EndStream=False
LastPosition=-1
TxtWidth=0
Function sp_Word {
Read New StreamNumber, StreamPosition, CharacterPosition, Length
Rem: Print StreamNumber, StreamPosition , CharacterPosition, Length
If LastPosition=CharacterPosition Then exit
LastPosition=CharacterPosition
Local f$=" "
If TxtWidth=CharacterPosition+length Then f$=". "
If length+pos+2>width then Print
Print Mid$(That$, CharacterPosition+1, Length);f$;
If f$=". " Then Print
Refresh
}
Function sp_EndStream {
Refresh
EndStream=True
}
Function sp_Sentence {
Read New StreamNumber, StreamPosition, CharacterPosition, Length
if Length>0 and not CharacterPosition=0 then Print
Print " ";
TxtWidth=CharacterPosition+Length-1
}
Const SVEEndInputStream = 4
Const SVEWordBoundary = 32
Const SVESentenceBoundary = 128
Const SVSFlagsAsync = 1&
With sp, "EventInterests", SVEWordBoundary+SVEEndInputStream+SVESentenceBoundary
Method sp, "Speak", That$, SVSFlagsAsync
While Not EndStream {Wait 10}
Wait 100
}
UsingEvents