拙网论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 258|回复: 1

IAudioMeterInformation interface

[复制链接]

949

主题

1001

帖子

3736

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3736
发表于 2018-7-26 17:39:05 | 显示全部楼层 |阅读模式
he IAudioMeterInformation interface represents a peak meter on an audio stream to or from an audio endpoint device. The client obtains a reference to the IAudioMeterInformation interface on an endpoint object by calling the [color=var(--blue)]IMMDevice::Activate method with parameter iid set to REFIID IID_IAudioMeterInformation.
If the adapter device that streams audio data to or from the endpoint device implements a hardware peak meter, the IAudioMeterInformationinterface uses that meter to monitor the peak levels in the audio stream. If the audio device lacks a hardware peak meter, the audio engine automatically implements the peak meter in software, transparently to the client.
If a device has a hardware peak meter, a client can use the methods in the IAudioMeterInformation interface to monitor the device's peak levels in both shared mode and exclusive mode. If a device lacks a hardware peak meter, a client can use those methods to monitor the device's peak levels in shared mode, but not in exclusive mode. In exclusive mode, the client and the device exchange audio data directly, bypassing the software peak meter. In exclusive mode, a software peak meter always reports a peak value of 0.0.
To determine whether a device has a hardware peak meter, call the [color=var(--blue)]IAudioMeterInformation:ueryHardwareSupport method.
For a rendering endpoint device, the IAudioMeterInformation interface monitors the peak levels in the output stream before the stream is attenuated by the endpoint volume controls. Similarly, for a capture endpoint device, the interface monitors the peak levels in the input stream before the stream is attenuated by the endpoint volume controls.
The peak values reported by the methods in the IAudioMeterInformation interface are normalized to the range from 0.0 to 1.0. For example, if a PCM stream contains 16-bit samples, and the peak sample value during a particular metering period is –8914, then the absolute value recorded by the peak meter is 8914, and the normalized peak value reported by the IAudioMeterInformation interface is 8914/32768 = 0.272.
For a code example that uses the IAudioMeterInformation interface, see [color=var(--blue)]Peak Meters.

回复

使用道具 举报

949

主题

1001

帖子

3736

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3736
 楼主| 发表于 2018-7-26 17:39:29 | 显示全部楼层
To support Windows applications that display peak meters, the EndpointVolume API includes an IAudioMeterInformation interface. This interface represents a peak meter on an audio endpoint device. For a rendering device, the value retrieved from the peak meter represents the maximum sample value encountered in the output stream to the device during the preceding metering period. For a capture device, the value retrieved from the peak meter represents the maximum sample value encountered in the input stream from the device.

The peak-meter values obtained from the methods in the IAudioMeterInformation interface are floating-point numbers in the normalized range from 0.0 to 1.0. For example, if a PCM stream contains 16-bit samples, and the peak sample value during a particular metering period is —8914, then the absolute value recorded by the peak meter is 8914, and the normalized peak value reported by the IAudioMeterInformation interface is 8914/32768 = 0.272.

If the audio endpoint device implements the peak meter in hardware, the IAudioMeterInformation interface uses the hardware peak meter. Otherwise, the interface implements the peak meter in software.

If a device has a hardware peak meter, the peak meter is active both in shared mode and in exclusive mode. If a device lacks hardware peak meter, the peak meter is active in shared mode, but not in exclusive mode. In exclusive mode, the application and the audio hardware exchange audio data directly, bypassing the software peak meter (which always reports a peak value of 0.0).
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|抱朴守拙BBS

GMT+8, 2025-5-26 03:21 , Processed in 0.218488 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表