|
-
Aug 13th, 2002, 02:31 PM
#1
Thread Starter
New Member
Threading with an Asynchronous event (in SAPI)
I am trying to use SAPI 5.1 in a multi-threaded environment. I want to spawn 5 threads, and have each of them process a part of an audio document. My question (problem) is that the recognition event never seems to fire in the thread that start recognition. I think this is because the recognition is asynchronous and the thread just completes (before this event fires).
Basically I need some guidance with multi-threading with asychronous events. It would seem if I had a non-blocking wait that the "start" event of the thread could have, then it would process the "recognition" events , and I could stop the recognition on "recognition ended" event. Here in lies the problem. SAPI recognition is asynchronous. You start the recognizer, point a file (or microphone) at it, then deal with events as they fire. Threads dont' like to sit around and wait for events, they like to process, then die. The start method needs to somehow wait (without chewing processing power), so that the events can fire, and when recognition is done, tell the start method to stop. I tried a simple loop:
'...
'Now loop until the recognition is complete
Do
'Wait until m_stopping is set by end of reco...
Loop Until m_stopping
and had the m_stopping boolean set to True when the end recognition event took place. This didn't work, because the thread blocked on that loop, and didn't let the recognizer start...
So any suggestions on how to do this would be very much appreciated.
Jeff
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|