[Interest] Setting the Volume of QMediaPlayer conflict

Jason Kretzer Jason at gocodigo.com
Mon Sep 22 22:00:17 CEST 2014


Ah, found this.  https://codereview.qt-project.org/#/c/79918/  Unfortunately, I am not familiar with what branch is associated to what version for Qt.  This says it has been merged into the stable branch.  However, I assume that it has not made it into 5.3.1 yet as the problem does persist — unless I am incorrectly coding the below.

-Jason

On Sep 22, 2014, at 3:45 PM, interest-bounces+jason=gocodigo.com at qt-project.org wrote:

> Hello all,
> 
> I am using the code below to instantiate two QMediaPlayer instances.  I want the first one to play at a lower volume than the second.  So, I set each volume accordingly, the first player to 1 and the second player to 95.  However, they both end up playing at the same volume (95).  If I remove the second player, the first player will play at a low level as it is supposed to.  Adding the in the second block however adjusts both.  The two qdebug statements at the end contradict what happens though as it shows that each volume is set appropriately, though if you listen it is obviously not the case.  Is there a trick that I am missing?  Thanks!
> 
> Qt 5.3.1, Win 7, VS2010
> 
> 
> QMediaPlayer *player = new QMediaPlayer;
>    player->setMedia(QUrl::fromLocalFile("C:/Users/jasonkretzer/Desktop/audio/whippedintoshape.mp3"));
>    player->setVolume(1);
>    player->play();
> 
>    qDebug() << "player volume: " << player->volume();
> 
>    QMediaPlayer *player2 = new QMediaPlayer;
>    player2->setMedia(QUrl::fromLocalFile("C:/Users/jasonkretzer/Desktop/audio/1to20.m4a"));
>    player2->setVolume(95);
>    player2->play();
> 
>    qDebug() << "player volume: " << player->volume();
>    qDebug() << "player2 volume: " << player2->volume();
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
> 
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2014.0.4765 / Virus Database: 4015/8233 - Release Date: 09/18/14





More information about the Interest mailing list