Article View: comp.lang.objective-c
Article #216sound-text synchronizing
From: jrscs
Date: Tue, 18 Dec 1990 15:14
Date: Tue, 18 Dec 1990 15:14
39 lines
1861 bytes
1861 bytes
I am working on a text-to-speech conversion program on the NeXT computer
system using Interface Builder. Everything is coming along fine except for
one problem I hope someone can help me with. I am having difficulty
synchronizing the highlighting of a word in a window with actually saying
the word. As of now, the relevant code looks like the following:
- readReaderFile
{
char aWord[ 50 ];
int startPos = 0 ,
endPos;
while ( [ self getWordBoundaries:&startPos :&endPos ] == YES )
{
[ [ theDocument docView ] setSel:startPos :endPos ];
[ [ theDocument docView ] getSubstring:aWord start:startPos length:....];
speak( aWord , endPos - startPos );
startPos = endPos + 1;
}
return self;
}
*** NOTE : The text is contained in a ScrollView's docView, hence the
"[ theDocument docView ]" calls.
For a short file, what happens is all of the words are spoken first and then
the selections are executed. If I put the "[ .... setSel .... ]" line in a
loop to execute about ten times, then two words are spoken and one is high-
lighted, two are spoken and one is highlighted, .... There must be a way
around this problem. I think a solution might entail using delegates and the
methods "willPlay" and "didPlay" for the sound object which stores the sound
data for the words in the window, but I just can't seem to hook things
together. Can someone please give me an idea on how I can solve this problem.
Thanks,
John Stelly
Technical Details
Message-ID:
<009415D9.95ACE680@uno.edu>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!rex!JRSCS@uno.eduShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!rex!JRSCS@uno.edu From: jrscs@uno.edu Newsgroups: comp.lang.objective-c Subject: sound-text synchronizing Message-ID: <009415D9.95ACE680@uno.edu> Date: 18 Dec 90 15:14:41 GMT Sender: news@rex.cs.tulane.edu Reply-To: jrscs@uno.edu Lines: 39