summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-04-07 15:18:17 +0200
committerLars Knoll <lars.knoll@qt.io>2021-04-08 12:19:52 +0000
commit77acd3cb4a1974d88e795a3369d74eccfd730e4f (patch)
tree90c20769b3c2e3f8e37544f91bd476d7b84768ab /examples
parent1730f47fe18772f48b42b8e4dbec527889ae2ef3 (diff)
Remove the notifyInterval() functionality
This was nothing else than a timer, something you can just as well implement on top of Qt Multimedia if required. Change-Id: I1ef362f1f4ad5a5f85e92bfbb1d73b7710271e5c Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/multimedia/spectrum/app/engine.cpp14
-rw-r--r--examples/multimedia/spectrum/app/engine.h2
2 files changed, 10 insertions, 6 deletions
diff --git a/examples/multimedia/spectrum/app/engine.cpp b/examples/multimedia/spectrum/app/engine.cpp
index 6451e940c..81cc104c1 100644
--- a/examples/multimedia/spectrum/app/engine.cpp
+++ b/examples/multimedia/spectrum/app/engine.cpp
@@ -133,6 +133,11 @@ Engine::Engine(QObject *parent)
#ifdef DUMP_SPECTRUM
m_spectrumAnalyser.setOutputPath(outputPath());
#endif
+
+ m_notifyTimer = new QTimer(this);
+ m_notifyTimer->setInterval(1000);
+ connect(m_notifyTimer, &QTimer::timeout, this, &Engine::audioNotify);
+
}
Engine::~Engine() = default;
@@ -243,8 +248,6 @@ void Engine::startRecording()
m_mode = QAudio::AudioInput;
connect(m_audioInput, &QAudioInput::stateChanged,
this, &Engine::audioStateChanged);
- connect(m_audioInput, &QAudioInput::notify,
- this, &Engine::audioNotify);
m_count = 0;
m_dataLength = 0;
@@ -253,6 +256,7 @@ void Engine::startRecording()
connect(m_audioInputIODevice, &QIODevice::readyRead,
this, &Engine::audioDataReady);
}
+ m_notifyTimer->start();
}
}
@@ -276,8 +280,6 @@ void Engine::startPlayback()
m_mode = QAudio::AudioOutput;
connect(m_audioOutput, &QAudioOutput::stateChanged,
this, &Engine::audioStateChanged);
- connect(m_audioOutput, &QAudioOutput::notify,
- this, &Engine::audioNotify);
m_count = 0;
if (m_file) {
@@ -292,6 +294,7 @@ void Engine::startPlayback()
m_audioOutput->start(&m_audioOutputIODevice);
}
}
+ m_notifyTimer->start();
}
}
@@ -307,6 +310,7 @@ void Engine::suspend()
m_audioOutput->suspend();
break;
}
+ m_notifyTimer->stop();
}
}
@@ -515,12 +519,10 @@ bool Engine::initialize()
} else {
emit bufferChanged(0, 0, m_buffer);
m_audioInput = new QAudioInput(m_audioInputDevice, m_format, this);
- m_audioInput->setNotifyInterval(NotifyIntervalMs);
result = true;
}
}
m_audioOutput = new QAudioOutput(m_audioOutputDevice, m_format, this);
- m_audioOutput->setNotifyInterval(NotifyIntervalMs);
m_audioOutput->setCategory(m_audioOutputCategory);
}
} else {
diff --git a/examples/multimedia/spectrum/app/engine.h b/examples/multimedia/spectrum/app/engine.h
index 5884860c3..f403afb80 100644
--- a/examples/multimedia/spectrum/app/engine.h
+++ b/examples/multimedia/spectrum/app/engine.h
@@ -63,6 +63,7 @@
#include <QObject>
#include <QMediaDeviceManager>
#include <QWaveDecoder>
+#include <QTimer>
#ifdef DUMP_CAPTURED_AUDIO
#define DUMP_DATA
@@ -318,6 +319,7 @@ private:
qint64 m_spectrumPosition;
int m_count;
+ QTimer *m_notifyTimer = nullptr;
#ifdef DUMP_DATA
QDir m_outputDir;