Git commit 51b4ab3b121a70821b78ba7b5d6ccb5b4c20ce97 by Laszlo Papp. Committed on 01/12/2011 at 02:33. Pushed by lpapp into branch 'master'. Fix the looping operation in order to get the decoded data into the buffer M +11 -1 src/qalcontext.cpp M +1 -3 src/qalsndaudiodecoder.cpp http://commits.kde.org/qtopenal/51b4ab3b121a70821b78ba7b5d6ccb5b4c20ce97 diff --git a/src/qalcontext.cpp b/src/qalcontext.cpp index 936e133..20c50a4 100644 --- a/src/qalcontext.cpp +++ b/src/qalcontext.cpp @@ -187,7 +187,15 @@ QALContext::cacheBuffer(const QString& filename) if (qalSndAudioDecoder.open(filename) =3D=3D false) return 0; = - // buffer =3D loadFromFile(filename); + QByteArray decodedData; + QByteArray tmpData; + int maxlen =3D qalSndAudioDecoder.channels() * qalSndAudioDecoder.= sampleRate() * qalSndAudioDecode.sampleSize(); + + while ((tmpData =3D qalSndAudioDecoder.decode(maxlen))) { + decodedData.append(tmpData); + if (tmpData.size() !=3D maxlen) + break; + } = ALenum error; if ((error =3D alGetError()) !=3D AL_NO_ERROR) { @@ -201,6 +209,8 @@ QALContext::cacheBuffer(const QString& filename) return 0; }; = + + d->loadedBuffers.insert(filename, buffer); } = diff --git a/src/qalsndaudiodecoder.cpp b/src/qalsndaudiodecoder.cpp index 9eed040..bb23b66 100644 --- a/src/qalsndaudiodecoder.cpp +++ b/src/qalsndaudiodecoder.cpp @@ -211,10 +211,8 @@ QALSndAudioDecoder::decode(qint64 maxlen) = char *decodedData =3D result.data(); = - if (maxlen !=3D decode(decodedData, maxlen)) { + if (maxlen !=3D decode(decodedData, maxlen)) qWarning() << Q_FUNC_INFO << "Could not to decode all the data:" <= < maxlen; - return QByteArray(); - } = return result; }