blob: 3762c0effa768f184eca76c02fd2d97efae85ef3 (
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
38
39
40
41
|
#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;
#if defined(__gnu_linux__)
QProcess::execute("aplay -q " + sndfile);
#endif
#if defined(WIN32)
sndPlaySound(sndfile.toAscii().constData(), SND_ASYNC | SND_NODEFAULT);
#endif
#if defined(__APPLE__)
QProcess::execute("/usr/bin/afplay " + sndfile);
#endif
}
|