diff options
author | Travis Howell | 2004-06-22 10:39:46 +0000 |
---|---|---|
committer | Travis Howell | 2004-06-22 10:39:46 +0000 |
commit | 7989a9895252935ab8bcb0740f7ea82301006c60 (patch) | |
tree | 2b6a98ea2a6a9980d96d850c2bc8f373c4810814 | |
parent | 5ce27765af27afebefbe0088d2fdd980e7dccc3a (diff) | |
download | scummvm-rg350-7989a9895252935ab8bcb0740f7ea82301006c60.tar.gz scummvm-rg350-7989a9895252935ab8bcb0740f7ea82301006c60.tar.bz2 scummvm-rg350-7989a9895252935ab8bcb0740f7ea82301006c60.zip |
Add FBEAR: Partial fix for the piano, patch #977249
svn-id: r13999
-rw-r--r-- | scumm/intern.h | 2 | ||||
-rw-r--r-- | scumm/script_v6he.cpp | 14 | ||||
-rw-r--r-- | scumm/script_v7he.cpp | 2 | ||||
-rw-r--r-- | scumm/sound.cpp | 12 | ||||
-rw-r--r-- | scumm/sound.h | 3 |
5 files changed, 25 insertions, 8 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index 99fb537630..9ee08890a9 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -596,7 +596,7 @@ protected: void o6_readFile(); void o6_rename(); void o6_writeFile(); - void o6_setVolume(); + void o6_soundOps(); void o6_seekFilePos(); void o6_localizeArray(); void o6_redimArray(); diff --git a/scumm/script_v6he.cpp b/scumm/script_v6he.cpp index 74f4a80486..29ba84f109 100644 --- a/scumm/script_v6he.cpp +++ b/scumm/script_v6he.cpp @@ -331,7 +331,7 @@ void ScummEngine_v6he::setupOpcodes() { OPCODE(o6_deleteFile), OPCODE(o6_rename), /* E0 */ - OPCODE(o6_setVolume), + OPCODE(o6_soundOps), OPCODE(o6_unknownE1), OPCODE(o6_localizeArray), OPCODE(o6_pickVarRandom), @@ -402,6 +402,9 @@ void ScummEngine_v6he::o6_setState() { void ScummEngine_v6he::o6_startSound() { // Seems to range between 952 - 9000 + // In Fatty Bear's Birthday Surprise the piano uses offsets 1 - 23 to + // indicate which note to play, but only when using the standard piano + // sound. See also o6_soundOps(). int offset = pop(); debug(2, "o6_startSound: offset %d", offset); _sound->addSoundToQueue(pop()); @@ -1136,17 +1139,18 @@ void ScummEngine_v6he::o6_writeFile() { } } -void ScummEngine_v6he::o6_setVolume() { +void ScummEngine_v6he::o6_soundOps() { byte subOp = fetchScriptByte(); - int soundVolumeMaster; int volume = pop(); switch (subOp) { case 0xde: _mixer->setMusicVolume(volume); break; case 0xe0: - soundVolumeMaster = ConfMan.getInt("master_volume"); - _mixer->setVolume(volume * soundVolumeMaster / 255); + // Fatty Bear's Birthday surprise uses this when playing the + // piano, but only when using one of the digitized instruments. + // See also o6_startSound(). + _sound->setOverrideFreq(volume); break; } } diff --git a/scumm/script_v7he.cpp b/scumm/script_v7he.cpp index 6cd844c9b8..a58f4bb129 100644 --- a/scumm/script_v7he.cpp +++ b/scumm/script_v7he.cpp @@ -331,7 +331,7 @@ void ScummEngine_v7he::setupOpcodes() { OPCODE(o6_deleteFile), OPCODE(o6_rename), /* E0 */ - OPCODE(o6_setVolume), + OPCODE(o6_soundOps), OPCODE(o6_unknownE1), OPCODE(o6_localizeArray), OPCODE(o6_pickVarRandom), diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 375d85ff00..6fe3a99e17 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -68,6 +68,7 @@ Sound::Sound(ScummEngine *parent) _mouthSyncMode(false), _endOfMouthSync(false), _curSoundPos(0), + _overrideFreq(0), _currentCDSound(0), _soundsPaused(false), _sfxMode(0) { @@ -140,6 +141,10 @@ void Sound::processSoundQues() { _soundQuePos = 0; } +void Sound::setOverrideFreq(int freq) { + _overrideFreq = freq; +} + void Sound::playSound(int soundID) { byte *ptr; char *sound; @@ -182,7 +187,12 @@ void Sound::playSound(int soundID) { size = READ_BE_UINT32(ptr+4) - 8; // FIXME - what value here ?!? 11025 is just a guess based on strings in w32 bin, prev guess 8000 - rate = 11025; + if (_overrideFreq) { + // Used by the piano in Fatty Bear's Birthday Surprise + rate = _overrideFreq; + _overrideFreq = 0; + } else + rate = 11025; // Allocate a sound buffer, copy the data into it, and play sound = (char *)malloc(size); diff --git a/scumm/sound.h b/scumm/sound.h index b5cd51bfba..2deb8d2935 100644 --- a/scumm/sound.h +++ b/scumm/sound.h @@ -70,6 +70,8 @@ protected: uint16 _mouthSyncTimes[64]; uint _curSoundPos; + int _overrideFreq; + int _currentCDSound; public: PlayingSoundHandle _talkChannelHandle; // Handle of mixer channel actor is talking on @@ -82,6 +84,7 @@ public: void addSoundToQueue(int sound); void addSoundToQueue2(int sound); void processSoundQues(); + void setOverrideFreq(int freq); void playSound(int sound); void startTalkSound(uint32 offset, uint32 b, int mode, PlayingSoundHandle *handle = NULL); void stopTalkSound(); |