title: Qt - Using QAudioProbe with QMediaPlayer
body: <p>I am trying to use the <code>QAudioProbe</code> class with <code>QMediaPlayer</code> but I can't seem to get it working. As suggested <a href="https://stackoverflow.com/questions/23339741/audio-visualization-with-qmediaplayer">here</a>, I'm using it to create an audio visualizer.  I had the following:</p>
  
  <pre><code>QMediaPlayer* player = new QMediaPlayer;
  QAudioProbe* probe = new QAudioProbe;
  
  // note: processBuffer() is a custom slot
  connect(probe, SIGNAL(audioBufferProbed(QAudioBuffer)),
          this, SLOT(processBuffer(QAudioBuffer)));
  
  if(!probe-&gt;setSource(player))
      cout &lt;&lt; "Source for AudioProbe not set!" &lt;&lt; endl;
  </code></pre>
  
  <p>Whenever I tried to set <code>player</code> as the source for <code>probe</code>, it returned <code>false</code>.</p>
  
  <p>Next, I tried setting the media for <code>player</code> <em>before</em> setting it as the source for <code>probe</code>.</p>
  
  <pre><code>player-&gt;setMedia(...);
  
  if(!probe-&gt;setSource(player))
      cout &lt;&lt; "Source for AudioProbe not set!" &lt;&lt; endl;
  
  player-&gt;play();
  </code></pre>
  
  <p>Still returns false. I've been looking online for a while now but no luck. Any suggestions to get this working?</p>
  
  <p>Suggestions for other methods of receiving data from <code>QMediaPlayer</code> are also welcomed. However, I would prefer to use Qt classes.</p>