声卡 PCM数据格式

来源:互联网 发布:郑钧 私奔知乎 编辑:程序博客网 时间:2024/06/08 17:45

The waveOutSetVolume function sets the volume level of the specified waveform-audio output device.
Volume-level values range from 0x0 (silence) to 0xFFFF (maximum volume) and are interpreted logarithmically.

dwVolume

New volume setting. The low-order word contains the left-channel volume setting, and the high-order word contains the right-channel setting. A value of 0xFFFF represents full volume, and a value of 0x0000 is silence.

If a device does not support both left and right volume control, the low-order word of dwVolume specifies the volume level, and the high-order word is ignored.




PCM Waveform-Audio Data Format

The lpData member of the WAVEHDR structure pointsetts to the waveform-audio data samples. 

 For 8-bit PCM data, each sample is represented by a single unsigned data byte. For 16-bit PCM data, each sample is represented by a 16-bit signed value. The following table summarizes the maximum, minimum, and midpoint values for PCM waveform-audio data.

Data formatMaximum valueMinimum valueMidpoint value8-bit PCM255 (0xFF)0128 (0x80)16-bit PCM32,767 (0x7FFF)–32,768 (0x8000)0

PCM Data Packing


PCM waveform-audio formatDescription8-bit monoEach sample is 1 byte that corresponds to a single audio channel. Sample 1 is followed by samples 2, 3, 4, and so on.8-bit stereoEach sample is 2 bytes. Sample 1 is followed by samples 2, 3, 4, and so on. For each sample, the first byte is channel 0 (the left channel) and the second byte is channel 1 (the right channel).16-bit monoEach sample is 2 bytes. Sample 1 is followed by samples 2, 3, 4, and so on. For each sample, the first byte is the low-order byte of channel 0 and the second byte is the high-order byte of channel 0.16-bit stereoEach sample is 4 bytes. Sample 1 is followed by samples 2, 3, 4, and so on. For each sample, the first byte is the low-order byte of channel 0 (left channel); the second byte is the high-order byte of channel 0; the third byte is the low-order byte of channel 1 (right channel); and the fourth byte is the high-order byte of channel 1.
0 0
原创粉丝点击