MORTEVIELLE: Move the end of "sentence" to the main loop in order to fix the display

This commit is contained in:
Strangerke 2013-08-11 11:39:47 +02:00
parent 13ddf33e78
commit b749c2115b
5 changed files with 14 additions and 6 deletions

View File

@ -238,6 +238,11 @@ void SoundManager::litph(tablint &t, int typ, int tempo) {
if (_vm->_speechManager._typlec == 0)
return;
if (!_vm->_speechManager._buildingSentence) {
if (!_mixer->isSoundHandleActive(_soundHandle))
_mixer->stopHandle(_speakerHandle);
_vm->_speechManager._buildingSentence = true;
}
int freq = tempo * 10 * 25.2;
int i = 0;
while (i < _vm->_speechManager._ptr_oct) {

View File

@ -103,6 +103,8 @@ private:
public:
Audio::Mixer *_mixer;
Audio::QueuingAudioStream *_audioStream;
Audio::SoundHandle _soundHandle;
SoundManager(Audio::Mixer *mixer);
~SoundManager();

View File

@ -70,6 +70,7 @@ SpeechManager::SpeechManager() {
_queue[i]._rep = 0;
}
_noise5Buf = nullptr;
_buildingSentence = false;
}
SpeechManager::~SpeechManager() {
@ -553,13 +554,10 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) {
handlePhoneme();
_vm->_soundManager.litph(_tbi, typ, tempo);
_vm->_speechManager._buildingSentence = false;
if (typ != 0) {
Audio::SoundHandle soundHandle;
_vm->_soundManager._audioStream->finish();
_vm->_soundManager._mixer->playStream(Audio::Mixer::kSFXSoundType, &soundHandle, _vm->_soundManager._audioStream);
while (_vm->_soundManager._mixer->isSoundHandleActive(soundHandle) && !_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit())
;
_vm->_soundManager._mixer->stopHandle(soundHandle);
_vm->_soundManager._mixer->playStream(Audio::Mixer::kSFXSoundType, &_vm->_soundManager._soundHandle, _vm->_soundManager._audioStream);
_vm->_soundManager._audioStream = nullptr;
}

View File

@ -58,7 +58,6 @@ private:
int _phonemeNumb;
SpeechQueue _queue[3];
public:
int _typlec;
int _ptr_oct;
@ -67,6 +66,7 @@ public:
int _mlec;
byte *_noise5Buf;
int _noise5Size;
bool _buildingSentence;
SpeechManager();
~SpeechManager();

View File

@ -276,6 +276,9 @@ void MortevielleEngine::handleAction() {
if (shouldQuit())
return;
++temps;
if (!_soundManager._mixer->isSoundHandleActive(_soundManager._soundHandle) || keyPressed() || _mouseClick) {
_soundManager._mixer->stopHandle(_soundManager._soundHandle);
}
} while (!((_menu._menuSelected) || (temps > lim) || (funct) || (_anyone)));
_inMainGameLoop = false;