blob: d48393cd51dae051f3afa94edf904deed75809ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include "Sound.h"
#include "SoundSystem.h"
using namespace crepe;
Sound::Sound(std::unique_ptr<api::Resource> res, SoundSystem & system) : system(system) {
this->res = std::move(res);
}
void Sound::play() {
if (this->system.engine.getPause(this->handle)) {
// resume if paused
this->system.engine.setPause(this->handle, false);
} else {
// or start new sound
this->handle = this->system.engine.play(this->sample);
}
}
void Sound::pause() {
if (this->system.engine.getPause(this->handle)) return;
this->system.engine.setPause(this->handle, true);
}
|