Ask / Submit

QAudioOutput isn't integrated with system volume and libresource like QMediaPlayer

asked 2013-12-24 19:57:47 +0200

Elleo gravatar image

updated 2013-12-24 21:42:27 +0200

Currently if you create an application that uses QMediaPlayer you get automatic integration with the system volume control and with libresource. Unfortunately this isn't the case if you're using the lower level QAudioOutput mechanism in QtMultimedia, this leads to apps being less well integrated with overall sound system as they have to implement everything themselves.

This is of particular interest for CuteSpotify, as it has to use QAudioOutput to handle the raw audio packets sent from libspotify.


edit retag flag offensive close delete


Would it be possible to rewrite it to use QMediaPlayer instead? Looking at the code it seems that all buffering is done in qspotifysession.cpp, correct? If so it should be pretty straightforward and maybe, just maybe, you will find a pull request from me, if such rewrite is interesting.

Mohjive ( 2014-01-03 00:42:37 +0200 )edit

I could be mistaken, but as far as I'm aware there's no real mechanism for constantly pushing data to a QMediaPlayer element. Instead we'd have to wait for the entire song to buffer and wrap it in a QMediaResource before sending it to a QMediaPlayer, which wouldn't be terribly practical.

Elleo ( 2014-01-03 00:54:02 +0200 )edit

And I would suspect that due to the gstreamer pipeline setup and teardown involved in changing QMediaPlayer sources, sending multiple QMediaResources containing small chunks of a song would result in rather choppy playback (and a fair amount of extra overhead).

Elleo ( 2014-01-03 00:55:58 +0200 )edit

I'd be very happy if you prove me wrong though ;)

Elleo ( 2014-01-03 00:56:26 +0200 )edit

Does this question means we can adjust volume when phone is locked? Like every other phone?

@Elleo, thanks for the Spotify app!

BonoNL ( 2014-01-04 21:21:32 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2013-12-30 19:14:13 +0200

Robin Burchell _ w00t gravatar image

updated 2014-01-17 17:20:38 +0200

Known issue. I will see what we can do :)

Update (17th Jan 2014): I've written code that should (theoretically) fix the volume handling issues with QAudioOutput. I still need to tidy things up, test it, and upstream it - but it should be sorted out within the next few updates. I appreciate your patience.

Update (8 Jan 2014): I've written some early code handling resource policy bits, but I need to talk to our sound/policy expert about a few bits and pieces. I also need to talk to him about volume control. Unfortunately, he isn't back from holiday just yet.

edit flag offensive delete publish link more


Excellent, thanks very much :)

Elleo ( 2013-12-30 19:19:43 +0200 )edit

Thanks for the update :)

Elleo ( 2014-01-17 17:31:25 +0200 )edit

Great to read that :) Will that fix also be for QtMultimedia 5.0's SoundEffect? And for the meantime, is there an API or some way to read the current system value?

Alessandro Portale ( 2014-02-04 15:06:58 +0200 )edit

Will this fix be included in the February-Update?

yoktobit ( 2014-02-14 13:14:55 +0200 )edit

As Alessandro, I am too interested in a fix for the SoundEffect. Also, I suppose, in routing SoundEffect audio to Bluetooth if a handsfree/A2DP set is paired.

mikelima ( 2014-02-24 10:18:17 +0200 )edit
Login/Signup to Answer

Question tools



Asked: 2013-12-24 19:57:47 +0200

Seen: 1,403 times

Last updated: Jan 17 '14