ISpStreamFormatConverter
ISpStreamFormatConverter is the primary interface implemented by the SAPI audio data format converter. SAPI uses the format converter to compensate for differences between supported SR and TTS engine formats, and the I/O formats requested by the application. Typically applications and engines do not use this object directly. The format converter is a wrapper object that encapsulates the specified base stream. It performs conversion on the fly during read/write operations. The Windows ACM (Audio Compression Manager) layer performs the conversion.
Several methods are included in addition to the ISpStreamFormat interface to allow data conversion.
Implemented By
Remarks
SAPI utilizes the host system's installed audio codecs to perform the conversion. SAPI currently supports 1-stage and 2-stage stream conversions, but does not support 3-or-more-stage conversions.
An example of a 1-stage stream format conversion is the conversion of a PCM format to another PCM format (e.g., 8kHz 16-bit Stereo PCM [SPSF_8kHz16BitStereo] -> 44kHz 8-bit Mono [SPSF_44kHz8BitMono]). This requires only one codec (e.g., "Microsoft PCM Converter").
An example of a 2-stage stream conversion is the conversion of a compressed format to a PCM format (e.g., TrueSpeech 8kHz 1-Bit Mono [SPSF_TrueSpeech_8kHz1BitMono] -> 8kHz 8-bit Mono PCM [SPSF_8kHz8BitMono] -> 44kHz 16-bit Stereo [SPSF_44kHz16BitStereo]). This requires two codecs (e.g., "DSP Group TrueSpeech(TM) Audio" and "Microsoft PCM Converter"). Note that one of the formats must be a PCM format.
An example of an unsupported 3-stage stream conversion is the conversion of a compressed format to another compressed format (e.g., TrueSpeech 8kHz 1-Bit Mono [SPSF_TrueSpeech_8kHz1BitMono] -> 8kHz 8-bit Mono PCM [SPSF_8kHz8BitMono] -> 8kHz 8-bit Stereo PCM [SPSF_8kHz8BitStereo] -> ALaw 8kHz Stereo [SPSF_CCITT_ALaw_8kHzStereo]). This would require three codecs (e.g., "DSP Group TrueSpeech(TM) Audio", "Microsoft PCM Converter", and "Microsoft CCITT G.771 Audio"). Note that SAPI is capable of converting between two compressed non-PCM formats if a single codec can do the entire conversion.
Methods in Vtable Order
ISpStreamFormatConverter Methods | Description |
---|---|
ISpStreamFormat interface | Inherits from ISpStreamFormat and all those methods are accessible from an ISpStreamFormatConverter object. |
SetBaseStream | Sets audio stream to be wrapped by the format converter. |
GetBaseStream | Gets the base audio stream that is being wrapped. |
SetFormat | Sets the conversion (output) format. |
ResetSeekPosition | Resets the format converter's stream seek position to the start of the stream. |
ScaleConvertedToBaseOffset | Maps an offset in the converted stream into an offset in the base stream. |
ScaleBaseToConvertedOffset | Maps an offset in the base stream into an offset in the converted stream. |
Development Helpers
Helper Enumerations, Functions and Classes | Description |
---|---|
SPSTREAMFORMAT | SAPI supported stream formats |
CSpStreamFormat | Class for managing SAPI supported stream formats and WAVEFORMATEX structures |