Reputation: 33599
I want my application to emit a standard notification sound, the one that's called "Default Beep" on Windows. I don't see a way of referencing system sounds with QSound. QSound instance with no sound assigned used to play this sound, but it's fixed in Qt 5. Any way to do it?
It's OK if the solution only works on Windows (but I want it to compile on any supported OS and don't want to use #ifdef
and Win API).
Upvotes: 4
Views: 2438
Reputation: 4488
Use Phonon ( http://qt-project.org/doc/qt-4.8/phonon-overview.html ), a Qt library, which is able to play sound / video, ...
For the path of the file, you should use environment variable for the WINDOWS directory, and then hard code the end of the path of the sound file
But : I am thinking that it may not a good idea, since the system sound can be personalized... To get the PATH of the personalized sound you need to read the windows registry...
Edit : You could use the QSettings
class to be able to read the Windows registry
For example something like :
QSettings settings("HKEY_CURRENT_USER\\AppEvents\\Schemes\Apps\\.Defaults\\..TODO..", QSettings::NativeFormat);
Upvotes: 1