kmix DCOP call return values wrong?

Christian Esken esken at kde.org
Thu Feb 24 16:02:18 GMT 2005


Am Montag, 21. Februar 2005 01:00 schrieb David Jarvie:
> On Saturday 19 Feb 2005 23:43, Christian Esken wrote:
> > Am Samstag, 19. Februar 2005 18:24 schrieb David Jarvie:
> > > KAlarm uses KMix to set the master volume when sounds are played with its
> > > alarms. But when I use it with KMix from kdemultimedia 3.3.2 (built from
> > > source), it doesn't work. I find that the masterVolume() DCOP call to
> > > kmix always returns 0, and the setMasterVolume() DCOP call never changes
> > > the volume regardless of what value is supplied as a parameter.
> >
> > This means you have no master volume.
> >
> > > What has happened here? And will it work in KDE 3.4? (I haven't installed
> > > kdemultimedia for KDE 3.4 yet to test it out.)
> >
> > My guess is that you changed drivers: from OSS to ALSA or vice versa. If
> > there is no master volume in the driver, it will never work.
> 
> I have changed from SuSE to Debian, each running ALSA. But I have noticed in 
> the Debian system that there is an error message during bootup saying 
> "Setting up ALSA...done (not loaded)". I haven't bothered to fix this since 
> sound seems to work fine despite the error. Perhaps this is the reason that 
> there is no master volume.
> 
> This does raise the issue for KAlarm as to how to ensure that it is able to 
> set the volume when playing sound. It tries to set the absolute volume (i.e. 
> independently of the current master volume setting (or however the general 
> sound level is set if master volume isn't available)), so that the sound 
> level is predictable for the alarm even if the user has changed the system's 
> volume setting between setting up the alarm and it being triggered. (Some 
> people use it to wake themselves up in the morning, for example.). Is there 
> any reliable way of setting the absolute volume regardless of whether ALSA, 
> OSS, etc is used, and regardless of whether the master volume exists? Ideally 

This is an easy answer: No.

Because you cannot know, what controls (and how many controls) you have to regulate.

For example, lets assume you want to change the "WAV" or "MP3" playback volume to a reliable, reproducable
level  on my Soundcard. That's easy, isn't it? Well ...
You will at least need to set Master, PCM and DAC. Also it wouldn't be a bad idea
to check on the Record-Monitor stuff, because if you currently have configured your soundcard for being able
to capture PCM data, you might also hear that in the output (worst case: you get a feedback loop, which will
wake you up very quickly).

Making it even more complicated: "Master" is no real Master in ALSA. Actually it only regulates "Front". So you
might also need to control "Surround", "Center" and probably set some switches.

Making it easier: If you assume, that "most" controls have sensible values, you should be quite safe, when if you regulate "PCM" and/or "Master/Front" and "Surround".

> I'd like to do it via library calls instead of calling kmix which isn't 
> guaranteed to be installed.

Then you need to use ALSALIB and/or the OSS-API and/or the Solaris-API and/or the SGI-API, ... 
There is no other good way that I am aware of.

You might try your luck with some of the Game API's, but nobody will guarantee you that those are intalled - so I would recommend not to try that.

Chris

-- 
Is UNIX ready for the Desktop? See http://www.kde.org
KDE Developer: esken at kde.org



More information about the kde-multimedia mailing list