By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,668 Members | 1,316 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,668 IT Pros & Developers. It's quick & easy.

problem with C# lock and windows2000 callback

P: n/a
hi, i'm having a problem using C#'s lock and windows2000's text to
speech (vtext.dll) ... basically it looks like the callback from the
TTS is violating C#'s lock, which looks very very suspicious. here are
the particulars:

i've made a form that has two buttons, one to "start speaking" and one
to "cancel speaking", and i've registered the TTS's callback message
"speech_recognized" to call my method axTextToSpeech1_SpeakingDone.

each of the methods, button1_Click (i.e. start speaking),
button2_Click (cancel speaking), and axTextToSpeech1_SpeakingDone call
handleEvent(string msg), with msg being just the name of the callback
(e.g. button1_Click).

handleEvent has a lock covering the whole method, and within that a
case statement.

if msg == "button1_Click", just calls the axTextToSpeech1.Speak

if msg == "button2_Click", just calls axTextToSpeech1.StopSpeaking

if msg == "axTextToSpeech1_SpeakingDone", just prints a message.

i've put in log messages both to std out and to file, and it seems
pretty clear that if you press the start speaking and then cancel it
while it's still speaking, the "axTextToSpeech1_SpeakingDone" method
gets called and start going through handleEvent, *even though the
cancel msg is still going through the locked code* ...

has anyone noticed anything like this before?? is it just some weird
anomaly w/ this TTS? if so, is there some other TTS i can drop into my
GUI? i've tried to download a couple of others, but couldn't get them
to work.

thanks in advance.
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
spacedog,

I am assuming that when the speaking begins, it is on another thread.
Because of this, I would think that a notification is passed to that other
thread. Because of this, the handleEvent method exits quickly, and while
there is something going on in another thread, you can still get
notifications.

For this reason, the lock is very quick, because it only is in the
handleEvent method for a short amount of time in any case. It seems like
you want to lock out the method on whether or not the operation is complete.

Of course, I don't know for sure thow TTS works. I'm assuming that it
works asynchronously.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"spacedog" <qm*******@sneakemail.com> wrote in message
news:4d**************************@posting.google.c om...
hi, i'm having a problem using C#'s lock and windows2000's text to
speech (vtext.dll) ... basically it looks like the callback from the
TTS is violating C#'s lock, which looks very very suspicious. here are
the particulars:

i've made a form that has two buttons, one to "start speaking" and one
to "cancel speaking", and i've registered the TTS's callback message
"speech_recognized" to call my method axTextToSpeech1_SpeakingDone.

each of the methods, button1_Click (i.e. start speaking),
button2_Click (cancel speaking), and axTextToSpeech1_SpeakingDone call
handleEvent(string msg), with msg being just the name of the callback
(e.g. button1_Click).

handleEvent has a lock covering the whole method, and within that a
case statement.

if msg == "button1_Click", just calls the axTextToSpeech1.Speak

if msg == "button2_Click", just calls axTextToSpeech1.StopSpeaking

if msg == "axTextToSpeech1_SpeakingDone", just prints a message.

i've put in log messages both to std out and to file, and it seems
pretty clear that if you press the start speaking and then cancel it
while it's still speaking, the "axTextToSpeech1_SpeakingDone" method
gets called and start going through handleEvent, *even though the
cancel msg is still going through the locked code* ...

has anyone noticed anything like this before?? is it just some weird
anomaly w/ this TTS? if so, is there some other TTS i can drop into my
GUI? i've tried to download a couple of others, but couldn't get them
to work.

thanks in advance.

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.