Windows Dev Center

Collapse the table of content
Expand the table of content
Expand Minimize
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Converting Data from One Format to Another

The ACM uses stream functions to support data format conversion. Converters in the ACM change the format, but not the data type. For example, a converter module can change 44-kHz, 16-bit data to 44-kHz, 8-bit data.

The following ACM functions support data format conversion. They are listed in the order in which you would typically use them.

  • The acmStreamOpen function opens a conversion stream.
  • The acmStreamSize function calculates the appropriate size of the source or destination buffer.
  • The acmStreamPrepareHeader function prepares source and destination buffers to be used in a conversion.
  • The acmStreamConvert function converts data in a source buffer into the destination format, writing the converted data into the destination buffer.
  • The acmStreamUnprepareHeader function cleans up the source and destination buffers prepared by acmStreamPrepareHeader. You must call this function before freeing the source and destination buffers.
  • The acmStreamClose function closes a conversion stream.

When converting data, first identify the source format, then choose the destination format. The easiest way to do this is by using the acmFormatChoose function, which displays a format-selection dialog box and returns the user's format choice.

When you know the source and destination formats, you can use acmStreamOpen to open a conversion stream. Then you can use the acmStreamSize function to determine the appropriate buffer sizes.

The next step is to prepare the buffers to be used in the conversion by using acmStreamPrepareHeader.

To perform the conversion, use acmStreamConvert until all the buffers have been processed. When the conversion is complete, use acmStreamUnprepareHeader to clean up the buffers and then use acmStreamClose to close the conversion stream.



Community Additions

© 2015 Microsoft