简体   繁体   中英

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.

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.

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.

MEDIASUBTYPE_IEEE_FLOAT / WAVE_FORMAT_IEEE_FLOAT audio types operate with floating point values in [-1, +1] range.

MEDIASUBTYPE_PCM / WAVE_FORMAT_PCM has integer values,

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.

You will also find good references here: How to handle asymmetry of WAV data? .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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