QAudioProbe Class

The QAudioProbe class allows you to monitor audio being played or recorded. More...

Header: #include <QAudioProbe>
qmake: QT += multimedia
Inherits: QObject.

Public Functions

QAudioProbe(QObject * parent = 0)
~QAudioProbe()
bool isActive() const
bool setSource(QMediaObject * source)
bool setSource(QMediaRecorder * mediaRecorder)
  • 31 public functions inherited from QObject

Signals

void audioBufferProbed(const QAudioBuffer & buffer)
void flush()

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 11 static public members inherited from QObject
  • 9 protected functions inherited from QObject

Detailed Description

The QAudioProbe class allows you to monitor audio being played or recorded.

QAudioRecorder *recorder = new QAudioRecorder();
QAudioProbe *probe = new QAudioProbe;

// ... configure the audio recorder (skipped)

connect(probe, SIGNAL(audioBufferProbed(QAudioBuffer)), this, SLOT(processBuffer(QAudioBuffer)));

probe->setSource(recorder); // Returns true, hopefully.

recorder->record(); // Now we can do things like calculating levels or performing an FFT

See also QVideoProbe, QMediaPlayer, and QCamera.

Member Function Documentation

QAudioProbe::​QAudioProbe(QObject * parent = 0)

Creates a new QAudioProbe class with a parent. After setting the source to monitor with setSource(), the audioBufferProbed() signal will be emitted when audio buffers are flowing in the source media object.

QAudioProbe::​~QAudioProbe()

Destroys this probe and disconnects from any media object.

[signal] void QAudioProbe::​audioBufferProbed(const QAudioBuffer & buffer)

This signal should be emitted when an audio buffer is processed in the media service.

[signal] void QAudioProbe::​flush()

This signal should be emitted when it is required to release all buffers. Application must release all outstanding references to audio buffers.

bool QAudioProbe::​isActive() const

Returns true if this probe is monitoring something, or false otherwise.

The source being monitored does not need to be active.

bool QAudioProbe::​setSource(QMediaObject * source)

Sets the media object to monitor to source.

If source is zero, this probe will be deactivated and this function wil return true.

If the media object does not support monitoring audio, this function will return false.

The previous object will no longer be monitored. Passing in the same object will be ignored, but monitoring will continue.

bool QAudioProbe::​setSource(QMediaRecorder * mediaRecorder)

Starts monitoring the given mediaRecorder.

Returns true on success.

If there is no mediaObject associated with mediaRecorder, or if it is zero, this probe will be deactivated and this function wil return true.

If the media recorder instance does not support monitoring audio, this function will return false.

Any previously monitored objects will no longer be monitored. Passing in the same (valid) object will be ignored, but monitoring will continue.

© 2015 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.