aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/sound.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2009-05-29 17:12:45 +0000
committerJohannes Schickel2009-05-29 17:12:45 +0000
commit95d11e6e37e423ace2c382636e2cd2d4c8d1c725 (patch)
tree23d4723a63b53bf2e705c2f80aac174de1139dab /engines/kyra/sound.cpp
parente2641cbd251579e58fa3918bbd8966db2a97d09c (diff)
downloadscummvm-rg350-95d11e6e37e423ace2c382636e2cd2d4c8d1c725.tar.gz
scummvm-rg350-95d11e6e37e423ace2c382636e2cd2d4c8d1c725.tar.bz2
scummvm-rg350-95d11e6e37e423ace2c382636e2cd2d4c8d1c725.zip
- Add new method "isVoicePresent" to "Sound".
- Change LoL character selection to use it. - Allow quitting ScummVM in LoL character selection. svn-id: r41008
Diffstat (limited to 'engines/kyra/sound.cpp')
-rw-r--r--engines/kyra/sound.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp
index 4c9d730c43..4d42b1efb7 100644
--- a/engines/kyra/sound.cpp
+++ b/engines/kyra/sound.cpp
@@ -59,11 +59,24 @@ bool Sound::voiceFileIsPresent(const char *file) {
return false;
}
+bool Sound::isVoicePresent(const char *file) {
+ char filenamebuffer[25];
+
+ for (int i = 0; _supportedCodecs[i].fileext; ++i) {
+ strcpy(filenamebuffer, file);
+ strcat(filenamebuffer, _supportedCodecs[i].fileext);
+
+ if (_vm->resource()->exists(filenamebuffer))
+ return true;
+ }
+
+ return false;
+}
+
int32 Sound::voicePlay(const char *file, Audio::SoundHandle *handle, uint8 volume, bool isSfx) {
Audio::AudioStream *audioStream = getVoiceStream(file);
if (!audioStream) {
- warning("Couldn't load sound file '%s'", file);
return 0;
}
@@ -83,11 +96,17 @@ Audio::AudioStream *Sound::getVoiceStream(const char *file) {
Common::SeekableReadStream *stream = _vm->resource()->createReadStream(filenamebuffer);
if (!stream)
continue;
+
audioStream = _supportedCodecs[i].streamFunc(stream, true, 0, 0, 1);
break;
}
- return audioStream;
+ if (!audioStream) {
+ warning("Couldn't load sound file '%s'", file);
+ return 0;
+ } else {
+ return audioStream;
+ }
}
bool Sound::playVoiceStream(Audio::AudioStream *stream, Audio::SoundHandle *handle, uint8 volume, bool isSfx) {