forked from Sicatriz/CppGame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaudio.h
42 lines (35 loc) · 1.02 KB
/
audio.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
#ifndef AUDIO_H
#define AUDIO_H
#include <qmediaplayer.h>
#include <QAudioOutput>
#include <QObject>
/**************************************/
/**************************************/
/********* AUDIO FUNCTIONS **********/
/**************************************/
/**************************************/
namespace insemi
{
class Audio: public QObject
{ Q_OBJECT
public:
Audio();
// play audio functions
void playBullet(float bulletVolume) const;
void playBulletHit(int volume) const;
void playShipCollisionSound(float crashVolume);
void playBackgroundMusic(float backgroundVolume) const;
void playGameOver(int volume) const;
void playBuffSound(int volume) const;
// mediaplayer instances
QMediaPlayer * music;
QAudioOutput * audioOutput;
private:
// volume setting by audiotype ( 1 for 100% volume and 0 for volume off)
const short int volume = 1;
const float backgroundVolume = 0.3;
const float bulletVolume = 0.5;
const float crashVolume = 0.7;
};
}
#endif // AUDIO_H