diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gob/sound/sound.cpp | 11 | ||||
-rw-r--r-- | engines/gob/sound/sound.h | 2 |
2 files changed, 8 insertions, 5 deletions
diff --git a/engines/gob/sound/sound.cpp b/engines/gob/sound/sound.cpp index 69a668e5fb..63af6aeef4 100644 --- a/engines/gob/sound/sound.cpp +++ b/engines/gob/sound/sound.cpp @@ -109,7 +109,7 @@ int Sound::sampleGetNextFreeSlot() const { return -1; } -bool Sound::sampleLoad(SoundDesc *sndDesc, SoundType type, const char *fileName, bool tryExist) { +bool Sound::sampleLoad(SoundDesc *sndDesc, SoundType type, const char *fileName) { if (!sndDesc) return false; @@ -117,12 +117,15 @@ bool Sound::sampleLoad(SoundDesc *sndDesc, SoundType type, const char *fileName, int32 size; byte *data = _vm->_dataIO->getFile(fileName, size); - if (!data) { - warning("Can't open sample file \"%s\"", fileName); + + if (!data || !sndDesc->load(type, data, size)) { + delete data; + + warning("Sound::sampleLoad(): Failed to load sound \"%s\"", fileName); return false; } - return sndDesc->load(type, data, size); + return true; } void Sound::sampleFree(SoundDesc *sndDesc, bool noteAdLib, int index) { diff --git a/engines/gob/sound/sound.h b/engines/gob/sound/sound.h index 7beffb5dc7..bbc182d172 100644 --- a/engines/gob/sound/sound.h +++ b/engines/gob/sound/sound.h @@ -51,7 +51,7 @@ public: const SoundDesc *sampleGetBySlot(int slot) const; int sampleGetNextFreeSlot() const; - bool sampleLoad(SoundDesc *sndDesc, SoundType type, const char *fileName, bool tryExist = true); + bool sampleLoad(SoundDesc *sndDesc, SoundType type, const char *fileName); void sampleFree(SoundDesc *sndDesc, bool noteAdLib = false, int index = -1); |