diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-02 20:18:41 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-02 20:18:41 -0500 |
commit | c772a3e5d8d9507b898813cdfb597c14b07cdc61 (patch) | |
tree | d2b79410a30f55b2c8d10b6b4b564cdb40467a95 /src/mixer.cpp | |
parent | 93b3e4004387047c25b2f5a190aced01c9091934 (diff) | |
download | tanetane-c772a3e5d8d9507b898813cdfb597c14b07cdc61.tar.gz tanetane-c772a3e5d8d9507b898813cdfb597c14b07cdc61.tar.bz2 tanetane-c772a3e5d8d9507b898813cdfb597c14b07cdc61.zip |
Added "bumping into something while running" sfx
Diffstat (limited to 'src/mixer.cpp')
-rw-r--r-- | src/mixer.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mixer.cpp b/src/mixer.cpp new file mode 100644 index 0000000..bfbedcd --- /dev/null +++ b/src/mixer.cpp | |||
@@ -0,0 +1,16 @@ | |||
1 | #include "mixer.h" | ||
2 | |||
3 | void Mixer::playSound(std::string filename) { | ||
4 | if (!sounds_.count(filename)) { | ||
5 | Mix_Chunk* sample = Mix_LoadWAV(filename.c_str()); | ||
6 | if (!sample) { | ||
7 | throw mix_error(); | ||
8 | } | ||
9 | |||
10 | sounds_[filename] = chunk_ptr(sample); | ||
11 | } | ||
12 | |||
13 | if (Mix_PlayChannel(-1, sounds_[filename].get(), 0) == -1) { | ||
14 | throw mix_error(); | ||
15 | } | ||
16 | } | ||