* Loads a sound file from a specified filename. * @param filename Filename of the sound file. */
| 46 | * @param filename Filename of the sound file. |
| 47 | */ |
| 48 | void Sound::load(const std::string &filename) |
| 49 | { |
| 50 | // SDL only takes UTF-8 filenames |
| 51 | // so here's an ugly hack to match this ugly reasoning |
| 52 | std::string utf8 = Language::wstrToUtf8(Language::fsToWstr(filename)); |
| 53 | |
| 54 | _sound = Mix_LoadWAV(utf8.c_str()); |
| 55 | if (_sound == 0) |
| 56 | { |
| 57 | std::string err = filename + ":" + Mix_GetError(); |
| 58 | throw Exception(err); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Loads a sound file from a specified memory chunk. |