Ticket #8524: kyra-multimidi.diff

File kyra-multimidi.diff, 4.0 KB (added by eriktorbjorn, 18 years ago)

Patch against a March 28 SVN snapshot

  • engines/kyra/kyra.cpp

     
    330330                _system->initSize(320, 200);
    331331        _system->endGFXTransaction();
    332332
    333         // for now we prefer MIDI-to-Adlib conversion over native midi
     333        // for now we prefer Adlib over native MIDI
    334334        int midiDriver = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB/* | MDT_PREFER_MIDI*/);
    335335
     336        _adlibSound = NULL;
     337
    336338        if (midiDriver == MD_ADLIB) {
    337339                _sound = new SoundAdlibPC(_mixer, this);
    338340                assert(_sound);
     
    349351                _sound = soundMidiPc;
    350352                assert(_sound);
    351353                soundMidiPc->hasNativeMT32(native_mt32);
     354
     355                // Unlike some SCUMM games, it's not that the MIDI sounds are
     356                // missing. It's just that at least at the time of writing they
     357                // decidedly inferior to the Adlib ones.
     358
     359                if (ConfMan.getBool("multi_midi")) {
     360                        _adlibSound = new SoundAdlibPC(_mixer, this);
     361                        assert(_adlibSound);
     362                        _adlibSound->setVolume(255);
     363                }
    352364        }
    353365        if (!_sound->init()) {
    354366                error("Couldn't init sound");
     
    512524        delete _screen;
    513525        delete _res;
    514526        delete _sound;
     527        delete _adlibSound;
    515528        delete _saveFileMan;
    516529        delete _seq;
    517530        delete _scriptInterpreter;
     
    713726                _handleInput = false;
    714727
    715728                _sound->process();
     729                if (_adlibSound)
     730                        _adlibSound->process();
    716731        }
    717732}
    718733
  • engines/kyra/sound_adlib.cpp

     
    584584
    585585void AdlibDriver::callback() {
    586586        lock();
    587         --_flagTrigger;
    588         if (_flagTrigger < 0)
    589                 _flags &= ~8;
    590         setupPrograms();
    591         executePrograms();
     587        if (_soundData) {
     588                --_flagTrigger;
     589                if (_flagTrigger < 0)
     590                        _flags &= ~8;
     591                setupPrograms();
     592                executePrograms();
    592593
    593         uint8 temp = _unkValue3;
    594         _unkValue3 += _tempo;
    595         if (_unkValue3 < temp) {
    596                 if (!(--_unkValue2)) {
    597                         _unkValue2 = _unkValue1;
    598                         ++_unkValue4;
     594                uint8 temp = _unkValue3;
     595                _unkValue3 += _tempo;
     596                if (_unkValue3 < temp) {
     597                        if (!(--_unkValue2)) {
     598                                _unkValue2 = _unkValue1;
     599                                ++_unkValue4;
     600                        }
    599601                }
    600602        }
    601603        unlock();
  • engines/kyra/seqplayer.cpp

     
    375375void SeqPlayer::s1_playEffect() {
    376376        uint8 track = *_seqData++;
    377377        _vm->delay(3 * _vm->tickLength());
    378         _sound->playSoundEffect(track);
     378        _vm->snd_playSoundEffect(track);
    379379}
    380380
    381381void SeqPlayer::s1_playTrack() {
  • engines/kyra/kyra.h

     
    256256        ScreenAnimator *animator() { return _animator; }
    257257        TextDisplayer *text() { return _text; }
    258258        Sound *sound() { return _sound; }
     259        Sound *adlibSound() { return _adlibSound; }
    259260        StaticResource *staticres() { return _staticres; }
    260261        uint32 tickLength() const { return _tickLength; }
    261262        Movie *createWSAMovie();
     
    791792        Screen *_screen;
    792793        ScreenAnimator *_animator;
    793794        Sound *_sound;
     795        Sound *_adlibSound;
    794796        SeqPlayer *_seq;
    795797        Sprites *_sprites;
    796798        TextDisplayer *_text;
  • engines/kyra/sound.cpp

     
    402402        _curMusicTheme = _newMusicTheme = file;
    403403        _sound->loadMusicFile(_musicFiles[file]);
    404404        _sound->playTrack(track);
     405        if (_adlibSound)
     406                _adlibSound->loadMusicFile(_musicFiles[file]);
    405407}
    406408
    407409void KyraEngine::snd_playSoundEffect(int track) {
    408410        debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine::snd_playSoundEffect(%d)", track);
    409         _sound->playSoundEffect(track);
     411        if (_adlibSound)
     412                _adlibSound->playSoundEffect(track);
     413        else
     414                _sound->playSoundEffect(track);
    410415}
    411416
    412417void KyraEngine::snd_playWanderScoreViaMap(int command, int restart) {