Setting volume not working with Phonon
David Jarvie
djarvie at kde.org
Wed Jul 22 13:39:32 BST 2009
I have some code to set the audio volume, and to unmute, using Phonon.
Neither function works - no matter what volume I set (I've tried between
0.1 and 1), it always plays at full volume. Unmuting simply does not work
either - I checked the status in KMix, where PCM remained muted, even
after calling setMuted(false). (My master channel doesn't have a mute
control in KMix.)
An extract from the relevant code is below. Any help on how to get these
functions to work would be much appreciated.
Phonon::MediaSource source(audioFile);
mAudioObject = new Phonon::MediaObject();
mAudioObject->setCurrentSource(source);
Phonon::AudioOutput* output = new Phonon::AudioOutput(
Phonon::NotificationCategory, mAudioObject);
output->setVolume(mVolume);
if (mUnmute)
output->setMuted(false);
....
mAudioObject->play();
Note that I've used debug output to confirm the values being passed to
setVolume(). In case it's relevant, this code runs in its own thread.
--
David Jarvie.
KAlarm author & maintainer.
http://www.astrojar.org.uk/kalarm
More information about the kde-multimedia
mailing list