summaryrefslogtreecommitdiffstats
path: root/pica-client/sound.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pica-client/sound.cpp')
-rw-r--r--pica-client/sound.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/pica-client/sound.cpp b/pica-client/sound.cpp
new file mode 100644
index 0000000..0caff3e
--- /dev/null
+++ b/pica-client/sound.cpp
@@ -0,0 +1,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
+}