简体   繁体   English

在不同的波形格式之间转换(WAVEFORMATEX)

[英]Convert between different wave formats (WAVEFORMATEX)

I'm writing a real-time audio application that runs a stream in exclusive mode. 我正在编写一个实时音频应用程序,该应用程序以独占模式运行流。 In order to properly present data to the device, it needs to arrive in a format that isn't of my own choosing. 为了正确地将数据呈现给设备,数据需要以我自己选择的格式传输。 All of my audio processing is done with floating point samples before being sent to the device, and the device's wave format might not be (and probably isn't) set to WAVE_FORMAT_IEEE_FLOAT - for example, it might be WAVE_FORMAT_EXTENSIBLE or WAVE_FORMAT_PCM . 我所有的音频处理都是在将浮点样本发送到设备之前完成的,并且设备的波形格式可能未(也可能未)设置为WAVE_FORMAT_IEEE_FLOAT例如,可能为WAVE_FORMAT_EXTENSIBLEWAVE_FORMAT_PCM

Is there an API that makes it easy to convert between one wave format (floating point) and another (the device's format)? 是否有API可以轻松在一种波形格式(浮点数)和另一种波形格式(设备的格式)之间转换?

Use an Audio Compression Manager (ACM) conversion stream: 使用音频压缩管理器(ACM)转换流:

Converting Data from One Format to Another 将数据从一种格式转换为另一种格式

If you cannot create a single stream from your format to the device's format, you will have to create two streams - one from your format to WAVE_FORMAT_PCM , and the other from WAVE_FORMAT_PCM to the device's format (all streams/devices have to support conversions to/from PCM). 如果您无法创建从格式到设备格式的单个流,则必须创建两个流-一个从您的格式到WAVE_FORMAT_PCM ,另一个从WAVE_FORMAT_PCM到设备格式(所有流/设备都必须支持到/的转换来自PCM)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM