Ticket #8276: native_mt32.rev2.diff

File native_mt32.rev2.diff, 4.8 KB (added by SF/jamieson630, 17 years ago)

Patch revision 2

  • scummvm/backends/midi/windows.cpp

    RCS file: /cvsroot/scummvm/scummvm/backends/midi/windows.cpp,v
    retrieving revision 1.12
    diff -u -r1.12 windows.cpp
     
    3939        bool _isOpen;
    4040
    4141        void check_error(MMRESULT result);
    42         uint32 property(int prop, uint32 param) { return 0; }
    4342
    4443public:
    4544        MidiDriver_WIN() : _isOpen (false) { }
  • scummvm/scumm/imuse_player.cpp

    RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_player.cpp,v
    retrieving revision 2.31
    diff -u -r2.31 imuse_player.cpp
     
    374374                        // as follows:
    375375                        //   BYTE 00: Channel #
    376376                        //   BYTE 02: BIT 01(0x01): Part on?(1 = yes)
     377                        //   BYTE 04: Priority adjustment [guessing]
    377378                        //   BYTE 05: Volume(upper 4 bits) [guessing]
    378379                        //   BYTE 06: Volume(lower 4 bits) [guessing]
    379380                        //   BYTE 09: BIT 04(0x08): Percussion?(1 = yes)
     
    382383                        part = getPart(p[0] & 0x0F);
    383384                        if (part) {
    384385                                part->set_onoff(p[2] & 0x01);
     386                                part->set_pri (p[4]);
    385387                                part->setVolume((p[5] & 0x0F) << 4 |(p[6] & 0x0F));
    386388                                part->_percussion = _isGM ?((p[9] & 0x08) > 0) : false;
    387389                                if (part->_percussion) {
  • scummvm/scumm/scummvm.cpp

    RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
    retrieving revision 2.402
    diff -u -r2.402 scummvm.cpp
     
    736736        } else if (((_midiDriver == MD_PCJR) || (_midiDriver == MD_PCSPK)) && ((_version > 2) && (_version < 5))) {
    737737                _musicEngine = _playerV2 = new Player_V2(this);
    738738        } else if (_version > 2) {
    739                 _musicEngine = _imuse = IMuse::create(syst, _mixer, detector->createMidi());
     739                MidiDriver *driver = detector->createMidi();
     740                if (driver && detector->_native_mt32)
     741                        driver->property (MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
     742                _musicEngine = _imuse = IMuse::create(syst, _mixer, driver);
    740743                if (_imuse) {
    741744                        if (detector->_gameTempo != 0)
    742745                                _imuse->property(IMuse::PROP_TEMPO_BASE, detector->_gameTempo);
  • scummvm/sound/mididrv.h

    RCS file: /cvsroot/scummvm/scummvm/sound/mididrv.h,v
    retrieving revision 1.26
    diff -u -r1.26 mididrv.h
     
    4444
    4545        enum {
    4646//              PROP_TIMEDIV = 1,
    47                 PROP_OLD_ADLIB = 2
     47                PROP_OLD_ADLIB = 2,
     48                PROP_CHANNEL_MASK = 3
    4849        };
    4950
    5051        // Open the midi driver.
  • scummvm/sound/mpu401.cpp

    RCS file: /cvsroot/scummvm/scummvm/sound/mpu401.cpp,v
    retrieving revision 1.17
    diff -u -r1.17 mpu401.cpp
     
    8585        _started_thread (false),
    8686        _mutex (0),
    8787        _timer_proc (0),
    88         _timer_param (0)
     88        _timer_param (0),
     89        _channel_mask (0xFFFF) // Permit all 16 channels by default
    8990{
    9091       
    9192        uint i;
     
    106107                send (0x7B << 8 | 0xB0 | i);
    107108}
    108109
     110uint32 MidiDriver_MPU401::property (int prop, uint32 param) {
     111        switch (prop) {
     112                case PROP_CHANNEL_MASK:
     113                        _channel_mask = param & 0xFFFF;
     114                        return 1;
     115        }
     116
     117        return 0;
     118}
     119
    109120MidiChannel *MidiDriver_MPU401::allocateChannel() {
    110121        MidiChannel_MPU401 *chan;
    111122        uint i;
    112123
    113124        for (i = 0; i < ARRAYSIZE(_midi_channels); ++i) {
    114                 if (i == 9)
     125                if (i == 9 || !(_channel_mask & (1 << i)))
    115126                        continue;
    116127                chan = &_midi_channels[i];
    117128                if (!chan->_allocated) {
  • scummvm/sound/mpu401.h

    RCS file: /cvsroot/scummvm/scummvm/sound/mpu401.h,v
    retrieving revision 1.13
    diff -u -r1.13 mpu401.h
     
    8585        OSystem::MutexRef _mutex; // Concurrent shutdown barrier
    8686        volatile TimerCallback _timer_proc;
    8787        void *_timer_param;
     88        uint16 _channel_mask;
    8889
    8990        static int midi_driver_thread (void *param);
    9091
     
    9495        virtual void close();
    9596        void setTimerCallback(void *timer_param, TimerCallback timer_proc);
    9697        uint32 getBaseTempo(void) { return 10000; }
     98        uint32 property(int prop, uint32 param);
    9799
    98100        MidiChannel *allocateChannel();
    99101        MidiChannel *getPercussionChannel() { return &_midi_channels [9]; }