GOB: Loop the Little Red title music

This commit is contained in:
Sven Hesse 2012-06-16 02:58:53 +02:00
parent f917db972e
commit a24cb57c9d
6 changed files with 39 additions and 3 deletions

View File

@ -527,6 +527,7 @@ protected:
virtual void setupOpcodesGob();
void oLittleRed_keyFunc(OpFuncParams &params);
void oLittleRed_playComposition(OpFuncParams &params);
};
class Inter_v3 : public Inter_v2 {

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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();
else
SoundMixer::checkEndSample();
return;
}
if (_compositionRepCount != 0) {
if (_compositionRepCount > 0)
_compositionRepCount--;
nextCompositionPos();
if (_compositionPos != -1)
return;
}
SoundMixer::checkEndSample();
}
void SoundBlaster::endFade() {

View File

@ -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,