diff audio/AudioCallbackRecordTarget.cpp @ 609:96b605673585

Fix failure to call updateModel() ever again after no frames available
author Chris Cannam
date Wed, 08 Aug 2018 15:17:36 +0100
parents 8cc291b13f2b
children 37b23e50832b
line wrap: on
line diff
--- a/audio/AudioCallbackRecordTarget.cpp	Wed Jul 04 16:05:56 2018 +0100
+++ b/audio/AudioCallbackRecordTarget.cpp	Wed Aug 08 15:17:36 2018 +0100
@@ -22,6 +22,10 @@
 #include <QDir>
 #include <QTimer>
 
+//#define DEBUG_AUDIO_CALLBACK_RECORD_TARGET 1
+
+static const int recordUpdateTimeout = 200; // ms
+
 AudioCallbackRecordTarget::AudioCallbackRecordTarget(ViewManagerBase *manager,
                                                      QString clientName) :
     m_viewManager(manager),
@@ -149,6 +153,12 @@
     }
 
     if (nframes == 0) {
+#ifdef DEBUG_AUDIO_CALLBACK_RECORD_TARGET
+        cerr << "AudioCallbackRecordTarget::updateModel: no frames available" << endl;
+#endif 
+        if (m_recording) {
+            QTimer::singleShot(recordUpdateTimeout, this, SLOT(updateModel()));
+        }    
         return;
     }