aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2013-04-20 16:13:34 +0200
committerWillem Jan Palenstijn2013-04-20 16:13:41 +0200
commit09fc458f15bdd320cb8d112ac1fd23a45156bd1d (patch)
treec33ad92baca4d1d593710c6a667140f7173e03bf
parente273a387a71944fb6c9ec735114c5c5774109761 (diff)
downloadscummvm-rg350-09fc458f15bdd320cb8d112ac1fd23a45156bd1d.tar.gz
scummvm-rg350-09fc458f15bdd320cb8d112ac1fd23a45156bd1d.tar.bz2
scummvm-rg350-09fc458f15bdd320cb8d112ac1fd23a45156bd1d.zip
SCI: Report sound stream loading errors
-rw-r--r--engines/sci/sound/audio.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp
index 528bb51393..8f405b0fa5 100644
--- a/engines/sci/sound/audio.cpp
+++ b/engines/sci/sound/audio.cpp
@@ -324,7 +324,10 @@ Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32
// Calculate samplelen from WAVE header
int waveSize = 0, waveRate = 0;
byte waveFlags = 0;
- Audio::loadWAVFromStream(*waveStream, waveSize, waveRate, waveFlags);
+ bool ret = Audio::loadWAVFromStream(*waveStream, waveSize, waveRate, waveFlags);
+ if (!ret)
+ error("Failed to load WAV from stream");
+
*sampleLen = (waveFlags & Audio::FLAG_16BITS ? waveSize >> 1 : waveSize) * 60 / waveRate;
waveStream->seek(0, SEEK_SET);
@@ -336,7 +339,10 @@ Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32
// Calculate samplelen from AIFF header
int waveSize = 0, waveRate = 0;
byte waveFlags = 0;
- Audio::loadAIFFFromStream(*waveStream, waveSize, waveRate, waveFlags);
+ bool ret = Audio::loadAIFFFromStream(*waveStream, waveSize, waveRate, waveFlags);
+ if (!ret)
+ error("Failed to load AIFF from stream");
+
*sampleLen = (waveFlags & Audio::FLAG_16BITS ? waveSize >> 1 : waveSize) * 60 / waveRate;
waveStream->seek(0, SEEK_SET);
@@ -347,6 +353,9 @@ Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32
Common::SeekableReadStream *sndStream = new Common::MemoryReadStream(audioRes->data, audioRes->size, DisposeAfterUse::NO);
audioSeekStream = Audio::makeMacSndStream(sndStream, DisposeAfterUse::YES);
+ if (!audioSeekStream)
+ error("Failed to load Mac sound stream");
+
} else {
// SCI1 raw audio
size = audioRes->size;