traverso-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Traverso-commit] traverso/src/engine AudioDevice.cpp AudioDevice.h


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src/engine AudioDevice.cpp AudioDevice.h
Date: Tue, 05 Jun 2007 13:10:56 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/06/05 13:10:56

Modified files:
        src/engine     : AudioDevice.cpp AudioDevice.h 

Log message:
        added buffer underrun 'storm' detection, when detected, switch to 
        Null Driver, and inform the user...

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/engine/AudioDevice.cpp?cvsroot=traverso&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/traverso/src/engine/AudioDevice.h?cvsroot=traverso&r1=1.16&r2=1.17

Patches:
Index: AudioDevice.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/engine/AudioDevice.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- AudioDevice.cpp     4 Jun 2007 08:53:39 -0000       1.30
+++ AudioDevice.cpp     5 Jun 2007 13:10:55 -0000       1.31
@@ -17,7 +17,7 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
 
-$Id: AudioDevice.cpp,v 1.30 2007/06/04 08:53:39 r_sijrier Exp $
+$Id: AudioDevice.cpp,v 1.31 2007/06/05 13:10:55 r_sijrier Exp $
 */
 
 #include "AudioDevice.h"
@@ -145,6 +145,7 @@
        driver = 0;
        audioThread = 0;
        m_bufferSize = 1024;
+       m_xrunCount = 0;
        m_cpuTime = new RingBufferNPT<trav_time_t>(4096);
 
        m_driverType = tr("No Driver Loaded");
@@ -171,6 +172,8 @@
        // from here by for example the jack driver which could initialize tsar 
        // from within the _jack client thread_ which makes the whole thing 
_fail_
        tsar();
+       
+       connect(this, SIGNAL(xrunStormDetected()), this, 
SLOT(switch_to_null_driver()));
 }
 
 AudioDevice::~AudioDevice()
@@ -318,6 +321,7 @@
 
        m_rate = rate;
        m_bufferSize = bufferSize;
+       m_xrunCount = 0;
 
        shutdown();
 
@@ -719,6 +723,11 @@
 void AudioDevice::xrun( )
 {
        RT_THREAD_EMIT(this, NULL, bufferUnderRun());
+       
+       m_xrunCount++;
+       if (m_xrunCount > 30) {
+               RT_THREAD_EMIT(this, NULL, xrunStormDetected());
+       }
 }
 
 #if defined (JACK_SUPPORT)
@@ -740,4 +749,12 @@
 }
 #endif
 
+void AudioDevice::switch_to_null_driver()
+{
+       info().critical(tr("AudioDevice:: Buffer underrun 'Storm' detected, 
switching to Null Driver"));
+       info().information(tr("AudioDevice:: If you have an Intel integrated 
audio card, please try using 3 periods, see Settings Dialog, Audio Driver"));
+       set_parameters(44100, m_bufferSize, "Null Driver");
+}
+
 //eof
+

Index: AudioDevice.h
===================================================================
RCS file: /sources/traverso/traverso/src/engine/AudioDevice.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- AudioDevice.h       22 Mar 2007 15:59:23 -0000      1.16
+++ AudioDevice.h       5 Jun 2007 13:10:56 -0000       1.17
@@ -17,7 +17,7 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
 
-$Id: AudioDevice.h,v 1.16 2007/03/22 15:59:23 r_sijrier Exp $
+$Id: AudioDevice.h,v 1.17 2007/06/05 13:10:56 r_sijrier Exp $
 */
 
 #ifndef AUDIODEVICE_H
@@ -152,6 +152,7 @@
        uint                    m_bufferSize;
        uint                    m_rate;
        uint                    m_bitdepth;
+       uint                    m_xrunCount;
        QString                 m_driverType;
 
        int run_one_cycle(nframes_t nframes, float delayed_usecs);
@@ -226,10 +227,13 @@
         */
        void clientRemoved(Client*);
 
+       void xrunStormDetected();
+
 private slots:
        void private_add_client(Client* client);
        void private_remove_client(Client* client);
        void audiothread_finished();
+       void switch_to_null_driver();
 #if defined (JACK_SUPPORT)
        void check_jack_shutdown();
 #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]