-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSom.cpp
More file actions
42 lines (34 loc) · 850 Bytes
/
Som.cpp
File metadata and controls
42 lines (34 loc) · 850 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 "Som.h"
SOM::SOM(char* nome_arquivo) {
Som = NULL;
Inst_Som = NULL;
Som = al_load_sample(nome_arquivo);
Inst_Som = al_create_sample_instance(Som);
al_attach_sample_instance_to_mixer(Inst_Som, al_get_default_mixer());
nome_arquivo = nome_arquivo;
}
SOM::~SOM() {
al_destroy_sample(Som);
al_destroy_sample_instance(Inst_Som);
}
void SOM::Play() {
al_play_sample_instance(Inst_Som);
}
void SOM::Stop() {
al_stop_sample_instance(Inst_Som);
}
void SOM::setVolume(float Volume) {
al_set_sample_instance_gain(Inst_Som, Volume);
}
void SOM::setLoop(bool Liga) {
if (Liga)
al_set_sample_instance_playmode(Inst_Som, ALLEGRO_PLAYMODE_LOOP);
else
al_set_sample_instance_playmode(Inst_Som, ALLEGRO_PLAYMODE_ONCE);
}
char* SOM::getName() {
return nome_arquivo;
}
ALLEGRO_SAMPLE_INSTANCE* SOM::getInst_Som() {
return Inst_Som;
}