QAudioOutput Class
代表音频输出通道。更多
头文件: | #include <QAudioOutput> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Multimedia) target_link_libraries(mytarget PRIVATE Qt6::Multimedia) |
qmake: | QT += multimedia |
在 QML 中: | AudioOutput |
继承: | QObject |
属性
公共功能
公共插槽
信号
void | deviceChanged() |
void | mutedChanged(bool muted) |
void | volumeChanged(float volume) |
详细说明
该类表示一个输出通道,可与QMediaPlayer 或QMediaCaptureSession 一起使用。它可以选择要使用的物理输出设备、静音通道和更改通道音量。
属性文档
device : QAudioDevice
此属性表示连接到此输出的音频设备。
设备属性表示此输出所连接的音频设备。该属性可用于从QMediaDevices::audioOutputs() 列表中选择输出设备。通过将此属性设置为默认构建的QAudioDevice 对象,可以选择系统默认音频输出。
访问功能:
QAudioDevice | device() const |
void | setDevice(const QAudioDevice &device) |
Notifier 信号:
void | deviceChanged() |
muted : bool
该属性用于保存当前媒体的静音状态。
如果输出为静音状态,则值为true
;否则为false
。
访问功能:
bool | isMuted() const |
void | setMuted(bool muted) |
Notifier 信号:
void | mutedChanged(bool muted) |
volume : float
该属性保存当前音量。
音量按线性比例缩放,范围从0
(静音)到1
(全音量)。
注意: 超出此范围的值将被箝位。
默认情况下,音量为1
。
用户界面音量控制通常应以非线性方式缩放。例如,使用对数刻度会使感知响度产生线性变化,而这正是用户通常期望从音量控制中获得的效果。
访问功能:
float | volume() const |
void | setVolume(float volume) |
通知信号:
void | volumeChanged(float volume) |
另请参见 QtAudio::convertVolume().
© 2025 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.