QAudioInput Class
表示一个音频输入通道。更多...
| 标题: | #include <QAudioInput> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Multimedia) target_link_libraries(mytarget PRIVATE Qt6::Multimedia) |
| qmake: | QT += multimedia |
| 在 QML 中: | AudioInput |
| 继承自: | QObject |
属性
公共函数
公共槽位
信号
| void | deviceChanged() |
| void | mutedChanged(bool muted) |
| void | volumeChanged(float volume) |
详细说明
该类表示一个可与QMediaCaptureSession 配合使用的输入通道。它支持选择要使用的物理输入设备、静音该通道以及调节通道音量。
注意:在 WebAssembly 平台上,由于其异步特性,当音频输入列表准备就绪时,会触发 `QMediaDevices::audioInputsChanged()` 信号。此操作需要用户权限,且仅在安全的 HTTPS 上下文中有效。
另请参阅 ` QAudioOutput`。
属性文档
device : QAudioDevice
该属性存储了连接到此输入的音频设备。
device 属性表示连接到此输入的音频设备。该属性可用于从QMediaDevices::audioInputs() 列表中选择输入设备。
您可以通过将该属性设置为默认构造的QAudioDevice 对象来选择系统默认音频输入。
访问函数:
| QAudioDevice | device() const |
| void | setDevice(const QAudioDevice &device) |
通知信号:
| void | deviceChanged() |
muted : bool
该属性存储当前媒体的静音状态。
如果输入已被静音,该值将为true ;否则为false 。
访问函数:
| bool | isMuted() const |
| void | setMuted(bool muted) |
通知信号:
| void | mutedChanged(bool muted) |
volume : float
该属性返回音频输入的音量。
访问函数:
| float | volume() const |
| void | setVolume(float volume) |
通知信号:
| void | volumeChanged(float volume) |
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.