aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorThierry Crozat2013-08-04 12:59:34 +0100
committerThierry Crozat2013-08-04 12:59:34 +0100
commit7b517f7fd1b463f268b2aa381ab00351092ba97b (patch)
treeb749e11498f9a7f33662b41dfd17d58c1dd4d23e /engines
parentdeef0b955ca95c6c4141668f60fd0bccc0b9949d (diff)
downloadscummvm-rg350-7b517f7fd1b463f268b2aa381ab00351092ba97b.tar.gz
scummvm-rg350-7b517f7fd1b463f268b2aa381ab00351092ba97b.tar.bz2
scummvm-rg350-7b517f7fd1b463f268b2aa381ab00351092ba97b.zip
MORTEVIELLE: Improve looping of the intro song
Using a LoopingAudioStream gets rid of the pause between each loop (and simplifies the code).
Diffstat (limited to 'engines')
-rw-r--r--engines/mortevielle/sound.cpp4
-rw-r--r--engines/mortevielle/sound.h2
-rw-r--r--engines/mortevielle/utils.cpp9
3 files changed, 4 insertions, 11 deletions
diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp
index d95b12da3c..042097f52c 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 313859dacf..ee6aaff4ad 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 d5dc678a72..5667e6e5c0 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();