The QAudioRecorder class is used for the recording of audio. More...
Header: | #include <QAudioRecorder> |
qmake: | QT += multimedia |
Inherits: | QMediaRecorder |
QAudioRecorder(QObject *parent = nullptr) | |
virtual | ~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 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();
In addition QAudioRecorder provides functionality for selecting the audio input.
const QStringList inputs = audioRecorder->audioInputs(); QString selectedInput = audioRecorder->defaultAudioInput(); for (const QString &input : inputs) { QString description = audioRecorder->audioInputDescription(input); // show descriptions to user and allow selection selectedInput = input; } audioRecorder->setAudioInput(selectedInput);
The Audio Recorder Example shows how to use this class in more detail.
See also QMediaRecorder and QAudioInputSelectorControl.
This property holds the active audio input name.
Access functions:
QString | audioInput() const |
void | setAudioInput(const QString &name) |
Notifier signal:
void | audioInputChanged(const QString &name) |
Constructs an audio recorder. The parent is passed to QMediaObject.
[signal]
void QAudioRecorder::audioInputChanged(const QString &name)
Signal emitted when active audio input changes to name.
Note: Notifier signal for property audioInput.
[signal]
void QAudioRecorder::availableAudioInputsChanged()
Signal is emitted when the available audio inputs change.
[slot]
void QAudioRecorder::setAudioInput(const QString &name)
Set the active audio input to name.
Note: Setter function for property audioInput.
See also audioInput().
[virtual]
QAudioRecorder::~QAudioRecorder()
Destroys an audio recorder object.
Returns the active audio input name.
Note: Getter function for property audioInput.
See also setAudioInput().
Returns the readable translated description of the audio input device with name.
Returns a list of available audio inputs
Returns the default audio input name.
© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-5.15/qaudiorecorder.html