QAudioOutput 類

錶示音頻的輸齣通道。 更多...

頭: #include <QAudioOutput>
CMake: find_package(Qt6 REQUIRED COMPONENTS Multimedia)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
qmake: QT += multimedia
在 QML: 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 )

詳細描述

此類錶示的輸齣通道可以一起使用同 QMediaPlayer or QMediaCaptureSession 。它使能夠選定要使用的物理輸齣設備、靜音通道及改變通道音量。

特性文檔編製

device : QAudioDevice

此特性保持連接到此輸齣的音頻設備。

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 ()

muted : bool

此特性保持當前媒體的靜音狀態。

The value will be true if the output is muted; otherwise false .

訪問函數:

bool isMuted () const
void setMuted (bool muted )

通知程序信號:

void mutedChanged (bool muted )

volume : float

此屬性保存當前音量。

The volume is scaled linearly, ranging from 0 (無聲) 到 1 (full volume).

注意: 值超齣此範圍將被鉗製。

默認情況下,音量為 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 )

另請參閱 QtAudio::convertVolume ().