-
Notifications
You must be signed in to change notification settings - Fork 0
/
SoundManager.h
48 lines (38 loc) · 1.03 KB
/
SoundManager.h
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
42
43
44
45
46
47
48
// Author: Annie Berend (5033782) - Jonathan Verbeek (5058288)
#pragma once
#include <QObject>
#include <QMap>
#include <QVector>
#include <QSoundEffect>
#include <QMediaPlayer>
// The types of sound effects we can play
enum ESoundEffectType
{
CardClick,
CardFlip,
CardStack,
CardCannotMove,
Win
};
// A global class to handle various audio from the game
class CSoundManager : public QObject
{
Q_OBJECT
public:
// Constructor
CSoundManager(QObject *parent = nullptr);
public:
// Plays the given sound effect
void playSoundEffect(ESoundEffectType sfxType);
// Sets whether to enable sound effects
void setEnableSoundEffects(bool enabled);
// Sets whether to enable music
void setEnableMusic(bool enabled);
private:
// List of sound effect files associated to their resepctive effect type
QMap<ESoundEffectType, QVector<QString>> soundFiles;
// The media player for the bg music
QMediaPlayer* bgMusicPlayer;
// Whether to enable sound effects
bool enableSfx;
};