The SetSpeechRecognitionCallback API procedure is used to register a callback procedure with the telephony engine for the purpose of accessing the locally recorded audio stream. The primary application is for speech recognition but the sampled audio data passed to the application can be used for whatever your requirements dictate.

Namespace:  LanScape
Assembly:  LMEVoipManaged (in LMEVoipManaged.dll) Version: 6.0.5226.26700

Syntax

C#
public VoipMediaEngine..::.TELEPHONY_RETURN_VALUE SetSpeechRecognitionCallback(
	VoipMediaEngine..::.AUDIO_BANDWIDTH SpeechEnginebandwidth,
	VoipMediaEngine..::.SPEECH_RECOGNITION_CALLBACK_PROC SpeechBufferReadyCallback,
	Object UserData
)
Visual Basic (Declaration)
Public Function SetSpeechRecognitionCallback ( _
	SpeechEnginebandwidth As VoipMediaEngine..::.AUDIO_BANDWIDTH, _
	SpeechBufferReadyCallback As VoipMediaEngine..::.SPEECH_RECOGNITION_CALLBACK_PROC, _
	UserData As Object _
) As VoipMediaEngine..::.TELEPHONY_RETURN_VALUE
Visual C++
public:
VoipMediaEngine..::.TELEPHONY_RETURN_VALUE SetSpeechRecognitionCallback(
	VoipMediaEngine..::.AUDIO_BANDWIDTH SpeechEnginebandwidth, 
	VoipMediaEngine..::.SPEECH_RECOGNITION_CALLBACK_PROC^ SpeechBufferReadyCallback, 
	Object^ UserData
)
J#
public VoipMediaEngine..::.TELEPHONY_RETURN_VALUE SetSpeechRecognitionCallback(
	VoipMediaEngine..::.AUDIO_BANDWIDTH SpeechEnginebandwidth,
	VoipMediaEngine..::.SPEECH_RECOGNITION_CALLBACK_PROC SpeechBufferReadyCallback,
	Object UserData
)

Parameters

SpeechEnginebandwidth
Type: LanScape..::.VoipMediaEngine..::.AUDIO_BANDWIDTH
Specifies the format and rate of the audio data. Can be either AUDIO_BW_PCM_11K or AUDIO_BW_PCM_22K.
SpeechBufferReadyCallback
Type: LanScape..::.VoipMediaEngine..::.SPEECH_RECOGNITION_CALLBACK_PROC
The user specified delegate funtion (callback procedure). The return value of the callback is of type void and therefore the callback does not have to return any value. The callback procedure receives a single parameter. This single parameter passed to the callback is a reference of an internal telephony engine buffer of type VoipMediaEngine..::.SPEECH_RECOGNITION_DATA.
UserData
Type: System..::.Object
This parameter allows the user to specify instance data that will be passed to the callback procedure. A reference to any .NET class object is acceptable.

Return Value

If the function succeeds, the return value will be SipSuccess.

If the function fails, the return value will be one of the following values as specified by the VoipMediaEngine..::.TELEPHONY_RETURN_VALUE data type.

Return ValueDescription
SipCallFailure
This value is returned by telephony API procedures to indicate general API failure. This error value is used as a "catch all error". If you receive this error, check to make sure that all parameters specified in the API procedure call are correct. Particularly, verify that pointers to memory regions are valid. This error return value is only used if a mapping to another specific error value does not exist.

(API return value)

SipBadParameter
One of the telephony API procedures was called by application software and was passed a pointer to an invalid memory address. Normally this error will occur when application software passes NULL pointer values to the telephony API. For managed code applications, you should never see this error unless your process space has exhausted memory.

(API return value)

SipInvalidHandle
Application software specified an invalid telephony handle in one of the API procedures. This usually indicates memory corruption on the part of application software.

(API return value)

Remarks

The telephony engine will call the user supplied callback at a periodic interval (20ms). The locally recorded audio data will be supplied to the user's callback in one of the following rates and formats: 11kHz PCM or 22kHz PCM.

The actual sampling rates that the user callback will receive are 11025 and 22050 samples per second respectively.

The callback procedure that is executed should keep processing down to a minimum so that locally recorded audio is not interrupted. The audio sampled data being passed to the application is a dedicated data stream. Changing the contents of the audio sample buffer will not change the locally recorded audio the telephony engine uses.

See Also