summaryrefslogtreecommitdiffstats
path: root/pica-client/sound.cpp
blob: 0caff3ec72bf3a28ec2f78c1446fc4a584fe1bd3 (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 <Mmsystem.h>
#include <windows.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
}