blob: bfbedcddc363e482c8c7aec4902ecddc7fc1f28c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include "mixer.h"
void Mixer::playSound(std::string filename) {
if (!sounds_.count(filename)) {
Mix_Chunk* sample = Mix_LoadWAV(filename.c_str());
if (!sample) {
throw mix_error();
}
sounds_[filename] = chunk_ptr(sample);
}
if (Mix_PlayChannel(-1, sounds_[filename].get(), 0) == -1) {
throw mix_error();
}
}
|