#include <QSampleCache>
Inherits QObject (private).
This class was introduced in Qt Mobility 1.1.
| QSampleCache () | |
| ~QSampleCache () | |
| QSample * | requestSample ( const QUrl & url ) | 
| void | setCapacity ( qint64 capacity ) | 
When you want to get a sound sample data, you need to request the QSample reference from QSampleCache.
   QSample *m_sample;     // class member.
 private Q_SLOTS:
   void decoderError();
   void sampleReady();
 Q_GLOBAL_STATIC(QSampleCache, sampleCache) //declare a singleton manager
   m_sample = sampleCache()->requestSample(url);
   switch(m_sample->state()) {
   case QSample::Ready:
       sampleReady();
       break;
   case QSample::Error:
       decoderError();
       break;
   default:
       connect(m_sample, SIGNAL(error()), this, SLOT(decoderError()));
       connect(m_sample, SIGNAL(ready()), this, SLOT(sampleReady()));
       break;
   }
When you no longer need the sound sample data, you need to release it:
  if (m_sample) {
      m_sample->release();
      m_sample = 0;
  }