aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorJohannes Schickel2010-01-05 20:14:28 +0000
committerJohannes Schickel2010-01-05 20:14:28 +0000
commit920dac2f9d271889ffdc6c05313c89a6077ec2d2 (patch)
tree5ca24942081a5171605aea463febd5a06860d5ac /engines/kyra
parente9a94ecb9b6eb20cb7cdc4f838df3f9b049d2de6 (diff)
downloadscummvm-rg350-920dac2f9d271889ffdc6c05313c89a6077ec2d2.tar.gz
scummvm-rg350-920dac2f9d271889ffdc6c05313c89a6077ec2d2.tar.bz2
scummvm-rg350-920dac2f9d271889ffdc6c05313c89a6077ec2d2.zip
Remove unsafe getTotalPlayTime from AudioStream.
svn-id: r47037
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/lol.cpp2
-rw-r--r--engines/kyra/lol.h3
-rw-r--r--engines/kyra/sound.cpp8
-rw-r--r--engines/kyra/sound.h2
-rw-r--r--engines/kyra/sound_digital.cpp1
-rw-r--r--engines/kyra/sound_lol.cpp10
6 files changed, 13 insertions, 13 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index a441874134..299963b330 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -405,7 +405,7 @@ LoLEngine::~LoLEngine() {
delete *i;
_spellProcs.clear();
- for (Common::List<Audio::AudioStream *>::iterator i = _speechList.begin(); i != _speechList.end(); ++i)
+ for (SpeechList::iterator i = _speechList.begin(); i != _speechList.end(); ++i)
delete *i;
_speechList.clear();
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index fa66f996bc..7a49085f6c 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -489,7 +489,8 @@ private:
uint16 _envSfxQueuedBlocks[10];
int _nextSpeechId;
int _nextSpeaker;
- Common::List<Audio::AudioStream*> _speechList;
+ typedef Common::List<Audio::SeekableAudioStream *> SpeechList;
+ SpeechList _speechList;
int _curTlkFile;
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp
index e5ae400de3..34c9b3d223 100644
--- a/engines/kyra/sound.cpp
+++ b/engines/kyra/sound.cpp
@@ -74,21 +74,21 @@ bool Sound::isVoicePresent(const char *file) {
}
int32 Sound::voicePlay(const char *file, Audio::SoundHandle *handle, uint8 volume, bool isSfx) {
- Audio::AudioStream *audioStream = getVoiceStream(file);
+ Audio::SeekableAudioStream *audioStream = getVoiceStream(file);
if (!audioStream) {
return 0;
}
- int playTime = audioStream->getTotalPlayTime();
+ int playTime = audioStream->getLength().msecs();
playVoiceStream(audioStream, handle, volume, isSfx);
return playTime;
}
-Audio::AudioStream *Sound::getVoiceStream(const char *file) {
+Audio::SeekableAudioStream *Sound::getVoiceStream(const char *file) {
char filenamebuffer[25];
- Audio::AudioStream *audioStream = 0;
+ Audio::SeekableAudioStream *audioStream = 0;
for (int i = 0; _supportedCodecs[i].fileext; ++i) {
strcpy(filenamebuffer, file);
strcat(filenamebuffer, _supportedCodecs[i].fileext);
diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h
index 57b51e594c..5d54a1603b 100644
--- a/engines/kyra/sound.h
+++ b/engines/kyra/sound.h
@@ -186,7 +186,7 @@ public:
*/
virtual int32 voicePlay(const char *file, Audio::SoundHandle *handle = 0, uint8 volume = 255, bool isSfx = false);
- Audio::AudioStream *getVoiceStream(const char *file);
+ Audio::SeekableAudioStream *getVoiceStream(const char *file);
bool playVoiceStream(Audio::AudioStream *stream, Audio::SoundHandle *handle = 0, uint8 volume = 255, bool isSfx = false);
diff --git a/engines/kyra/sound_digital.cpp b/engines/kyra/sound_digital.cpp
index aaae5eaece..a1ba472b37 100644
--- a/engines/kyra/sound_digital.cpp
+++ b/engines/kyra/sound_digital.cpp
@@ -44,7 +44,6 @@ public:
bool isStereo() const { return _impl->isStereo(); }
bool endOfData() const { return _impl->endOfData() | _endOfData; }
int getRate() const { return _rate; }
- int32 getTotalPlayTime() const { return _impl->getTotalPlayTime(); }
void setRate(int newRate) { _rate = newRate; }
void beginFadeOut(uint32 millis);
diff --git a/engines/kyra/sound_lol.cpp b/engines/kyra/sound_lol.cpp
index 328a0e02d0..ad090609d1 100644
--- a/engines/kyra/sound_lol.cpp
+++ b/engines/kyra/sound_lol.cpp
@@ -58,7 +58,7 @@ bool LoLEngine::snd_playCharacterSpeech(int id, int8 speaker, int) {
char file3[13];
file3[0] = 0;
- Common::List<Audio::AudioStream *> newSpeechList;
+ SpeechList newSpeechList;
snprintf(pattern2, sizeof(pattern2), "%02d", id & 0x4000 ? 0 : _curTlkFile);
@@ -95,18 +95,18 @@ bool LoLEngine::snd_playCharacterSpeech(int id, int8 speaker, int) {
while (_sound->allVoiceChannelsPlaying())
delay(_tickLength);
- for (Common::List<Audio::AudioStream *>::iterator i = _speechList.begin(); i != _speechList.end(); ++i)
+ for (SpeechList::iterator i = _speechList.begin(); i != _speechList.end(); ++i)
delete *i;
_speechList.clear();
_speechList = newSpeechList;
_activeVoiceFileTotalTime = 0;
- for (Common::List<Audio::AudioStream *>::iterator i = _speechList.begin(); i != _speechList.end(); ++i) {
+ for (SpeechList::iterator i = _speechList.begin(); i != _speechList.end(); ++i) {
// Just in case any file loading failed: Remove the bad streams here.
if (!*i)
i = _speechList.erase(i);
else
- _activeVoiceFileTotalTime += (*i)->getTotalPlayTime();
+ _activeVoiceFileTotalTime += (*i)->getLength().msecs();
}
_sound->playVoiceStream(*_speechList.begin(), &_speechHandle);
@@ -151,7 +151,7 @@ void LoLEngine::snd_stopSpeech(bool setFlag) {
_activeVoiceFileTotalTime = 0;
_nextSpeechId = _nextSpeaker = -1;
- for (Common::List<Audio::AudioStream *>::iterator i = _speechList.begin(); i != _speechList.end(); ++i)
+ for (SpeechList::iterator i = _speechList.begin(); i != _speechList.end(); ++i)
delete *i;
_speechList.clear();