# TextToSpeechOpenInMemory

The TextToSpeechOpenInMemory call causes the text-to-speech system to enter into the speech-to-memory mode. This mode indicates that the speech samples are to be written into memory buffers rather than sent to an audio device each time TextToSpeechSpeak is called. The TextToSpeechAddBuffer call supplies the text-to-speech system with the memory buffers that it needs. The text-to-speech system remains in the speech-to-memory mode until TextToSpeechCloseInMemory is called.

Syntax | MMRESULT TextToSpeechOpenInMemory | (LPTTS_HANDLE_T phTTS, DWORD dwFormat)
Parameters | LPTTS_HANDLE_T phTTS | Specifies a text-to-speech handle.
| DWORD dwFormat | Specifies an identifier that determines the audio sample format. It is one of the following constants defined in the include files mmsystem.h and ttsapi.h.
Constant | Description
WAVE_FORMAT_1M08 | Mono, 8-bit 11.025 kHz sample rate
WAVE_FORMAT_1M16 | Mono, 16-bit 11.025 kHz sample rate
WAVE_FORMAT_08M08 | Mono, 8-bit m-law, 8 kHz sample rate
Return Value | This call returns a value of type MMRESULT. The return value is zero if the call is successful. The return value is one of the following constants:
Constant | Description
MMSYSERR_NOERROR | Normal successful completion (zero).
MMSYSERR_INVALPARAM | An invalid parameter or illegal wave output format was passed.
MMSYSERR_NOMEM | Unable to allocate memory.
MMSYSERR_ERROR | Illegal output state.
MMSYSERR_INVALHANDLE | The text-to-speech handle was invalid.
Comment | The text-to-speech system is in the speech-to-memory mode after successfully invoking this call. The memory buffer is passed using the structure TTS_BUFFER_T. The user must allocate the structure and its associated elements (memory buffer, phoneme array and index mark array). Click here to see the Speech-To-Memory Mode help for more information on the TTS_BUFFER_T structure and its elements. The text-to-speech system returns the buffer to the application when the memory buffer, phoneme array, or index mark array is full or when a TTS_FORCE flag was used in the TextToSpeechSpeak call. Click here to see the Callback Routines and Window Procedures help for detailed information on passing information back to the calling application. The startup function must be called to start the text-to-speech system before calling this function. TextToSpeechOpenInMemory automatically resumes audio output if the text-to-speech system is in a paused state by a previously issued TextToSpeechPause call.
See Also | Callback Routines and Window Procedures Speech-To-Memory Mode TextToSpeechAddBuffer TextToSpeechCloseInMemory TextToSpeechPause TextToSpeechReset TextToSpeechReturnBuffer TextToSpeechSpeak TextToSpeechStartup (UNIX) TextToSpeechStartup (Windows only) TextToSpeechStartupEx