blob: f7cc81c06f4577b954a34e236a25f49c1d202c6a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#include "sound.h"
#ifndef WIN32
#include <QProcess>
#else
//link with winmm.lib
#include <windows.h>
#include <Mmsystem.h>
#endif
bool Sound::is_muted = false;
Sound::Sound()
{
}
void Sound::mute(bool yes)
{
is_muted = yes;
}
void Sound::play(const QString sndfile)
{
if (is_muted)
return;
#ifndef WIN32
QProcess::execute("aplay -q " + sndfile);
#else
sndPlaySound(sndfile.toAscii().constData(), SND_ASYNC | SND_NODEFAULT);
#endif
}
|