mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-20 08:53:51 +00:00
Act more gracefully when failing to load a (VOC) sound (should help bug #889442)
svn-id: r12719
This commit is contained in:
parent
43efc8bed0
commit
f36710f8b4
@ -830,6 +830,11 @@ void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle,
|
||||
} else {
|
||||
input = makeVOCStream(_sfxFile);
|
||||
}
|
||||
|
||||
if (!input) {
|
||||
warning("startSfxSound failed to load sound");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (_vm->_imuseDigital) {
|
||||
//_vm->_imuseDigital->stopSound(kTalkSoundID);
|
||||
|
@ -156,6 +156,9 @@ AudioStream *makeVOCStream(byte *ptr) {
|
||||
int size, rate, loops;
|
||||
byte *data = readVOCFromMemory(ptr, size, rate, loops);
|
||||
|
||||
if (!data)
|
||||
return 0;
|
||||
|
||||
return makeLinearInputStream(rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED, data, size, 0, 0);
|
||||
}
|
||||
|
||||
@ -163,6 +166,9 @@ AudioStream *makeVOCStream(File *file) {
|
||||
int size, rate;
|
||||
byte *data = loadVOCFile(file, size, rate);
|
||||
|
||||
if (!data)
|
||||
return 0;
|
||||
|
||||
return makeLinearInputStream(rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED, data, size, 0, 0);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user