Browse
 
Tools
Rss Categories

LVSpeechPort::StreamSetParameter

Reference Number: AA-00820 Views: 3451 0 Rating/ Voters

Sets a new value for a stream property.

Function

  • int StreamSetParameter(const char* StreamParameter, unsigned int StreamParameterValue)

Parameters

StreamParameter

Stream parameter to change. See available Stream Properties.

Version 10.5
Note that in version 10.5, this parameter changed from an int to a const char *, which was to optimize the code internally. This should have minimal effect on users, except to require a recompilation of any code linking to the API when making this transition. Specifically, the defines that can be used in this parameter value were changed in the definition to accommodate this.
   

StreamParameterValue

New stream parameter value.

Return Values

LV_SUCCESS

No errors; parameter changed correctly.

LV_INVALID_HPORT

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

LV_FAILURE

The operation failed because the port was shutting down.

LV_INVALID_PROPERTY

The specified parameter does not exist.

LV_EXCEPTION

An exception occurred while processing the request.

Remarks

The streaming parameters set by this function are very important for the Engine to correctly determine when speech begins and ends, which in turn is important for getting accurate recognition. A common problem in speech applications is that the Engine may cut off the start or end of an utterance if these settings are incorrect.

See our recommended Engine settings for some ideas of how to alter these settings for different types of applications.

Example

C++ Code

  1. // Below is an example of a subroutine that loads and activates a grammar.

  2. void LoadGrammar(char *grammar_name, char *grammar_file)
  3. {
  4. printf("Loading the grammar and activating it.\n");
  5. error code = port.LoadGrammar(grammar_name, grammar_file);
  6. error code = port.ActivateGrammar(grammar_name);

  7. // If the grammarset is not turned to the active grammar, this grammar
  8. // will not be used automatically for the decode.
  9. error code = port.StreamSetParameter(STREAM_PARM_GRAMMAR_SET,
    LV_ACTIVE_GRAMMAR_SET);
  10. }

See Also