Setting volume not working with Phonon
David Jarvie
djarvie at kde.org
Wed Jul 22 14:03:03 BST 2009
On Wed, July 22, 2009 1:49 pm, Ian Monroe wrote:
> 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();
>> 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.
>
> 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).
I'm actually trying to change the volume only for my application, not the
system. So I can see now that looking in KMix for confirmation was wrong.
But even in my application, setting the volume doesn't work, nor does
unmuting.
--
David Jarvie.
KAlarm author & maintainer.
http://www.astrojar.org.uk/kalarm
More information about the kde-multimedia
mailing list