title: How to use QtMultimedia to play a wav file?
body: <p>My current code is:</p>
  
  <pre><code>void Sound::run() {
      QFile audio_file(mResourcePath);
      if(audio_file.open(QIODevice::ReadOnly)) {
          audio_file.seek(44); // skip wav header
          QByteArray audio_data = audio_file.readAll();
          audio_file.close();
  
          QBuffer* audio_buffer = new QBuffer(&amp;audio_data);
          qDebug() &lt;&lt; audio_buffer-&gt;size();
  
          QAudioFormat format;
  
          format.setSampleSize(16);
          format.setSampleRate(44100);
          format.setChannelCount(2);
          format.setCodec("audio/pcm");
          format.setByteOrder(QAudioFormat::LittleEndian);
          format.setSampleType(QAudioFormat::UnSignedInt);
  
          QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
          if (!info.isFormatSupported(format)) {
              qWarning()&lt;&lt;"raw audio format not supported by backend, cannot play audio.";
              return;
          }
          qDebug() &lt;&lt; info.deviceName();
  
          QAudioOutput* output = new QAudioOutput(info, format);
          output-&gt;start(audio_buffer);
      }
  }
  </code></pre>
  
  <p>This whole thing is started as a QRunnable in a QThreadPool and that part works fine. Problem is I never get any audio. My sound device is operational, the buffer is filled. I don't know what's wrong. I use app.exec(). Help appreciated.</p>