-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMusic.cpp
More file actions
55 lines (48 loc) · 1.31 KB
/
Music.cpp
File metadata and controls
55 lines (48 loc) · 1.31 KB
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
49
50
51
52
53
54
55
#include "Music.hpp"
Music::Music() {
if(!mainTheme.openFromFile("mainTheme2.wav")) {
throw std::runtime_error("Cannot open audio.");
}
mainTheme.setVolume(10);
mainTheme.setLoop(true);
if(!shotSound.openFromFile("fireballSound.wav")) {
throw std::runtime_error("Cannot open audio.");
}
shotSound.setVolume(30);
shotSound.setPitch(3);
if(!coinSound.openFromFile("coin.wav")) {
throw std::runtime_error("Cannot open audio.");
}
coinSound.setVolume(50);
if(!echoSlamSound.openFromFile("echoSlam.wav")) {
throw std::runtime_error("Cannot open audio.");
}
echoSlamSound.setVolume(40);
if(!collisionSound.openFromFile("collision.ogg")) {
throw std::runtime_error("Cannot open audio.");
}
collisionSound.setVolume(60);
if(!die.openFromFile("die.wav")) {
throw std::runtime_error("Cannot open audio.");
}
die.setVolume(30);
die.setLoop(true);
}
sf::Music& Music::getMainTheme() {
return mainTheme;
}
sf::Music& Music::getShotSound() {
return shotSound;
}
sf::Music& Music::getCoinSound() {
return coinSound;
}
sf::Music& Music::getEchoSlamSound() {
return echoSlamSound;
}
sf::Music& Music::getCollisionSound() {
return collisionSound;
}
sf::Music& Music::getDie() {
return die;
}