diff options
Diffstat (limited to 'examples/multimedia/audiooutput/audiooutput.cpp')
-rw-r--r-- | examples/multimedia/audiooutput/audiooutput.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/multimedia/audiooutput/audiooutput.cpp b/examples/multimedia/audiooutput/audiooutput.cpp index bc2324e..451cc67 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; } |