Using AppandableAudioStream::getTotalPlayTime() instead of the difference between current and start time to sync audio and video

svn-id: r35315
This commit is contained in:
Sven Hesse
2008-12-12 14:28:06 +00:00
parent cfa939d151
commit 63ddc1ba6f
2 changed files with 3 additions and 12 deletions
+1 -9
View File
@@ -330,7 +330,7 @@ void Imd::waitEndFrame() {
if (_skipFrames == 0) {
int32 waitTime = (int16) (((_curFrame * _soundSliceLength) -
((g_system->getMillis() - _soundStartTime) << 16)) >> 16);
(_audioStream->getTotalPlayTime() << 16)) >> 16);
if (waitTime < 0) {
_skipFrames = -waitTime / (_soundSliceLength >> 16);
@@ -344,11 +344,6 @@ void Imd::waitEndFrame() {
g_system->delayMillis(_frameLength);
}
void Imd::notifyPaused(uint32 duration) {
if (_soundStage == 2)
_soundStartTime += duration;
}
void Imd::copyCurrentFrame(byte *dest,
uint16 left, uint16 top, uint16 width, uint16 height,
uint16 x, uint16 y, uint16 pitch, int16 transp) {
@@ -444,7 +439,6 @@ void Imd::clear(bool del) {
_hasSound = false;
_soundEnabled = false;
_soundStage = 0;
_soundStartTime = 0;
_skipFrames = 0;
_soundFlags = 0;
@@ -638,7 +632,6 @@ CoktelVideo::State Imd::processFrame(uint16 frame) {
if (startSound && _soundEnabled) {
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_audioHandle, _audioStream);
_soundStartTime = g_system->getMillis();
_skipFrames = 0;
_soundStage = 2;
}
@@ -1276,7 +1269,6 @@ CoktelVideo::State Vmd::processFrame(uint16 frame) {
if (startSound && _soundEnabled) {
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_audioHandle, _audioStream);
_soundStartTime = g_system->getMillis();
_skipFrames = 0;
_soundStage = 2;
}
+2 -3
View File
@@ -215,6 +215,8 @@ public:
bool hasExtraData(const char *fileName) const { return false; }
Common::MemoryReadStream *getExtraData(const char *fileName) { return 0; }
void notifyPaused(uint32 duration) { }
void setFrameRate(int16 frameRate);
bool load(Common::SeekableReadStream &stream);
@@ -234,8 +236,6 @@ public:
State nextFrame();
void waitEndFrame();
void notifyPaused(uint32 duration);
void copyCurrentFrame(byte *dest,
uint16 left, uint16 top, uint16 width, uint16 height,
uint16 x, uint16 y, uint16 pitch, int16 transp = -1);
@@ -272,7 +272,6 @@ protected:
bool _hasSound;
bool _soundEnabled;
uint8 _soundStage; // (0: no sound, 1: loaded, 2: playing)
uint32 _soundStartTime;
uint32 _skipFrames;
uint16 _soundFlags;