[英]Microsoft WASAPI - Do different audio formats need different data in the buffer, for the same wave
Lets say I want to play a sine wave using WASAPI.假设我想使用 WASAPI 播放正弦波。
Will the data I enter into the AudioClient buffer always just be samples between -1 and 1, or will it be different between PCM and IEEE_Float Formats, and other formats for that matter.我输入 AudioClient 缓冲区的数据是否始终只是 -1 和 1 之间的样本,还是 PCM 和 IEEE_Float 格式以及与此相关的其他格式不同。
Thanks.谢谢。
Right now i'm just using 1 to -1, but i want to know whether or not i need to write my buffer input code different for each format.现在我只是使用 1 到 -1,但我想知道我是否需要为每种格式编写不同的缓冲区输入代码。
MEDIASUBTYPE_IEEE_FLOAT
/ WAVE_FORMAT_IEEE_FLOAT
audio types operate with floating point values in [-1, +1] range. MEDIASUBTYPE_IEEE_FLOAT
/ WAVE_FORMAT_IEEE_FLOAT
音频类型使用 [-1, +1] 范围内的浮点值进行操作。
MEDIASUBTYPE_PCM
/ WAVE_FORMAT_PCM
has integer values, MEDIASUBTYPE_PCM
/ WAVE_FORMAT_PCM
有 integer 个值,
8-bit samples are stored as unsigned bytes, ranging from 0 to 255. 16-bit samples are stored as 2's-complement signed integers, ranging from -32768 to 32767.
8 位样本存储为无符号字节,范围从 0 到 255。16 位样本存储为 2 的补码有符号整数,范围从 -32768 到 32767。
You will also find good references here: How to handle asymmetry of WAV data?您还可以在这里找到很好的参考资料: How to handle asymmetry of WAV data? .
.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.