Rss Categories


Reference Number: AA-00741 Views: 2272 0 Rating/ Voters

Blocks the client application until the port is idle (not decoding or finished decoding), returning after a specified delay if the engine is still busy decoding.


  • int LV_SRE_WaitForEngineToIdle(HPORT hport, int MillisecondsToWait, int VoiceChannel)



The port's handle.


The number of milliseconds to wait before returning if the Speech Port does not become idle. A timeout of 0 (== TIMEOUT_INFINITE) waits until the decode timeout specified by PROP_EX_DECODE_TIMEOUT is reached


Which VoiceChannel to wait for. A value of -1 waits on all the voice channels for the port.

Return Values


No errors. The port entered an idle (non-decoding) state, prior to, or during the call.


The input hport is not a valid one.


The input VoiceChannel is not a valid one.


Either the MillisecondsToWait timeout was exceeded or the timeout value associated with PROP_EX_DECODE_TIMEOUT was exceeded before a result was returned from the Speech Engine. The decode may still be running


An exception occurred while processing the request.


Some of the LV_SRE functions run asynchronously, in particular, LV_SRE_Decode. LV_SRE WaitForEngineToIdle is primarily useful when LV_SRE_Decode is called without the LV_DECODE_BLOCK flag. In this case, LV_SRE_Decode returns immediately, but continues processing the voice channel's audio data in a separate thread. Since client applications will eventually need the results, these clients need a way to query the port to see if Decode has finished. LV_SRE WaitForEngineToIdle will wait the specified time for the Engine to idle; check the return value to ensure the engine is idle, indicating that decode results are available.

LV_SRE WaitForEngineToIdle is useful when you want to ping the engine with a 1 ms timeout but not block the thread.

To wait up to the decode timeout set by PROP_EX_DECODE_TIMEOUT use a timeout of 0 (== TIMEOUT_INFINITE)

LV_SRE WaitForEngineToIdle is also useful to ensure the Engine has finished initializing, prior to making calls to LV_SRE_Decode.

See Also