[Scummvm-git-logs] scummvm master -> 8488741cec047ccc0599b1bcc0078c61953a2537
bluegr
noreply at scummvm.org
Mon Nov 27 13:55:05 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8488741cec ILLUSIONS: Add error handling when opening wav files
Commit: 8488741cec047ccc0599b1bcc0078c61953a2537
https://github.com/scummvm/scummvm/commit/8488741cec047ccc0599b1bcc0078c61953a2537
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-11-27T15:55:00+02:00
Commit Message:
ILLUSIONS: Add error handling when opening wav files
Sound code now calls `error` if wav files can't be opened instead of
failing assertions. This is consistent with the code for midi files.
Fixes bug #14612 where an assertion failure was recorded in
Google Play Console, presumably due to a missing game file.
Changed paths:
engines/illusions/sound.cpp
diff --git a/engines/illusions/sound.cpp b/engines/illusions/sound.cpp
index a2b996001f3..4fa1db60a90 100644
--- a/engines/illusions/sound.cpp
+++ b/engines/illusions/sound.cpp
@@ -53,8 +53,15 @@ void MusicPlayer::play(uint32 musicId, bool looping, int16 volume, int16 pan) {
}
Common::String filename = Common::String::format("%08x.wav", _musicId);
Common::File *fd = new Common::File();
- fd->open(filename);
- Audio::AudioStream *audioStream = Audio::makeLoopingAudioStream(Audio::makeWAVStream(fd, DisposeAfterUse::YES), looping ? 0 : 1);
+ if (!fd->open(filename)) {
+ delete fd;
+ error("MusicPlayer::play() Could not open %s", filename.c_str());
+ }
+ Audio::SeekableAudioStream *wavStream = Audio::makeWAVStream(fd, DisposeAfterUse::YES);
+ if (wavStream == nullptr) {
+ error("MusicPlayer::play() Could not load %s", filename.c_str());
+ }
+ Audio::AudioStream *audioStream = Audio::makeLoopingAudioStream(wavStream, looping ? 0 : 1);
g_system->getMixer()->playStream(Audio::Mixer::kMusicSoundType, &_soundHandle, audioStream, -1, volume, pan);
}
}
@@ -254,8 +261,14 @@ void VoicePlayer::stopCueing() {
void VoicePlayer::start(int16 volume, int16 pan) {
Common::String filename = Common::String::format("%s.wav", _voiceName.c_str());
Common::File *fd = new Common::File();
- fd->open(filename);
+ if (!fd->open(filename)) {
+ delete fd;
+ error("VoicePlayer::start() Could not open %s", filename.c_str());
+ }
Audio::AudioStream *audioStream = Audio::makeWAVStream(fd, DisposeAfterUse::YES);
+ if (audioStream == nullptr) {
+ error("VoicePlayer::start() Could not load %s", filename.c_str());
+ }
g_system->getMixer()->playStream(Audio::Mixer::kSpeechSoundType, &_soundHandle, audioStream, -1, volume, pan);
_voiceStatus = 4;
}
@@ -312,9 +325,12 @@ void Sound::load() {
Common::File *fd = new Common::File();
if (!fd->open(filename)) {
delete fd;
- error("SoundMan::loadSound() Could not load %s", filename.c_str());
+ error("Sound::load() Could not open %s", filename.c_str());
}
_stream = Audio::makeWAVStream(fd, DisposeAfterUse::YES);
+ if (_stream == nullptr) {
+ warning("Sound::load() Could not load %s", filename.c_str());
+ }
}
void Sound::unload() {
More information about the Scummvm-git-logs
mailing list