Sets the port in a listening mode, allowing for data to be streamed via StreamSendData, but will not begin processing the audio until all registered grammars have started loading and have had their meta tags processed. Recommended over StreamStart; see Remarks, below, for more details.
- int StreamStartListening(void)
No errors; stream set up correctly.
The port is not valid (either CreateClient has not been called or DestroyClient has been called prior to this call).
The operation failed because the port was shutting down.
An exception occurred while processing the request.
StreamStartListening, introduced in LumenVox version 10.5, is an improved version of StreamStart, and should be used instead of StreamStart. It functions similarly to StreamStart, except it works in conjunction with RegisterGrammarForPendingStream to delay the processing of audio until all registered grammars have started loaded and have had their meta tags processed.
Any audio received by the streamer after StreamStartListening has been called but before all registered grammars have had their meta tags processed will be saved. This means that StreamStartListening can be safely called even before grammars have been loaded without fear of losing audio data (you should still wait until all grammars have finished loading before performing a decode). With StreamStart, all grammars must have already been loaded and activated before calling StreamStart.
The general pattern we recommend you follow when using StreamStartListening is:
- Register all grammars you intend to use for a given recognition.
- Call StreamStartListening
- On separate threads, load and activate each grammar (if a grammar was already loaded from a previous recognition, you may skip loading and just activate it, but be careful of relying on this if you are using dynamic grammars that may have changed)
- Once STREAM_STATUS_END_SPEECH has been returned and all grammars have finished loading/activating, call Decode.
- Call DeactivateGrammars to deactivate all grammars in preparation for the next stream.
You can deviate from the above pattern, but it may cause unexpected behavior. For instance, when calling StreamStartListening, you must register grammars either before or after calling StreamStartListening (if no grammars are registered the stream will not be processed). Also, if you do not load or activate any grammars after calling StreamStartListening the stream will not be processed, because the check to begin processing audio occurs on the call to LoadGrammar and ActivateGrammar.
StreamStartListening is optional for speech applications, but must be used by any applications that use the LumenVox Call Progress Analysis functionality to change the voice activity detection mode (e.g. to turn on tone detection or CPA modes).