aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorSven Hesse2012-06-16 02:58:53 +0200
committerSven Hesse2012-06-16 02:58:53 +0200
commita24cb57c9d4d4292da582fafc52be70103a1e369 (patch)
tree0ec1b2907a6336296c2e7ad107e8fa1a1f82c4b3 /engines
parentf917db972e0ae7e4e82a6430010a155cbb3a92c0 (diff)
downloadscummvm-rg350-a24cb57c9d4d4292da582fafc52be70103a1e369.tar.gz
scummvm-rg350-a24cb57c9d4d4292da582fafc52be70103a1e369.tar.bz2
scummvm-rg350-a24cb57c9d4d4292da582fafc52be70103a1e369.zip
GOB: Loop the Little Red title music
Diffstat (limited to 'engines')
-rw-r--r--engines/gob/inter.h1
-rw-r--r--engines/gob/inter_littlered.cpp8
-rw-r--r--engines/gob/sound/sound.cpp4
-rw-r--r--engines/gob/sound/sound.h1
-rw-r--r--engines/gob/sound/soundblaster.cpp24
-rw-r--r--engines/gob/sound/soundblaster.h4
6 files changed, 39 insertions, 3 deletions
diff --git a/engines/gob/inter.h b/engines/gob/inter.h
index 0625646cdd..63bf3eb1c6 100644
--- a/engines/gob/inter.h
+++ b/engines/gob/inter.h
@@ -527,6 +527,7 @@ protected:
virtual void setupOpcodesGob();
void oLittleRed_keyFunc(OpFuncParams &params);
+ void oLittleRed_playComposition(OpFuncParams &params);
};
class Inter_v3 : public Inter_v2 {
diff --git a/engines/gob/inter_littlered.cpp b/engines/gob/inter_littlered.cpp
index 3a4494598e..729d9f5694 100644
--- a/engines/gob/inter_littlered.cpp
+++ b/engines/gob/inter_littlered.cpp
@@ -48,6 +48,8 @@ void Inter_LittleRed::setupOpcodesFunc() {
Inter_v2::setupOpcodesFunc();
OPCODEFUNC(0x14, oLittleRed_keyFunc);
+
+ OPCODEFUNC(0x3D, oLittleRed_playComposition);
}
void Inter_LittleRed::setupOpcodesGob() {
@@ -107,4 +109,10 @@ void Inter_LittleRed::oLittleRed_keyFunc(OpFuncParams &params) {
}
}
+void Inter_LittleRed::oLittleRed_playComposition(OpFuncParams &params) {
+ _vm->_sound->blasterRepeatComposition(-1);
+
+ o1_playComposition(params);
+}
+
} // End of namespace Gob
diff --git a/engines/gob/sound/sound.cpp b/engines/gob/sound/sound.cpp
index 9f72d1a98f..170330f281 100644
--- a/engines/gob/sound/sound.cpp
+++ b/engines/gob/sound/sound.cpp
@@ -445,6 +445,10 @@ void Sound::blasterPlay(SoundDesc *sndDesc, int16 repCount,
_blaster->playSample(*sndDesc, repCount, frequency, fadeLength);
}
+void Sound::blasterRepeatComposition(int32 repCount) {
+ _blaster->repeatComposition(repCount);;
+}
+
void Sound::blasterStop(int16 fadeLength, SoundDesc *sndDesc) {
if (!_blaster)
return;
diff --git a/engines/gob/sound/sound.h b/engines/gob/sound/sound.h
index 064a249253..6ad0ec5483 100644
--- a/engines/gob/sound/sound.h
+++ b/engines/gob/sound/sound.h
@@ -63,6 +63,7 @@ public:
void blasterPlayComposition(int16 *composition, int16 freqVal,
SoundDesc *sndDescs = 0, int8 sndCount = kSoundsCount);
void blasterStopComposition();
+ void blasterRepeatComposition(int32 repCount);
char blasterPlayingSound() const;
diff --git a/engines/gob/sound/soundblaster.cpp b/engines/gob/sound/soundblaster.cpp
index 4ff555b0e3..915d744494 100644
--- a/engines/gob/sound/soundblaster.cpp
+++ b/engines/gob/sound/soundblaster.cpp
@@ -31,6 +31,8 @@ SoundBlaster::SoundBlaster(Audio::Mixer &mixer) : SoundMixer(mixer, Audio::Mixer
_compositionSamples = 0;
_compositionSampleCount = 0;
_compositionPos = -1;
+
+ _compositionRepCount = 0;
}
SoundBlaster::~SoundBlaster() {
@@ -79,6 +81,7 @@ void SoundBlaster::nextCompositionPos() {
if (_compositionPos == 49)
_compositionPos = -1;
}
+
_compositionPos = -1;
}
@@ -98,6 +101,10 @@ void SoundBlaster::playComposition(int16 *composition, int16 freqVal,
nextCompositionPos();
}
+void SoundBlaster::repeatComposition(int32 repCount) {
+ _compositionRepCount = repCount;
+}
+
void SoundBlaster::setSample(SoundDesc &sndDesc, int16 repCount, int16 frequency,
int16 fadeLength) {
@@ -106,10 +113,21 @@ void SoundBlaster::setSample(SoundDesc &sndDesc, int16 repCount, int16 frequency
}
void SoundBlaster::checkEndSample() {
- if (_compositionPos != -1)
+ if (_compositionPos != -1) {
+ nextCompositionPos();
+ return;
+ }
+
+ if (_compositionRepCount != 0) {
+ if (_compositionRepCount > 0)
+ _compositionRepCount--;
+
nextCompositionPos();
- else
- SoundMixer::checkEndSample();
+ if (_compositionPos != -1)
+ return;
+ }
+
+ SoundMixer::checkEndSample();
}
void SoundBlaster::endFade() {
diff --git a/engines/gob/sound/soundblaster.h b/engines/gob/sound/soundblaster.h
index c2704c5482..c740ba2269 100644
--- a/engines/gob/sound/soundblaster.h
+++ b/engines/gob/sound/soundblaster.h
@@ -46,6 +46,8 @@ public:
void stopComposition();
void endComposition();
+ void repeatComposition(int32 repCount);
+
protected:
Common::Mutex _mutex;
@@ -54,6 +56,8 @@ protected:
int16 _composition[50];
int8 _compositionPos;
+ int32 _compositionRepCount;
+
SoundDesc *_curSoundDesc;
void setSample(SoundDesc &sndDesc, int16 repCount,