[Scummvm-cvs-logs] scummvm master -> 7b517f7fd1b463f268b2aa381ab00351092ba97b
criezy
criezy at scummvm.org
Sun Aug 4 14:01:59 CEST 2013
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
deef0b955c MORTEVIELLE: Fix crash in sound mixer when closing the engine
7b517f7fd1 MORTEVIELLE: Improve looping of the intro song
Commit: deef0b955ca95c6c4141668f60fd0bccc0b9949d
https://github.com/scummvm/scummvm/commit/deef0b955ca95c6c4141668f60fd0bccc0b9949d
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2013-08-04T04:56:15-07:00
Commit Message:
MORTEVIELLE: Fix crash in sound mixer when closing the engine
This was due to the _speakerHandle being reused between its
initialisation in the SoundManager constructor and the destructor
causing it to have a wrong value when trying (and failing) to stop
the PCSpeaker channel in the mixer before deleting the stream.
Changed paths:
engines/mortevielle/sound.cpp
diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp
index 95da5c0..d95b12d 100644
--- a/engines/mortevielle/sound.cpp
+++ b/engines/mortevielle/sound.cpp
@@ -187,10 +187,13 @@ void SoundManager::playNote(int frequency, int32 length) {
void SoundManager::playSong(const byte* buf, int size) {
Audio::AudioStream *stream = Audio::makeRawStream(buf, size, 11025 / 2, Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS);
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
+ Audio::SoundHandle songHandle;
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, &songHandle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
- while (_mixer->isSoundHandleActive(_speakerHandle) && !_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit())
+ while (_mixer->isSoundHandleActive(songHandle) && !_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit())
;
+ // In case the handle is still active, stop it.
+ _mixer->stopHandle(songHandle);
}
void SoundManager::setParent(MortevielleEngine *vm) {
Commit: 7b517f7fd1b463f268b2aa381ab00351092ba97b
https://github.com/scummvm/scummvm/commit/7b517f7fd1b463f268b2aa381ab00351092ba97b
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2013-08-04T04:59:34-07:00
Commit Message:
MORTEVIELLE: Improve looping of the intro song
Using a LoopingAudioStream gets rid of the pause between each loop
(and simplifies the code).
Changed paths:
engines/mortevielle/sound.cpp
engines/mortevielle/sound.h
engines/mortevielle/utils.cpp
diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp
index d95b12d..042097f 100644
--- a/engines/mortevielle/sound.cpp
+++ b/engines/mortevielle/sound.cpp
@@ -185,8 +185,8 @@ void SoundManager::playNote(int frequency, int32 length) {
}
-void SoundManager::playSong(const byte* buf, int size) {
- Audio::AudioStream *stream = Audio::makeRawStream(buf, size, 11025 / 2, Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS);
+void SoundManager::playSong(const byte* buf, int size, int loops) {
+ Audio::AudioStream *stream = Audio::makeLoopingAudioStream(Audio::makeRawStream(buf, size, 11025 / 2, Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS), loops);
Audio::SoundHandle songHandle;
_mixer->playStream(Audio::Mixer::kSFXSoundType, &songHandle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h
index 313859d..ee6aaff 100644
--- a/engines/mortevielle/sound.h
+++ b/engines/mortevielle/sound.h
@@ -106,7 +106,7 @@ public:
void playNote(int frequency, int32 length);
int decodeMusic(const byte *PSrc, byte *PDest, int size);
- void playSong(const byte *buf, int size);
+ void playSong(const byte *buf, int size, int loops = 1);
void litph(tablint &t, int typ, int tempo);
};
diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp
index d5dc678..5667e6e 100644
--- a/engines/mortevielle/utils.cpp
+++ b/engines/mortevielle/utils.cpp
@@ -2213,14 +2213,7 @@ void MortevielleEngine::music() {
_addFix = (float)((kTempoMusic - 8)) / 256;
_speechManager.cctable(_speechManager._tbi);
- bool fin = false;
- int k = 0;
- do {
- fin = keyPressed();
- _soundManager.playSong(musicBuf, musicSize);
- ++k;
- fin = fin | keyPressed() | (k >= 5);
- } while (!fin);
+ _soundManager.playSong(musicBuf, musicSize, 5);
while (keyPressed())
getChar();
More information about the Scummvm-git-logs
mailing list