Ticket #9100: fbear-dos-piano2.diff

File fbear-dos-piano2.diff, 4.2 KB (added by eriktorbjorn, 15 years ago)

New improved patch against current SVN (trunk)

  • engines/scumm/imuse/imuse_player.cpp

     
    7272        _pan(0),
    7373        _transpose(0),
    7474        _detune(0),
     75        _offset_note(0),
    7576        _vol_eff(0),
    7677        _track_index(0),
    7778        _loop_to_beat(0),
     
    165166        _active = false;
    166167        _midi = NULL;
    167168        _id = 0;
     169        _offset_note = 0;
    168170}
    169171
    170172void Player::hook_clear() {
     
    252254                break;
    253255
    254256        case 0x9: // Key On
     257                param1 += _offset_note;
    255258                if (!_scanning) {
    256259                        if (_isMT32 && !_se->isNativeMT32())
    257260                                param2 = (((param2 * 3) >> 2) + 32) & 0x7F;
     
    666669        }
    667670}
    668671
     672void Player::setOffsetNote(int offset) {
     673        _offset_note = offset;
     674}
     675
    669676int Player::scan(uint totrack, uint tobeat, uint totick) {
    670677        if (!_active || !_parser)
    671678                return -1;
  • engines/scumm/imuse/imuse.cpp

     
    491491        _sysex = handler;
    492492}
    493493
     494void IMuseInternal::startHESound(int sound, int offset) {
     495        Common::StackLock lock(_mutex, "IMuseInternal::startSound()");
     496        startSound_internal(sound, offset);
     497}
    494498
    495 
    496499////////////////////////////////////////
    497500//
    498501// MusicEngine interface methods
     
    559562//
    560563////////////////////////////////////////
    561564
    562 bool IMuseInternal::startSound_internal(int sound) {
     565bool IMuseInternal::startSound_internal(int sound, int offset) {
    563566        // Do not start a sound if it is already set to start on an ImTrigger
    564567        // event. This fixes carnival music problems where a sound has been set
    565568        // to trigger at the right time, but then is started up immediately
     
    632635                ImClearTrigger(81, 1);
    633636
    634637        player->clear();
     638        player->setOffsetNote(offset);
    635639        return player->startSound(sound, driver, _direct_passthrough);
    636640}
    637641
  • engines/scumm/imuse/imuse_internal.h

     
    185185        int8 _pan;
    186186        int8 _transpose;
    187187        int8 _detune;
     188        int _offset_note;
    188189        byte _vol_eff;
    189190
    190191        uint _track_index;
     
    270271        void saveLoadWithSerializer(Serializer *ser);
    271272        int setHook(byte cls, byte value, byte chan) { return _hook.set(cls, value, chan); }
    272273        void setDetune(int detune);
     274        void setOffsetNote(int offset);
    273275        bool setLoop(uint count, uint tobeat, uint totick, uint frombeat, uint fromtick);
    274276        void setPan(int pan);
    275277        void setPriority(int pri);
     
    507509
    508510protected:
    509511        // Internal mutex-free versions of the IMuse and MusicEngine methods.
    510         bool startSound_internal(int sound);
     512        bool startSound_internal(int sound, int offset = 0);
    511513        int stopSound_internal(int sound);
    512514        int stopAllSounds_internal();
    513515        int getSoundStatus_internal(int sound, bool ignoreFadeouts) const;
     
    525527        virtual void addSysexHandler(byte mfgID, sysexfunc handler);
    526528
    527529public:
     530        void startHESound(int sound, int offset);
     531
    528532        // MusicEngine interface
    529533        void setMusicVolume(int vol);
    530534        void startSound(int sound);
  • engines/scumm/imuse/imuse.h

     
    7474        virtual void addSysexHandler (byte mfgID, sysexfunc handler) = 0;
    7575
    7676public:
     77        virtual void startHESound(int sound, int offset) = 0;
     78
    7779        // MusicEngine base class methods.
    7880        // Not actually redefined here because none are implemented.
    7981
  • engines/scumm/he/sound_he.cpp

     
    741741        }
    742742        else if (READ_BE_UINT32(ptr) == MKID_BE('MIDI')) {
    743743                if (_vm->_imuse) {
     744                        // This is used in the DOS version of Fatty Bear's
     745                        // Birthday Surprise to change the note on the piano
     746                        // when not using a digitized instrument.
    744747                        _vm->_imuse->stopSound(_currentMusic);
    745748                        _currentMusic = soundID;
    746                         _vm->_imuse->startSound(soundID);
     749                        _vm->_imuse->startHESound(soundID, heOffset);
    747750                }
    748751        }
    749752}