title: C++ sapi: User input, edit voice out
body: <pre><code>#include &lt;sapi.h&gt;
  #include &lt;string&gt;
  #include &lt;iostream&gt;
  
  //User inputs what is to be said//
  int main(int argc, char* argv[])
  {
      ISpVoice * pVoice = NULL;
  
      if (FAILED(::CoInitialize(NULL)))
          return FALSE;
  
      HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&amp;pVoice);
      if (SUCCEEDED(hr))
      {
          std::wstring input;
          while (true)
          {
              std::cout &lt;&lt; "Enter text:\n";
              std::getline(std::wcin, input);
  
              hr = pVoice-&gt;Speak(input.c_str(), 0, NULL);
          }
      }
      pVoice-&gt;Release();
      pVoice = NULL;
      ::CoUninitialize();
      return 0;
  }
  </code></pre>
  
  <p>The code above allows a user to input what they want to have spoken and works perfectly. </p>
  
  <p>Below is the MSDN method of changing pitch and any other similar action is done the same way.</p>
  
  <pre><code>hr = pVoice-&gt;Speak(L"This sounds normal &lt;pitch middle = '-10'/&gt; but the pitch drops half way through", SPF_IS_XML, NULL );
  </code></pre>
  
  <p>I want to change the pitch, but can't figure out how to do the same action with the code I have. </p>