AudioOutput QML Type
用于播放或监听捕获会话的音频输出。更多...
| Import Statement: | import QtMultimedia |
| In C++: | QAudioOutput |
属性
信号
- void deviceChanged()
- void mutedChanged()
- void volumeChanged()
详细说明
MediaPlayer {
id: playMusic
source: "music.wav"
audioOutput: AudioOutput {
volume: slider.value
}
}
Slider {
id: slider
from: 0.
to: 1.
}您可以将 AudioOutput 与MediaPlayer 配合使用来播放音频内容,也可以将其与CaptureSession 配合使用,以监听由捕获会话处理的音频。
另请参阅 VideoOutput 和AudioInput 。
属性文档
device : audioDevice
该属性描述了连接到此输出的音频设备。
“设备”属性表示该输出所连接的音频设备。此属性可用于从MediaDevices.audioOutputs 列表中选择输出设备。
muted : bool
该属性用于指示音频输出是否被静音。
默认值为false 。
volume : real
该属性控制音频输出的音量。
音量按线性比例从0.0 (静音)到1.0 (最大音量)进行调整。超出此范围的值将被限制:小于 0.0 的值将设为 0.0,大于 1.0 的值将设为 1.0。
默认音量为1.0 。
UI音量控件通常应采用非线性缩放。例如,使用对数刻度会产生感知响度的线性变化,这正是用户通常对音量控件的预期。
更多详情请参阅QtMultimedia.convertVolume()。
信号文档
void deviceChanged()
当device 属性发生变化时,会触发此信号。
注意: 对应的处理程序 是onDeviceChanged 。
void mutedChanged()
当muted 属性发生变化时,会触发此信号。
注意: 相应的处理程序 为onMutedChanged 。
void volumeChanged()
当volume 属性发生变化时,会触发此信号。
注意: 相应的处理程序 为onVolumeChanged 。
© 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.