aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/sound.h2
-rw-r--r--engines/parallaction/sound_br.cpp12
2 files changed, 11 insertions, 3 deletions
diff --git a/engines/parallaction/sound.h b/engines/parallaction/sound.h
index 3a66aea049..140d4d974d 100644
--- a/engines/parallaction/sound.h
+++ b/engines/parallaction/sound.h
@@ -236,7 +236,7 @@ class AmigaSoundMan_br : public SoundMan_br {
uint32 flags;
} _channels[NUM_AMIGA_CHANNELS];
- void loadChannelData(const char *filename, Channel *ch);
+ bool loadChannelData(const char *filename, Channel *ch);
public:
AmigaSoundMan_br(Parallaction_br *vm);
diff --git a/engines/parallaction/sound_br.cpp b/engines/parallaction/sound_br.cpp
index 4851d11b94..5083ead2c1 100644
--- a/engines/parallaction/sound_br.cpp
+++ b/engines/parallaction/sound_br.cpp
@@ -447,12 +447,18 @@ AmigaSoundMan_br::~AmigaSoundMan_br() {
stopSfx(3);
}
-void AmigaSoundMan_br::loadChannelData(const char *filename, Channel *ch) {
+bool AmigaSoundMan_br::loadChannelData(const char *filename, Channel *ch) {
Common::ReadStream *stream = _vm->_disk->loadSound(filename);
+ // NOTE: Sound files don't always exist
+ if (!stream)
+ return false;
+
Audio::A8SVXDecoder decoder(*stream, ch->header, ch->data, ch->dataSize);
decoder.decode();
ch->dispose = true;
delete stream;
+
+ return true;
}
void AmigaSoundMan_br::playSfx(const char *filename, uint channel, bool looping, int volume) {
@@ -466,7 +472,8 @@ void AmigaSoundMan_br::playSfx(const char *filename, uint channel, bool looping,
debugC(1, kDebugAudio, "AmigaSoundMan_ns::playSfx(%s, %i)", filename, channel);
Channel *ch = &_channels[channel];
- loadChannelData(filename, ch);
+ if (!loadChannelData(filename, ch))
+ return;
uint32 loopStart, loopEnd, flags;
if (looping) {
@@ -509,6 +516,7 @@ void AmigaSoundMan_br::playMusic() {
debugC(1, kDebugAudio, "AmigaSoundMan_ns::playMusic()");
Common::SeekableReadStream *stream = _vm->_disk->loadMusic(_musicFile.c_str());
+ // NOTE: Music files don't always exist
if (!stream)
return;