-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMusicManager.cpp
More file actions
42 lines (28 loc) · 786 Bytes
/
MusicManager.cpp
File metadata and controls
42 lines (28 loc) · 786 Bytes
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
#include "MusicManager.h"
#include <cstdio>
MusicManager::MusicManager(){
openFile(BACKGROUND, "music/change.wav");
openFile(POWERUP, "music/powerup.wav");
openFile(CRASH, "music/crash.wav");
openFile(RING, "music/ring.wav");
openFile(ATMOSPHERE, "music/atmosphere.wav");
}
MusicManager::~MusicManager(){
}
void MusicManager::playSound(SoundType sound){
sounds[sound].Play();
}
void MusicManager::pauseSound(SoundType sound){
sounds[sound].Pause();
}
void MusicManager::stopSound(SoundType sound){
sounds[sound].Stop();
}
void MusicManager::loopSound(SoundType sound){
sounds[sound].SetLoop(true);
}
void MusicManager::openFile(SoundType sound, string file){
if(!sounds[sound].OpenFromFile(file)){
printf("Error opening sound file %s.\n", file.c_str());
}
}