Ticket #8276: native_m32.diff

File native_m32.diff, 3.2 KB (added by SF/jamieson630, 17 years ago)

Channel masking for native MT-32

  • scummvm/scumm/scummvm.cpp

    RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
    retrieving revision 2.401
    diff -u -r2.401 scummvm.cpp
     
    734734        } else if (((_midiDriver == MD_PCJR) || (_midiDriver == MD_PCSPK)) && ((_version > 2) && (_version < 5))) {
    735735                _musicEngine = _playerV2 = new Player_V2(this);
    736736        } else if (_version > 2) {
     737                MidiDriver *driver = detector->createMidi();
     738                if (driver)
     739                        driver->property (MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
    737740                _musicEngine = _imuse = IMuse::create(syst, _mixer, detector->createMidi());
    738741                if (_imuse) {
    739742                        if (detector->_gameTempo != 0)
  • 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]; }