-
Notifications
You must be signed in to change notification settings - Fork 0
/
music.h
60 lines (48 loc) · 1.12 KB
/
music.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
49
50
51
52
53
54
55
56
57
58
59
60
#include "SFML/Audio.hpp"
#pragma once
using namespace sf;
class SoundsAll{
public:
SoundsAll(){
for(int i = 0; i < 13; i++){
buffer[i].loadFromFile(pathToDirectory + "sounds/sounds/" + std::to_string(i) + ".wav");
sound[i].setBuffer(buffer[i]);
}
}
void setVolume(int volume){
for(int i = 0; i < 13; i++){
sound[i].setVolume(volume);
}
}
void stop(){
for(int i = 0; i < 13; i++){
sound[i].pause();
}
}
SoundBuffer buffer[13];
Sound sound[13];
};
class MusicAll{
public:
MusicAll(){
for(int i = 0; i < 7; i++){
music[i].openFromFile(pathToDirectory + "sounds/music/" + std::to_string(i) + ".ogg");
music[i].setLoop(true);
}
}
void setVolume(int volume){
for(int i = 0; i < 7; i++){
music[i].setVolume(volume);
}
}
void stop(){
for(int i = 0; i < 7; i++){
music[i].pause();
}
}
Music music[7];
};
SoundsAll soundsAll;
MusicAll musicAll;
int numberMusicMenu = 0;
int numberMusicGame = 3;