summaryrefslogtreecommitdiff
path: root/examples/multimedia/spectrum
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-06-03 10:21:37 +0200
committerLars Knoll <lars.knoll@qt.io>2021-06-04 14:15:43 +0200
commitaa1f073a32147d147e4e9a0fee9dde8ccc30531e (patch)
tree0ac28cc3422f2258464f3043cf48443c60e13986 /examples/multimedia/spectrum
parentdb4eb8383517bb94651b5b3e5768ae7eaaee7093 (diff)
downloadqtmultimedia-aa1f073a32147d147e4e9a0fee9dde8ccc30531e.tar.gz
Rename QAudioInput to QAudioSource
The renaming is a part of some changes coming from an API review that tries to solve the problem of not having API symmetry between QCameraInfo/QCamera and QAudioDeviceInfo where QAudioDevice is missing (so you can't select a nullptr as the input/output device to disable it). One issue is that QAudioInput/QAudioOutput are there for reading and writing low level PCM data from an audio device. They as such are not quite suitable as classes to use together with QMediaPlayer or QMediaCaptureSession, as they allow direct writing of data bypassing the player or capture pipeline. To solve this, we renamve those classes to QAudioSource/Sink (making it a bit more symmetric with QVideoSink). That opens up our API space for a QAudioDevice class avoiding names that feel like they are doing the same thing. The patch also renames things on the backend side to keep API and implementation consistent. Change-Id: I9f6b4892d3eee4e252cb3782e681b0c3824f27e2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'examples/multimedia/spectrum')
-rw-r--r--examples/multimedia/spectrum/app/engine.cpp6
-rw-r--r--examples/multimedia/spectrum/app/engine.h4
2 files changed, 5 insertions, 5 deletions
diff --git a/examples/multimedia/spectrum/app/engine.cpp b/examples/multimedia/spectrum/app/engine.cpp
index 8353d3d47..8785d62f0 100644
--- a/examples/multimedia/spectrum/app/engine.cpp
+++ b/examples/multimedia/spectrum/app/engine.cpp
@@ -54,7 +54,7 @@
#include <math.h>
-#include <QAudioInput>
+#include <QAudioSource>
#include <QAudioOutput>
#include <QCoreApplication>
#include <QDebug>
@@ -236,7 +236,7 @@ void Engine::startRecording()
setRecordPosition(0, true);
stopPlayback();
m_mode = QAudio::AudioInput;
- connect(m_audioInput, &QAudioInput::stateChanged,
+ connect(m_audioInput, &QAudioSource::stateChanged,
this, &Engine::audioStateChanged);
m_count = 0;
@@ -508,7 +508,7 @@ bool Engine::initialize()
result = true;
} else {
emit bufferChanged(0, 0, m_buffer);
- m_audioInput = new QAudioInput(m_audioInputDevice, m_format, this);
+ m_audioInput = new QAudioSource(m_audioInputDevice, m_format, this);
result = true;
}
}
diff --git a/examples/multimedia/spectrum/app/engine.h b/examples/multimedia/spectrum/app/engine.h
index 97c2c7f41..40ffdfbb3 100644
--- a/examples/multimedia/spectrum/app/engine.h
+++ b/examples/multimedia/spectrum/app/engine.h
@@ -75,7 +75,7 @@
class FrequencySpectrum;
QT_BEGIN_NAMESPACE
-class QAudioInput;
+class QAudioSource;
class QAudioOutput;
QT_END_NAMESPACE
@@ -293,7 +293,7 @@ private:
const QList<QAudioDeviceInfo> m_availableAudioInputDevices;
QAudioDeviceInfo m_audioInputDevice;
- QAudioInput* m_audioInput;
+ QAudioSource* m_audioInput;
QIODevice* m_audioInputIODevice;
qint64 m_recordPosition;