diff options
author | Sven Hesse | 2007-02-15 22:07:44 +0000 |
---|---|---|
committer | Sven Hesse | 2007-02-15 22:07:44 +0000 |
commit | 15043066f2d7644ee7e885b1c57227bfeec34c3a (patch) | |
tree | 41a104d10d66f0edcc28e6c9d84eac9de7b0e18d /engines/gob | |
parent | e3e76b59b6022054433c6c1df994b5ef97d8fa82 (diff) | |
download | scummvm-rg350-15043066f2d7644ee7e885b1c57227bfeec34c3a.tar.gz scummvm-rg350-15043066f2d7644ee7e885b1c57227bfeec34c3a.tar.bz2 scummvm-rg350-15043066f2d7644ee7e885b1c57227bfeec34c3a.zip |
- Changed the speaker stuff again
- Added the spanish gob2 version from bug report #1659884
svn-id: r25615
Diffstat (limited to 'engines/gob')
-rw-r--r-- | engines/gob/detection.cpp | 12 | ||||
-rw-r--r-- | engines/gob/inter_v1.cpp | 3 | ||||
-rw-r--r-- | engines/gob/sound.cpp | 32 | ||||
-rw-r--r-- | engines/gob/sound.h | 7 |
4 files changed, 51 insertions, 3 deletions
diff --git a/engines/gob/detection.cpp b/engines/gob/detection.cpp index 2711d368fd..605cb90e55 100644 --- a/engines/gob/detection.cpp +++ b/engines/gob/detection.cpp @@ -316,6 +316,18 @@ static const GOBGameDescription gameDescriptions[] = { GF_GOB2, "intro" }, + { // Supplied by arcepi in bug report #1659884 + { + "gob2", + "", + AD_ENTRY1s("intro.stk", "5f53c56e3aa2f1e76c2e4f0caa15887f", 829232), + ES_ESP, + kPlatformPC, + Common::ADGF_NO_FLAGS + }, + GF_GOB2, + "intro" + }, { { "gob2", diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp index e11f452287..7e066cc1b7 100644 --- a/engines/gob/inter_v1.cpp +++ b/engines/gob/inter_v1.cpp @@ -1467,8 +1467,9 @@ bool Inter_v1::o1_keyFunc(char &cmdCount, int16 &counter, int16 &retFlag) { if (flag != 1) { if (flag != 2) { + _vm->_snd->speakerOnUpdate(flag); if (flag < 20) { - _vm->_util->delay(flag * 2); + _vm->_util->delay(flag); _noBusyWait = true; } else diff --git a/engines/gob/sound.cpp b/engines/gob/sound.cpp index c39eb1165d..fd8d7488cb 100644 --- a/engines/gob/sound.cpp +++ b/engines/gob/sound.cpp @@ -36,6 +36,7 @@ Snd::SquareWaveStream::SquareWaveStream() { _periodSamples = 0; _remainingSamples = 0; _sampleValue = 0; + _mixedSamples = 0; } void Snd::SquareWaveStream::playNote(int freq, int32 ms, uint rate) { @@ -50,6 +51,29 @@ void Snd::SquareWaveStream::playNote(int freq, int32 ms, uint rate) { _remainingSamples = (_rate * ms) / 1000; _beepForever = false; } + _mixedSamples = 0; +} + +void Snd::SquareWaveStream::stop(uint32 milis) { + if (!_beepForever) + return; + + if (milis) + update(milis); + else + _remainingSamples = 0; +} + +void Snd::SquareWaveStream::update(uint32 milis) { + uint32 neededSamples; + + if (!_beepForever || !_remainingSamples) + return; + + neededSamples = (_rate * milis) / 1000; + _remainingSamples = + neededSamples > _mixedSamples ? neededSamples - _mixedSamples : 0; + _beepForever = false; } int Snd::SquareWaveStream::readBuffer(int16 *buffer, const int numSamples) { @@ -65,6 +89,7 @@ int Snd::SquareWaveStream::readBuffer(int16 *buffer, const int numSamples) { } if (!_beepForever) _remainingSamples--; + _mixedSamples++; } return numSamples; @@ -107,10 +132,15 @@ void Snd::setBlasterPort(int16 port) {return;} void Snd::speakerOn(int16 frequency, int32 length) { _speakerStream.playNote(frequency, length, _vm->_mixer->getOutputRate()); + _speakerStartTimeKey = _vm->_util->getTimeKey(); } void Snd::speakerOff(void) { - _speakerStream.stop(); + _speakerStream.stop(_vm->_util->getTimeKey() - _speakerStartTimeKey); +} + +void Snd::speakerOnUpdate(uint32 milis) { + _speakerStream.update(milis); } void Snd::stopSound(int16 fadeLength) diff --git a/engines/gob/sound.h b/engines/gob/sound.h index 4a614fc8cc..8d7ffd7b8d 100644 --- a/engines/gob/sound.h +++ b/engines/gob/sound.h @@ -51,6 +51,7 @@ public: Snd(GobEngine *vm); void speakerOn(int16 frequency, int32 length); void speakerOff(void); + void speakerOnUpdate(uint32 milis); SoundDesc *loadSoundData(const char *path); void stopSound(int16 fadeLength); void playSample(SoundDesc *sndDesc, int16 repCount, int16 frequency, int16 fadeLength = 0); @@ -79,6 +80,7 @@ protected: uint32 _periodLength; uint32 _periodSamples; uint32 _remainingSamples; + uint32 _mixedSamples; int16 _sampleValue; public: @@ -86,7 +88,8 @@ protected: ~SquareWaveStream() {} void playNote(int freq, int32 ms, uint rate); - void stop(void) { _remainingSamples = 0; } + void update(uint32 milis); + void stop(uint32 milis); int readBuffer(int16 *buffer, const int numSamples); @@ -98,6 +101,8 @@ protected: SquareWaveStream _speakerStream; Audio::SoundHandle _speakerHandle; + uint32 _speakerStartTimeKey; + Audio::SoundHandle *_activeHandle; Audio::SoundHandle _compositionHandle; |