Enable QSoundEffect with loopCount of Infinite to play
authorAndy Nichols <andy.nichols@digia.com>
Tue, 13 Aug 2013 13:16:54 +0000 (15:16 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Tue, 13 Aug 2013 16:40:59 +0000 (18:40 +0200)
Previously if the loopCount property of a QSoundEffect was set to
QSoundEffect::Infinite then no sound would be played at all.  This is
because QSoundEffect::Infinite == -2 and playback was only continued on
values above 0.

Task-number: QTBUG-32882

Change-Id: I739919a3e538128fc16f26ede5eb6cc4f2eb29fb
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
src/multimedia/audio/qsoundeffect_qaudio_p.cpp

index 835f60b..524c856 100644 (file)
@@ -369,7 +369,7 @@ void PrivateSoundSource::stateChanged(QAudio::State state)
 
 qint64 PrivateSoundSource::readData( char* data, qint64 len)
 {
-    if (m_runningCount > 0 && m_playing) {
+    if ((m_runningCount > 0  || m_runningCount == QSoundEffect::Infinite) && m_playing) {
 
         if (m_sample->state() != QSample::Ready)
             return 0;