summaryrefslogtreecommitdiffstats
path: root/examples/audiolevels
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2013-10-09 14:32:16 +0300
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2013-10-10 08:26:29 +0300
commit4891e671c5df80fd132569ef8c0ed2d4c5748b93 (patch)
tree46e8df749c585729f89961c835249c6141c68039 /examples/audiolevels
parent88014cb6ba401c505fb9d26bbd265424aacce18b (diff)
Fix audiolevels slow framerate in mac
Making the audio input buffer smaller in mac as it seems not to call writeData until buffer is full. Change-Id: I198abef235d5b473161d9696c007261828e11b56 Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'examples/audiolevels')
-rw-r--r--examples/audiolevels/audiolevels.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/audiolevels/audiolevels.cpp b/examples/audiolevels/audiolevels.cpp
index d2038630..e1788936 100644
--- a/examples/audiolevels/audiolevels.cpp
+++ b/examples/audiolevels/audiolevels.cpp
@@ -57,6 +57,12 @@ AudioLevels::AudioLevels(Q3DBars *graph, QObject *parent)
QAudioDeviceInfo inputDevices = QAudioDeviceInfo::defaultInputDevice();
m_audioInput = new QAudioInput(inputDevices, formatAudio, this);
+#ifdef Q_OS_MAC
+ // Mac seems to wait for entire buffer to fill before calling writeData, so use smaller buffer
+ m_audioInput->setBufferSize(256);
+#else
+ m_audioInput->setBufferSize(1024);
+#endif
m_device = new AudioLevelsIODevice(m_graph->activeDataProxy(), this);
m_device->open(QIODevice::WriteOnly);