From ce04dd9f7e77fe1c31eb14aebde2f69c16d33684 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 14 Dec 2003 16:32:21 +0000 Subject: Fixed a potential crash bug where an audio buffer would be freed at the end of an animated cutscene while the mixer was still using it. Oddly enough, I didn't encounter this bug when I played through the game recently, but today it happened every time at the end of the cutscene where Nico finds the jaguar stone. svn-id: r11637 --- sword2/driver/d_draw.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sword2/driver/d_draw.cpp b/sword2/driver/d_draw.cpp index dab3f9ce5b..82fa3a2415 100644 --- a/sword2/driver/d_draw.cpp +++ b/sword2/driver/d_draw.cpp @@ -215,6 +215,15 @@ int32 MoviePlayer::play(char *filename, _movieTextObject *text[], uint8 *musicOu _vm->_system->delay_msecs(90); } + // Wait for the voice to stop playing. This is to make sure + // that we don't cut off the speech in mid-sentence, and - even + // more importantly - that we don't free the sound buffer while + // it's in use. + + while (handle) { + _vm->_system->delay_msecs(100); + }; + closeTextObject(text[textCounter]); _vm->_graphics->clearScene(); -- cgit v1.2.3