Many engines provide notifications that are independent of the grammars that happen to be active, although the notifications are sent only when at least one grammar is active. These notifications include such things as when an utterance begins or ends, the Volume Units (VU) Meter level, and the background noise conditions.
To receive these messages, the application must create a COM object that supports the ISRNotifySink interface. The application's response to notifications is up to you.
Before the engine object can use the notification sink, the application must register the sink with the engine by calling the ISRCentral::Register member function, specifying the address of the ISRNotifySink interface, the IID_ISRNotifySink interface identifier, and the address of a double-word variable. If the engine does not support the interface, Register returns an error. If Register succeeds, the engine fills the double-word variable with a notification identifier that the application can use to unregister the notification sink.
During the time that the application has a notification sink registered with the engine, it receives the following notifications:
Member function | Description |
AttribChanged | Called when an application changes an attribute of the speech-recognition engine. |
Interference | Called when the engine cannot properly recognize an utterance for a known reason. The notification includes a flag indicating the reason. |
Sound | Called when the engine recognized a sound or a garbled word. |
UtteranceBegin | Called as soon as the speech-recognition engine has received any audio input that might be speech. However, the engine may not begin processing the speech for a few more seconds if it is already processing a previous utterance. The notification is tagged with a QWORD that identifies the time the speech started. An application can pass this into the ISRCentral::ToFileTime member function to determine the time (hours, minutes, and seconds) that the event occurred. |
UtteranceEnd | Called as soon as the speech-recognition engine senses that the user has stopped speaking. The notification has both a beginning time and ending time associated with it. Although many engines associate an utterance with a recognition result, this may not always be the case. Several utterances can occur before recognition results are returned, or several results can be returned for one utterance. |
VUMeter | A linear VU level from 0 to 0xFFFF, sent between 8 and 16 times a second, which indicates the loudness of the digital-audio stream. This information can be used to provide feedback to the user that the engine object is listening. Not all engines call this member function. |
An application can unregister a notification sink by calling the ISRCentral::UnRegister member function, specifying the identifier received in the call to the Register member function. Calling UnRegister is optional because if an application releases the engine object, it releases all of the notification sinks it is using. However, the release of the notification sink may not occur immediately after the engine is released.