Setting volume not working with Phonon
ian.monroe at gmail.com
Wed Jul 22 13:49:20 BST 2009
On Wed, Jul 22, 2009 at 7:39 AM, David Jarvie<djarvie at kde.org> wrote:
> 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();
> Phonon::AudioOutput* output = new Phonon::AudioOutput(
> Phonon::NotificationCategory, mAudioObject);
> if (mUnmute)
> 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.
Phonon's volume API doesn't have anything to do with system volume.
Its meant to be used to change the volume of the specific application
(eg if you turn down the volume in Amarok, you wouldn't expect the
volume in Firefox to also be turned down).
You'll have to take some code from KMix I think.
More information about the kde-multimedia