[Scummvm-cvs-logs] SF.net SVN: scummvm: [22566] scummvm/trunk/engines/kyra
eriktorbjorn at users.sourceforge.net
eriktorbjorn at users.sourceforge.net
Sun May 21 13:26:00 CEST 2006
Revision: 22566
Author: eriktorbjorn
Date: 2006-05-21 13:25:22 -0700 (Sun, 21 May 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=22566&view=rev
Log Message:
-----------
If possible, sync the frame to getSoundElapsedTime().
Modified Paths:
--------------
scummvm/trunk/engines/kyra/vqa.cpp
scummvm/trunk/engines/kyra/vqa.h
Modified: scummvm/trunk/engines/kyra/vqa.cpp
===================================================================
--- scummvm/trunk/engines/kyra/vqa.cpp 2006-05-21 20:08:14 UTC (rev 22565)
+++ scummvm/trunk/engines/kyra/vqa.cpp 2006-05-21 20:25:22 UTC (rev 22566)
@@ -341,9 +341,7 @@
if (_header.flags & 1) {
// A 2-second buffer ought to be enough
_stream = Audio::makeAppendableAudioStream(_header.freq, Audio::Mixer::FLAG_UNSIGNED, 2 * _header.freq * _header.channels);
- _sound = new Audio::SoundHandle;
} else {
- _sound = NULL;
_stream = NULL;
}
@@ -422,11 +420,8 @@
delete [] _partialCodeBook;
delete [] _vectorPointers;
- if (_sound) {
- _vm->_mixer->stopHandle(*_sound);
- delete _sound;
- _stream = NULL;
- _sound = NULL;
+ if (_vm->_mixer->isSoundHandleActive(_sound)) {
+ _vm->_mixer->stopHandle(_sound);
}
_frameInfo = NULL;
@@ -445,7 +440,7 @@
}
}
-void VQAMovie::displayFrame(int frameNum) {
+void VQAMovie::displayFrame(uint frameNum) {
debugC(9, kDebugLevelMovie, "VQAMovie::displayFrame(%d)", frameNum);
if (frameNum >= _header.numFrames || !_opened)
return;
@@ -717,15 +712,25 @@
}
}
- _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, _sound, _stream);
+ _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sound, _stream);
- for (int i = 0; i < _header.numFrames; i++) {
+ for (uint i = 0; i < _header.numFrames; i++) {
displayFrame(i);
- // TODO: We ought to sync this to how much sound we've played.
// TODO: Implement frame skipping?
- while (_system->getMillis() < startTick + (i * 1000) / _header.frameRate) {
+ while (1) {
+ uint32 elapsedTime;
+
+ if (_vm->_mixer->isSoundHandleActive(_sound)) {
+ elapsedTime = _vm->_mixer->getSoundElapsedTime(_sound);
+ } else {
+ elapsedTime = _system->getMillis() - startTick;
+ }
+
+ if (elapsedTime >= (i * 1000) / _header.frameRate)
+ break;
+
OSystem::Event event;
while (_system->pollEvent(event)) {
Modified: scummvm/trunk/engines/kyra/vqa.h
===================================================================
--- scummvm/trunk/engines/kyra/vqa.h 2006-05-21 20:08:14 UTC (rev 22565)
+++ scummvm/trunk/engines/kyra/vqa.h 2006-05-21 20:25:22 UTC (rev 22566)
@@ -94,7 +94,7 @@
int decodeFormat80(byte *inbuf, byte *outbuf);
void decodeSND1(byte *inbuf, uint32 insize, byte *outbuf, uint32 outsize);
- void displayFrame(int frameNum);
+ void displayFrame(uint frameNum);
Common::File _file;
@@ -112,7 +112,7 @@
byte *_frame;
Audio::AppendableAudioStream *_stream;
- Audio::SoundHandle *_sound;
+ Audio::SoundHandle _sound;
uint32 readTag();
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list