LVSpeechPort::WaitForEngineToIdle

Blocks the client application until the port is idle (not decoding).

Functions

Parameters

MillisecondsToWait

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 hit

VoiceChannel

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

Return Values

LV_SUCCESS

No errors. The decode is finished.

LV_INVALID_HPORT

The port is not valid (either CreateClient has not been called or DestroyClient has been called prior to this call).

LV_INVALID_SOUND_CHANNEL

The input VoiceChannel is not a valid one.

LV_TIME_OUT

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

LV_EXCEPTION

An exception occured while processing the request.

Remarks

Some of the functions run asynchronously, in particular, Decode. WaitForEngineToIdle is primarily useful when Decode is called without LV_DECODE_BLOCK. In this case, Decode returns immediately, but continues processing the voice channel's audio data in a separate thread. Since client applications will eventually need the results, the clients need a way to query the port to see if Decode has finished. 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.

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

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

WaitForEngineToIdle is also useful to ensure the Engine has finished initializing, prior to calls to Decode.

See Also

© 2012 LumenVox LLC. All rights reserved.