aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2016-04-23 11:42:33 +0200
committerEinar Johan Trøan Sømåen2016-04-23 11:42:33 +0200
commit7af4a1a05f5a36937413027996bd8d239b7eeadc (patch)
tree6a004c93e57dcd047a017490530e1c6ba335786b
parentf7d32be601f310539370ff9a3d8f0385561254d3 (diff)
parent0cfd0589432798838b66023b01a5ca6ba4fad0ca (diff)
downloadscummvm-rg350-7af4a1a05f5a36937413027996bd8d239b7eeadc.tar.gz
scummvm-rg350-7af4a1a05f5a36937413027996bd8d239b7eeadc.tar.bz2
scummvm-rg350-7af4a1a05f5a36937413027996bd8d239b7eeadc.zip
Merge pull request #728 from tobiatesan/fix_ogg
WINTERMUTE: Correctly find .ogg version of .wav files
-rw-r--r--engines/wintermute/base/sound/base_sound_manager.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/engines/wintermute/base/sound/base_sound_manager.cpp b/engines/wintermute/base/sound/base_sound_manager.cpp
index f1e0c3b1f9..74c0086817 100644
--- a/engines/wintermute/base/sound/base_sound_manager.cpp
+++ b/engines/wintermute/base/sound/base_sound_manager.cpp
@@ -100,15 +100,14 @@ BaseSoundBuffer *BaseSoundMgr::addSound(const Common::String &filename, Audio::M
BaseSoundBuffer *sound;
Common::String useFilename = filename;
+ useFilename.toLowercase();
// try to switch WAV to OGG file (if available)
- AnsiString ext = PathUtil::getExtension(filename);
- if (StringUtil::compareNoCase(ext, "wav")) {
- AnsiString path = PathUtil::getDirectoryName(filename);
- AnsiString name = PathUtil::getFileNameWithoutExtension(filename);
-
- AnsiString newFile = PathUtil::combine(path, name + "ogg");
- if (BaseFileManager::getEngineInstance()->hasFile(newFile)) {
- useFilename = newFile;
+ if (useFilename.hasSuffix(".wav")) {
+ Common::String oggFilename = useFilename;
+ oggFilename.erase(oggFilename.size() - 4);
+ oggFilename = oggFilename + ".ogg";
+ if (BaseFileManager::getEngineInstance()->hasFile(oggFilename)) {
+ useFilename = oggFilename;
}
}