summaryrefslogtreecommitdiffstats
path: root/examples/multimedia/audiooutput/audiooutput.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/multimedia/audiooutput/audiooutput.cpp')
-rw-r--r--examples/multimedia/audiooutput/audiooutput.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/multimedia/audiooutput/audiooutput.cpp b/examples/multimedia/audiooutput/audiooutput.cpp
index 4e74a25..93020bc 100644
--- a/examples/multimedia/audiooutput/audiooutput.cpp
+++ b/examples/multimedia/audiooutput/audiooutput.cpp
@@ -132,9 +132,9 @@ void Generator::generateData(const QAudioFormat &format, qint64 durationUs, int
qint64 Generator::readData(char *data, qint64 len)
{
qint64 total = 0;
- while (len - total) {
+ while (len - total > 0) {
const qint64 chunk = qMin((m_buffer.size() - m_pos), len - total);
- memcpy(data, m_buffer.constData() + m_pos, chunk);
+ memcpy(data + total, m_buffer.constData() + m_pos, chunk);
m_pos = (m_pos + chunk) % m_buffer.size();
total += chunk;
}