4

I am trying to use the QAudioProbe class with QMediaPlayer but I can't seem to get it working. As suggested here, I'm using it to create an audio visualizer. I had the following:

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->setSource(player))
    cout << "Source for AudioProbe not set!" << endl;

Whenever I tried to set player as the source for probe, it returned false.

Next, I tried setting the media for player before setting it as the source for probe.

player->setMedia(...);

if(!probe->setSource(player))
    cout << "Source for AudioProbe not set!" << endl;

player->play();

Still returns false. I've been looking online for a while now but no luck. Any suggestions to get this working?

Suggestions for other methods of receiving data from QMediaPlayer are also welcomed. However, I would prefer to use Qt classes.

Community
  • 1
  • 1
aanrv
  • 2,159
  • 5
  • 25
  • 37
  • 1
    which Qt version and which platform are you using? this feature seems to be available only for specific platforms according to http://comments.gmane.org/gmane.comp.lib.qt.user/10973 – m.s. Apr 17 '15 at 22:25
  • 2
    @m.s. I'm using Qt 5.4.0 and OSx. According to the link you gave me, OSx is not supported by `QAudioProbe`. I wish the supported platforms for a class were written in plain sight in the documentation. – aanrv Apr 18 '15 at 00:53
  • *Copied from answer by Simon Drouin*: The complete list of supported/unsupported features of QtMultimedia, by platform, can be found [here](http://wiki.qt.io/Qt_5.5.0_Multimedia_Backends). Unfortunately, a lot of features don't work in OSX. – Bowdzone Nov 13 '15 at 06:47
  • Did you ever solves this? I am having the same issue (OSX, etc). See: http://stackoverflow.com/questions/34096322/generating-a-waveform-from-an-audio-or-video-file – spring Dec 05 '15 at 17:39
  • @TOMATO No. OSx doesn't support `QAudioProbe`. Take a look at the [link](http://wiki.qt.io/Qt_5.5.0_Multimedia_Backends) provided by Bowdzone. – aanrv Dec 06 '15 at 18:45
  • @JeffersonSteelflex – thanks. Yes, I wasted a day. Thanks Qt documentation. . . – spring Dec 06 '15 at 19:01

0 Answers0