aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/sound.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/kyra/sound.cpp')
-rw-r--r--engines/kyra/sound.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp
index 5068268d99..073639e4ca 100644
--- a/engines/kyra/sound.cpp
+++ b/engines/kyra/sound.cpp
@@ -104,6 +104,11 @@ int32 Sound::voicePlay(const char *file, bool isSfx) {
fileSize = 0;
}
+ if (!audioStream) {
+ warning("Couldn't load sound file '%s'", file);
+ return 0;
+ }
+
_soundChannels[h].file = file;
_mixer->playInputStream(isSfx ? Audio::Mixer::kSFXSoundType : Audio::Mixer::kSpeechSoundType, &_soundChannels[h].channelHandle, audioStream);
@@ -202,8 +207,8 @@ bool SoundMidiPC::init() {
}
void SoundMidiPC::updateVolumeSettings() {
- _musicVolume = ConfMan.getInt("music_volume");
- _sfxVolume = ConfMan.getInt("sfx_volume");
+ _musicVolume = CLIP(ConfMan.getInt("music_volume"), 0, 255);
+ _sfxVolume = CLIP(ConfMan.getInt("sfx_volume"), 0, 255);
updateChannelVolume(_musicVolume);
}
@@ -323,7 +328,17 @@ struct DeleterArray {
void SoundMidiPC::loadSoundFile(uint file) {
Common::StackLock lock(_mutex);
- Common::String filename = fileListEntry(file);
+ internalLoadFile(fileListEntry(file));
+}
+
+void SoundMidiPC::loadSoundFile(Common::String file) {
+ Common::StackLock lock(_mutex);
+
+ internalLoadFile(file);
+}
+
+void SoundMidiPC::internalLoadFile(Common::String file) {
+ Common::String filename = file;
filename += ".";
filename += _useC55 ? "C55" : "XMI";