Represents an output channel for audio. 更多...
| 头: | #include <QAudioOutput> |
| CMake: |
find_package(Qt6 REQUIRED COMPONENTS Multimedia)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia) |
| qmake: | QT += multimedia |
| 实例化: | AudioOutput |
| 继承: | QObject |
| QAudioDevice | device () const |
| bool | isMuted () const |
| float | volume () const |
| void | setDevice (const QAudioDevice & device ) |
| void | setMuted (bool muted ) |
| void | setVolume (float volume ) |
| void | deviceChanged () |
| void | mutedChanged (bool muted ) |
| void | volumeChanged (float volume ) |
This class represents an output channel that can be used together with QMediaPlayer or QMediaCaptureSession . It enables the selection of the physical output device to be used, muting the channel, and changing the channel's volume.
This property holds the audio device connected to this output.
The device property represents the audio device this output is connected to. This property can be used to select an output device from the QMediaDevices::audioOutputs () list. You can select the system default audio output by setting this property to a default constructed QAudioDevice 对象。
访问函数:
| QAudioDevice | device () const |
| void | setDevice (const QAudioDevice & device ) |
通知程序信号:
| void | deviceChanged () |
此特性保持当前媒体的静音状态。
The value will be
true
if the output is muted; otherwise
false
.
访问函数:
| bool | isMuted () const |
| void | setMuted (bool muted ) |
通知程序信号:
| void | mutedChanged (bool muted ) |
This property holds the current volume.
The volume is scaled linearly, ranging from
0
(无声) 到
1
(full volume).
注意: values outside this range will be clamped.
默认情况下,音量为
1
.
UI volume controls should usually be scaled non-linearly. For example, using a logarithmic scale will produce linear changes in perceived loudness, which is what a user would normally expect from a volume control.
访问函数:
| float | volume () const |
| void | setVolume (float volume ) |
通知程序信号:
| void | volumeChanged (float volume ) |
另请参阅 QAudio::convertVolume ().