Browse
 
Tools
Rss Categories

LV_SRE_AddEvent

Reference Number: AA-00664 Views: 11581 0 Rating/ Voters

Events are added to call log files (special logs generated by the SpeechPort which contain audio for each decode and a host of other information). The call log files are generated in the responses folder located in the  installation directory, under the Lang directory. Any number of events may be added. Call logging needs to be enabled prior to calling this function. Call logging can be enabled via LV_SRE_SetPropertyEx or in the client_property.conf file.

Function

  • int LV_SRE_AddEvent(HPORT hport, const char* EventName)

Parameters

hport

A handle to the speech port.

EventName

Any non-NULL, non-zero length string.

Return Values

LV_SUCCESS

No errors; adding the event succeeded.

LV_INVALID_EVENT

Either event logging is not enabled, EventName is NULL or of zero string length or you are trying to add EVENT_END_DECODE_SEQ event type without previously adding an EVENT_START_DECODE_SEQ type event.

LV_INVALID_HPORT

The input hport is not a valid one.

LV_EXCEPTION

An exception occurred while processing the request.

C Code

  1. // The below StreamCancel and LV_SRE_AddEvent functions are very important,
  2. // and need to be called in the STREAM_STATUS_BARGE_IN_TIMEOUT state in this
  3. // exact order for proper logging of the audio to the callsre file
  4. //(proprietary audio log format).
  5. //
  6. // When StreamCancel is called, it is assumed that the audio is not going to
  7. // be used for a decode and the data is packaged for logging if
  8. // LV_SRE_AddEvent("NO_INPUT") is called.
  9. //
  10. // Adding the NO_INPUT event would allow you to listen to the logged audio
  11. // through the SpeechTuner to debug the potential cause.

  12. void StreamStateCallback(int StreamStatus, unsigned int TotalBytes,
    unsigned int RecordedBytes, void *UserData,)
  13. {
  14. StreamingUserData_t* StreamingUserData = (StreamingUserData_t*)UserData;
  15. StreamingUserData -> StreamingStatus = StreamStatus;
  16. switch(StreamStatus)
  17. {
  18. // **Other cases for other stream statuses**
  19. // For a comprehensive list, see the stream status page.

  20. case STREAM_STATUS_END_SPEECH:
  21. LV_SRE_StreamCancel(StreamingUserData->PortHandle);
  22. LV_SRE_AddEvent(StreamingUserData->PortHandle, EVENT_NOINPUT);

  23. // Notifies the decode thread that we are in a final state for streaming.
  24. StreamingUserData->Streaming = 0;
  25. break;
  26. }
  27. }

See Also