Allow to play the default system sound (beep) instead of a specific sound file (WIP)

Review Request #128043 - Created May 29, 2016 and updated

René J.V. Bertin
kde-mac, kdeframeworks

This is a follow-up to discussion on the plasma-devel ML. When not running under a Plasma session it would be preferable if generic alert sounds are (can be) delivered using the default system sound. The easiest way to do that is to call QApplication::beep() ; at least on OS X this will play the user's selected alert sound.

I have implemented this for now by assuming the existence of a virtual (relative) beep sound file that always plays the default sound.

In addition, this patch provides better warning feedback if a soundfile isn't found (making it easier to figure out which alert is misconfigured), and will play the sysbeep in that case (so that the alert doesn't go lost if it's sound-only).
Finally, no Phonon::AudioOutput object is created until that is actually required.

Works as expected on OS X 10.9.5


  • 2
  • 2
  • 0
  • 4
Description From Last Updated
But this is not correct, if you disable the sound in the config, the soundFilename will be empty and this ... Martin Klapetek Martin Klapetek
So if the user upgrades from Plasma 5 to Plasma 6, and the old sound file no longer exists, the ... David Faure David Faure
Kai Uwe Broulik
Martin Klapetek
René J.V. Bertin
Review request changed

Change Summary:

addresses all but the "should an incomplete audio notification make a sound or not" issue.


Revision 2 (+14 -5)

Show changes

David Faure

src/notifybyaudio.cpp (Diff revision 2)

So if the user upgrades from Plasma 5 to Plasma 6, and the old sound file no longer exists, the user is going to be rewarded with an awful BEEEP ?

I truly hate audio notifications, but the system beep is even 10 times higher on my hate list. What if my wife is sleeping on the sofa next to me?

Is QApplication::beep() muted by the laptop's mute button btw? On old desktop PCs I remember it was completely independent from the mixer settings.

  1. Is that really a valid concern? I'd say that

    1) someone hating audio notifications will turn them off, so shouldn't be getting fallback notifications. If in addition that someone is a "KDE guru", s/he might implement a quick method for turning off sound on all notifications ;)
    2) if an upgrade borks the sound file installations, the user should be alerted to that ... and the sysbeep could be perfet for that. There are certainly other ways to do that, but the whole point with alert notifications is that they work better if there's a relatively high annoyance aspect to them.

    I can make using a fallback beep dependent on the presence of an env. variable if that makes the feature more acceptable.

    Is QApplication::beep() muted by the laptop's mute button btw?

    I couldn't say, your educated guess (from the source code) and empirical observations are as good as mine ...
    Either way I haven't yet heard QApplication::beep() make the kind of BEEEP you seem to have in mind, not even on the netbook that makes exactly that kind of noise when I dis/connect its powercord (and that's a sound I can avoid only by suspending the thing first).

René J.V. Bertin