[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] phonon audio volume setting problem
From:       Stephen Gava <elguavas () gmail ! com>
Date:       2012-03-30 4:06:15
Message-ID: 4F753137.9060307 () gmail ! com
[Download RAW message or body]

hi there.

i'm using phonon to play some sounds but i can't seem to control the 
audio output volume as i expect to be able to.

i set up phonon like so:

self.sfx_output=Phonon.AudioOutput(Phonon.MusicCategory,self)
self.sfx_player=Phonon.MediaObject(self)
Phonon.createPath(self.sfx_player,self.sfx_output)

and play the sounde source like so:

self.sfx_player.setCurrentSource(sound_source)
self.sfx_player.play()

this works fine, but always plays at the audio outputs full volume of 
1.0 (100%).

if do self.sfx_output.setVolume(0.5), for instance, in my code, then 
self.sfx_output.volume() returns 0.5 as i would expect.

if i then play a sound (as above) it play at full volume still as though 
i didn't set the volume.

to try to debug i attached a function to the audio output's 
'volumeChanged' signal like so:

self.sfx_output.volumeChanged.connect(self.volume_changed)

(the function merely prints the changed volume) and what i find is, 
after setting the volume to what i want, and checking it, as above, as 
soon as i play any sound the volumeChanged signal is emitted and the 
volume is now reported as 1.0 again.

in other words calling self.sfx_player.play() causes self.sfx_output 's 
volume to be reset to 1.0.

how can i make volume changes to the audio output actually work so that 
playing a sound doesn't not reset the output to full volume??

thanks,
stephen.



_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic