QAudioRecorder Class

The QAudioRecorder class is used for the recording of audio. More...

Header: #include <QAudioRecorder>
qmake: QT += multimedia
Inherits: QMediaRecorder

Properties

Public Functions

QAudioRecorder(QObject *parent = nullptr)
virtual ~QAudioRecorder()
QString audioInput() const
QString audioInputDescription(const QString &name) const
QStringList audioInputs() const
QString defaultAudioInput() const

Public Slots

void setAudioInput(const QString &name)

Signals

void audioInputChanged(const QString &name)
void availableAudioInputsChanged()

Additional Inherited Members

Detailed Description

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

In addition 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 Audio Recorder Example shows how to use this class in more detail.

See also QMediaRecorder and QAudioInputSelectorControl.

Property Documentation

audioInput : QString

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)

Member Function Documentation

QAudioRecorder::QAudioRecorder(QObject *parent = nullptr)

Constructs an audio recorder. The parent is passed to QMediaObject.

[virtual] QAudioRecorder::~QAudioRecorder()

Destroys an audio recorder object.

QString QAudioRecorder::audioInput() const

Returns the active audio input name.

Note: Getter function for property audioInput.

See also setAudioInput().

[signal] void QAudioRecorder::audioInputChanged(const QString &name)

Signal emitted when active audio input changes to name.

Note: Notifier signal for property audioInput.

QString QAudioRecorder::audioInputDescription(const QString &name) const

Returns the readable translated description of the audio input device with name.

QStringList QAudioRecorder::audioInputs() const

Returns a list of available audio inputs

[signal] void QAudioRecorder::availableAudioInputsChanged()

Signal is emitted when the available audio inputs change.

QString QAudioRecorder::defaultAudioInput() const

Returns the default audio input name.

[slot] void QAudioRecorder::setAudioInput(const QString &name)

Set the active audio input to name.

Note: Setter function for property audioInput.

See also audioInput().

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support