Share via


Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

Microsoft Speech Platform

SpCreateDefaultObjectFromCategoryId

SpCreateDefaultObjectFromCategoryId creates the object instance from the default object token of a specified category.

Found in: sphelper.h

<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml"> <strong>SpCreateDefaultObjectFromCategoryId(</strong> <strong> const WCHAR</strong> *<em>pszCategoryId</em>, <strong> T</strong> **<em>ppObject</em>, <strong> IUnknown</strong> *<em>pUnkOuter</em> = NULL, <strong> DWORD</strong> <em>dwClsCtxt</em> = CLSCTX_ALL <strong>);</strong> </pre>

Parameters

  • pszCategoryId
    [in] The type of object token to create.
  • ppObject
    [out] The object being created.
  • pUnkOuter
    [in] Optional parameter used for creating aggregate objects. pUnkOuter is the data for the object. If not specified, the value defaults to NULL.
  • dwClsCtxt
    [in] The type of aggregate object being created. If pUnkOuter is not NULL, this must be supplied. If not specified otherwise, the value defaults to all object types.

Return Values

Value Description
S_OK Function completed successfully.
FAILED (hr) Appropriate error message.

Example

`

// Declare local identifiers:
HRESULT               hr = S_OK;
CComPtr<ISpAudio>     cpAudio;

hr = SpCreateDefaultObjectFromCategoryId(SPCAT_AUDIOIN, &cpAudio;);

if (SUCCEEDED(hr)) { // Do stuff here. }

`