summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens.qnx@kdab.com>2012-08-30 15:43:13 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-08 08:37:35 +0200
commit2f2b31731814ad93e7e6e56d4815ac85135e719c (patch)
tree4f5f0a357b49ef8bff21d99340847b5c40dcc987
parent690b4c4978bc050c31d8768578b5d78cbbc6c398 (diff)
Don't add the beginning of the file to the end of the last period
If we're in the last loop, it is not necessary to provide a full period on read. Just provide the remaining of the data and hit the end of the stream by returning less than requested, otherwise we potentially generate some garbage noise. Change-Id: I9d3a632ddc0c3289957c9f876d5dbe2999b50ebd Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
-rw-r--r--src/multimedia/audio/qsoundeffect_qaudio_p.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/multimedia/audio/qsoundeffect_qaudio_p.cpp b/src/multimedia/audio/qsoundeffect_qaudio_p.cpp
index ef5ff2d3c..785cdb556 100644
--- a/src/multimedia/audio/qsoundeffect_qaudio_p.cpp
+++ b/src/multimedia/audio/qsoundeffect_qaudio_p.cpp
@@ -412,6 +412,9 @@ qint64 PrivateSoundSource::readData( char* data, qint64 len)
dataOffset += (sampleSize - m_offset);
m_offset = 0;
+ if (m_runningCount > 0 && m_runningCount != QSoundEffect::Infinite)
+ soundeffect->setLoopsRemaining(m_runningCount-1);
+
if (m_runningCount > 0 || m_runningCount == QSoundEffect::Infinite) {
// There are still more loops of this sound to play, append the start of sound to make up full period
memcpy(data + dataOffset, sampleData + m_offset, wrapLen);
@@ -423,8 +426,6 @@ qint64 PrivateSoundSource::readData( char* data, qint64 len)
<< ", part2=" << wrapLen;
qDebug() << "part1 + part2 should be a period " << periodSize;
#endif
- if (m_runningCount != QSoundEffect::Infinite)
- soundeffect->setLoopsRemaining(m_runningCount-1);
}
}
if (m_runningCount == 0)