diff options
author | Borja Lorente | 2016-08-04 17:11:13 +0200 |
---|---|---|
committer | Borja Lorente | 2016-08-14 19:01:01 +0200 |
commit | d925d2c2cec380ff5422a6c737a8f7ee49085fd7 (patch) | |
tree | 1b82ea433f401459e9755cde99a4ccdf8813580f | |
parent | cb4650247fa10f530cc1ac5d2e4c312b055c988d (diff) | |
download | scummvm-rg350-d925d2c2cec380ff5422a6c737a8f7ee49085fd7.tar.gz scummvm-rg350-d925d2c2cec380ff5422a6c737a8f7ee49085fd7.tar.bz2 scummvm-rg350-d925d2c2cec380ff5422a6c737a8f7ee49085fd7.zip |
MACVENTURE: Fix segfault with death sound
-rw-r--r-- | engines/macventure/sound.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/macventure/sound.cpp b/engines/macventure/sound.cpp index 97fe3c6132..0f9ea43afe 100644 --- a/engines/macventure/sound.cpp +++ b/engines/macventure/sound.cpp @@ -59,7 +59,7 @@ void SoundManager::ensureLoaded(ObjID sound) { } SoundAsset::SoundAsset(Container *container, ObjID id) : - _container(container), _id(id) { + _container(container), _id(id), _length(0), _frequency(1) { if (_container->getItemByteSize(_id) == 0) warning("Trying to load an empty sound asset."); @@ -93,6 +93,7 @@ SoundAsset::SoundAsset(Container *container, ObjID id) : break; default: warning("Unrecognized sound type: %x", type); + break; } delete stream; @@ -101,11 +102,13 @@ SoundAsset::SoundAsset(Container *container, ObjID id) : SoundAsset::~SoundAsset() {} void SoundAsset::play(Audio::Mixer *mixer, Audio::SoundHandle *soundHandle) { + if (_data.size() == 0) return; Audio::AudioStream *sound = Audio::makeRawStream(&_data.front(), _length, _frequency, Audio::FLAG_UNSIGNED); mixer->playStream(Audio::Mixer::kPlainSoundType, soundHandle, sound); } uint32 SoundAsset::getPlayLength() { + return _length / _frequency; } |