ISpAudio (SAPI 5.4)

Speech API 5.4
Microsoft Speech API 5.4


Objects implementing this interface are real-time audio streams, such as those connected to a live microphone or telephone line. ISpAudio methods support of control of real-time audio streams. IStream Read and Write methods transfer data to or from an object.

When to Implement

This interface should be implemented when the audio input or output source is not a standard windows Multimedia device. It is expected to supply an infinite amount of data and hence its state should not change externally to SAPI. For the majority of users, it will not be necessary to implement an object providing this interface. An example of where this might be needed would be to provide a telephony audio device or to perform echo cancellation of audio output on the input.

Telephone application programming interface (TAPI) provides a mechanism to treat a telephony device as a Windows multimedia device allowing the use of the SAPI provided multimedia audio objects.

If this implements a real time audio input or output object and runs in a desktop or graphical environment, support may be needed for volume (see SPDUI_AudioVolume) and audio properties (see SPDUI_AudioProperties) UI. The preferred method for SAPI to implement the UI is to have the object inherit from ISpTokenUI. This will enable applications (including Speech properties in Control Panel) to display the UI in a simple and consistent manner.

In order to prevent multiple TTS voices or engines from speaking simultaneously, SAPI serializes output to objects which implement the ISpAudio interface. To disable serialization of outputs to an ISpAudio object, place an attribute called "NoSerializeAccess" in the Attributes folder of its object token.

Implemented By

Methods in Vtable Order

ISpStreamFormat interfaceInherits from ISpStreamFormat and all those methods are accessible from an ISpAudio object.
SetStateSets the state of the audio device.
SetFormatSets the format of the audio device.
GetStatusPasses back the status of the audio device.
SetBufferInfoSets the audio stream buffer information.
GetBufferInfoPasses back the audio stream buffer information.
GetDefaultFormatPasses back the default audio format.
EventHandleReturns a Win32 event handle that applications can use to wait for status changes in the I/O stream.
GetVolumeLevelPasses back the current volume level.
SetVolumeLevelSets the current volume level.
GetBufferNotifySizeRetrieves the audio stream buffer size information.
SetBufferNotifySizeSets the audio stream buffer size information.

Development Helpers

Helper Enumerations, Functions and ClassesDescription
SPSTREAMFORMATSAPI supported stream formats.
CSpStreamFormatClass for managing SAPI supported stream formats and WAVEFORMATEX structures.