diff options
| -rw-r--r-- | engines/scumm/he/sound_he.cpp | 5 | ||||
| -rw-r--r-- | engines/scumm/imuse/imuse.cpp | 8 | ||||
| -rw-r--r-- | engines/scumm/imuse/imuse.h | 2 | ||||
| -rw-r--r-- | engines/scumm/imuse/imuse_internal.h | 6 | ||||
| -rw-r--r-- | engines/scumm/imuse/imuse_player.cpp | 7 | 
5 files changed, 24 insertions, 4 deletions
| diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp index 254fecbe0d..8dd59ca388 100644 --- a/engines/scumm/he/sound_he.cpp +++ b/engines/scumm/he/sound_he.cpp @@ -748,9 +748,12 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)  	}  	else if (READ_BE_UINT32(ptr) == MKID_BE('MIDI')) {  		if (_vm->_imuse) { +			// This is used in the DOS version of Fatty Bear's +			// Birthday Surprise to change the note on the piano +			// when not using a digitized instrument.  			_vm->_imuse->stopSound(_currentMusic);  			_currentMusic = soundID; -			_vm->_imuse->startSound(soundID); +			_vm->_imuse->startSoundWithNoteOffset(soundID, heOffset);  		}  	}  } diff --git a/engines/scumm/imuse/imuse.cpp b/engines/scumm/imuse/imuse.cpp index 409e1140f1..5b00a973f9 100644 --- a/engines/scumm/imuse/imuse.cpp +++ b/engines/scumm/imuse/imuse.cpp @@ -491,7 +491,10 @@ void IMuseInternal::addSysexHandler(byte mfgID, sysexfunc handler) {  	_sysex = handler;  } - +void IMuseInternal::startSoundWithNoteOffset(int sound, int offset) { +	Common::StackLock lock(_mutex, "IMuseInternal::startSound()"); +	startSound_internal(sound, offset); +}  ////////////////////////////////////////  // @@ -559,7 +562,7 @@ int IMuseInternal::getMusicTimer() const {  //  //////////////////////////////////////// -bool IMuseInternal::startSound_internal(int sound) { +bool IMuseInternal::startSound_internal(int sound, int offset) {  	// Do not start a sound if it is already set to start on an ImTrigger  	// event. This fixes carnival music problems where a sound has been set  	// to trigger at the right time, but then is started up immediately @@ -632,6 +635,7 @@ bool IMuseInternal::startSound_internal(int sound) {  		ImClearTrigger(81, 1);  	player->clear(); +	player->setOffsetNote(offset);  	return player->startSound(sound, driver, _direct_passthrough);  } diff --git a/engines/scumm/imuse/imuse.h b/engines/scumm/imuse/imuse.h index ece4a30e14..d7ce2b7bdd 100644 --- a/engines/scumm/imuse/imuse.h +++ b/engines/scumm/imuse/imuse.h @@ -74,6 +74,8 @@ public:  	virtual void addSysexHandler (byte mfgID, sysexfunc handler) = 0;  public: +	virtual void startSoundWithNoteOffset(int sound, int offset) = 0; +  	// MusicEngine base class methods.  	// Not actually redefined here because none are implemented. diff --git a/engines/scumm/imuse/imuse_internal.h b/engines/scumm/imuse/imuse_internal.h index da27cdcebc..e3d2b9b2a4 100644 --- a/engines/scumm/imuse/imuse_internal.h +++ b/engines/scumm/imuse/imuse_internal.h @@ -185,6 +185,7 @@ protected:  	int8 _pan;  	int8 _transpose;  	int8 _detune; +	int _note_offset;  	byte _vol_eff;  	uint _track_index; @@ -270,6 +271,7 @@ public:  	void saveLoadWithSerializer(Serializer *ser);  	int setHook(byte cls, byte value, byte chan) { return _hook.set(cls, value, chan); }  	void setDetune(int detune); +	void setOffsetNote(int offset);  	bool setLoop(uint count, uint tobeat, uint totick, uint frombeat, uint fromtick);  	void setPan(int pan);  	void setPriority(int pri); @@ -507,7 +509,7 @@ protected:  protected:  	// Internal mutex-free versions of the IMuse and MusicEngine methods. -	bool startSound_internal(int sound); +	bool startSound_internal(int sound, int offset = 0);  	int stopSound_internal(int sound);  	int stopAllSounds_internal();  	int getSoundStatus_internal(int sound, bool ignoreFadeouts) const; @@ -525,6 +527,8 @@ public:  	virtual void addSysexHandler(byte mfgID, sysexfunc handler);  public: +	void startSoundWithNoteOffset(int sound, int offset); +  	// MusicEngine interface  	void setMusicVolume(int vol);  	void startSound(int sound); diff --git a/engines/scumm/imuse/imuse_player.cpp b/engines/scumm/imuse/imuse_player.cpp index 0d79917bf3..78aba6ced1 100644 --- a/engines/scumm/imuse/imuse_player.cpp +++ b/engines/scumm/imuse/imuse_player.cpp @@ -72,6 +72,7 @@ Player::Player() :  	_pan(0),  	_transpose(0),  	_detune(0), +	_note_offset(0),  	_vol_eff(0),  	_track_index(0),  	_loop_to_beat(0), @@ -165,6 +166,7 @@ void Player::clear() {  	_active = false;  	_midi = NULL;  	_id = 0; +	_note_offset = 0;  }  void Player::hook_clear() { @@ -252,6 +254,7 @@ void Player::send(uint32 b) {  		break;  	case 0x9: // Key On +		param1 += _note_offset;  		if (!_scanning) {  			if (_isMT32 && !_se->isNativeMT32())  				param2 = (((param2 * 3) >> 2) + 32) & 0x7F; @@ -666,6 +669,10 @@ void Player::setDetune(int detune) {  	}  } +void Player::setOffsetNote(int offset) { +	_note_offset = offset; +} +  int Player::scan(uint totrack, uint tobeat, uint totick) {  	if (!_active || !_parser)  		return -1; | 
