Note

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

Microsoft Speech Platform

SPWORDPRONUNCIATIONLIST

SPWORDPRONUNCIATIONLIST is used with ISpEnginePronunciation::GetPronunciations to list possible variations in pronunciation for a given word.

<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml"> <strong>typedef struct SPWORDPRONUNCIATIONLIST</strong> <strong>{</strong> <strong>ULONG</strong> <em>ulSize</em>; <strong>BYTE</strong> *<em>pvBuffer</em>; <a runat="server" href="jj127891(v=msdn.10).md"><strong>SPWORDPRONUNCIATION</strong></a> *<em>pFirstWordPronunciation</em>; <strong>} SPWORDPRONUNCIATIONLIST;</strong> </pre>

Members

  • ulSize
    Size of the pronunciation buffer, in bytes.
  • pvBuffer
    Pointer to the buffer for all pronunciations.
  • pFirstWordPronunciation
    Pointer to the first in a linked list of SPWORDPRONUNCIATION structures within pvBuffer.

Remarks

This structure is the start of a linked list of SPWORDPRONUNCIATION structures and contains the size and actual buffer of all subsequent pronunciations.

Call ZeroMemory before using SPWORDPRONUNCIATIONLIST to initialize it, and call CoTaskMemFree(spwordpronlist.pvBuffer) to free the buffer allocated during the calls. The pvBuffer need not (and should not) be freed between the calls.  ISpEnginePronunciation::GetPronunciations will reuse the buffer for efficiency and reallocate it when necessary.

Example

The following example is a code fragment demonstrating the use and creation of SPWORDPRONUNCIATIONLIST.

`

    SPWORDPRONUNCIATIONLIST spwordpronlist;
memset(spwordpronlist, 0, sizeof(spwordpronlist));

pISpEnginePronunciation-&gt;GetPronunciations(L"resume", NULL, NULL, 0, &amp;spwordpronlist);
for (SPWORDPRONUNCIATION *pwordpron = spwordpronlist.pFirstWordPronunciation;
     wordpron != NULL;
     wordpron = pwordpron-&gt;pNextWordPronunciation)
{
    DoSomethingWith(pwordpron-&gt;ePartOfSpeech, pwordpron-&gt;szPronunciation);
}

pISpEnginePronunciation-&gt;GetPronunciations(L"record", NULL, NULL, 0, &amp;spwordpronlist);
	
// Repeat the for loop above to process the pronunciations.

CoTaskMemFree(spwordpronlist.pvBuffer);
`

The following helper class will ensure the correct usage of SPWORDPRONUNCIATIONLIST.

<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml">class CSpPronList : public SPWORDPRONUNCIATIONLIST { public: CSpPronList() { ZeroMemory(static_cast&lt;SPWORDPRONUNCIATIONLIST*&gt;(this), sizeof(SPWORDPRONUNCIATIONLIST)); } ~CSpPronList() { CoTaskMemFree(pvBuffer); } }; </pre>

Using the helper class, the preceding sample becomes the following:

`

    CSpPronList spwordpronlist;

pISpEnginePronunciation-&gt;GetPronunciations(L"resume", NULL, NULL, 0, &amp;spwordpronlist);
for (SPWORDPRONUNCIATION *pwordpron = spwordpronlist.pFirstWordPronunciation;
     wordpron != NULL;
     wordpron = pwordpron-&gt;pNextWordPronunciation)
{
    DoSomethingWith(pwordpron-&gt;ePartOfSpeech, pwordpron-&gt;szPronunciation);
}

pISpEnginePronunciation-&gt;GetPronunciations(L"record", NULL, NULL, 0, &amp;spwordpronlist);
	
// Repeat the for loop above to process the pronunciations.
`