The QAudioRecorder class is used for the recording of audio. 更多...
头: | #include <QAudioRecorder> |
qmake: | QT += multimedia |
继承: | QMediaRecorder |
QAudioRecorder (QObject * parent = Q_NULLPTR) | |
~QAudioRecorder () | |
QString | audioInput () const |
QString | audioInputDescription (const QString & name ) const |
QStringList | audioInputs () const |
QString | defaultAudioInput () const |
void | setAudioInput (const QString & name ) |
void | audioInputChanged (const QString & name ) |
void | availableAudioInputsChanged () |
The QAudioRecorder class is used for the recording of audio.
The QAudioRecorder class is a high level media recording class and contains the same functionality as QMediaRecorder .
audioRecorder = new QAudioRecorder; QAudioEncoderSettings audioSettings; audioSettings.setCodec("audio/amr"); audioSettings.setQuality(QMultimedia::HighQuality); audioRecorder->setEncodingSettings(audioSettings); audioRecorder->setOutputLocation(QUrl::fromLocalFile("test.amr")); audioRecorder->record();
此外 QAudioRecorder provides functionality for selecting the audio input.
QStringList inputs = audioRecorder->audioInputs(); QString selectedInput = audioRecorder->defaultAudioInput(); foreach (QString input, inputs) { QString description = audioRecorder->audioInputDescription(input); // show descriptions to user and allow selection selectedInput = input; } audioRecorder->setAudioInput(selectedInput);
The 音频录制器范例 shows how to use this class in more detail.
另请参阅 QMediaRecorder and QAudioInputSelectorControl .
This property holds the active audio input name.
访问函数:
QString | audioInput () const |
void | setAudioInput (const QString & name ) |
通知程序信号:
void | audioInputChanged (const QString & name ) |
Constructs an audio recorder. The parent 会被传递给 QMediaObject .
Destroys an audio recorder object.
Returns the active audio input name.
注意: Getter 函数对于特性 audioInput .
另请参阅 setAudioInput ().
[signal]
void
QAudioRecorder::
audioInputChanged
(const
QString
&
name
)
Signal emitted when active audio input changes to name .
注意: 通知程序信号对于特性 audioInput .
Returns the readable translated description of the audio input device with name .
Returns a list of available audio inputs
[signal]
void
QAudioRecorder::
availableAudioInputsChanged
()
Signal is emitted when the available audio inputs change.
Returns the default audio input name.
[slot]
void
QAudioRecorder::
setAudioInput
(const
QString
&
name
)
Set the active audio input to name .
注意: Setter 函数对于特性 audioInput .
另请参阅 audioInput ().