Note
Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.
Microsoft Speech Platform
ISpNotifyTranslator::InitCallback
ISpNotifyTranslator::InitCallback sets up this instance to send notifications using a standard C-style callback function.
<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml"> <strong>HRESULT InitCallback(</strong> <strong>SPNOTIFYCALLBACK</strong> <em>*pfnCallback</em>, <strong>WPARAM</strong> <em>wParam</em>, <strong>LPARAM</strong> <em>lParam</em> <strong>);</strong> </pre>
Parameters
- pfnCallback
[in] The notification callback function to be used. - wParam
[in] Constant WPARAM value that will be passed to the pfnCallback function when it is called. - lParam
[in] Constant LPARAM value that will be passed to the pfnCallback function when it is called.
Return Values
Value | Description |
---|---|
S_OK | Function completed successfully. |
SPERR_ALREADY_INITIALIZED | SpTranslator object is already initialized. |
E_INVALIDARG | pfnCallback is invalid or bad. |
FAILED(hr) | Appropriate error message. |
Remarks
The translator implementation uses a hidden window to call back the client on the same thread that was used to initialize the event source. Notify callbacks are the result of processing a window message. When this notification mechanism is used:
- The SPNOTIFYCALLBACK method will always be called on the thread that initialized the event source or notify translator object.
- The thread must have a window message pump.
The SPNOTIFYCALLBACK function is declared as follows:
typedef void __stdcall SPNOTIFYCALLBACK(WPARAM wParam, LPARAM lParam);