diff options
author | Jerome Fisher | 2004-11-26 21:53:12 +0000 |
---|---|---|
committer | Jerome Fisher | 2004-11-26 21:53:12 +0000 |
commit | 51bafda43afb57f9e26f32285aa9898735f54ea3 (patch) | |
tree | 7fc0283f917be7e9116f7ebdb2997e0c2539a35c | |
parent | 57f8ae73ce61e281414e5cc4d20dc4986f60c374 (diff) | |
download | scummvm-rg350-51bafda43afb57f9e26f32285aa9898735f54ea3.tar.gz scummvm-rg350-51bafda43afb57f9e26f32285aa9898735f54ea3.tar.bz2 scummvm-rg350-51bafda43afb57f9e26f32285aa9898735f54ea3.zip |
The Adlib MidiDriver is now initialised immediately when it is determined that it may be used. Doing this lazily potentially deadlocked when using MT-32 emulation in mixed MIDI/Adlib mode.
svn-id: r15899
-rw-r--r-- | scumm/imuse.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp index 00c96bb19d..61e29fe5b7 100644 --- a/scumm/imuse.cpp +++ b/scumm/imuse.cpp @@ -192,17 +192,9 @@ MidiDriver *IMuseInternal::getBestMidiDriver(int sound) { driver = _midi_native; } else { // Route it through Adlib anyway. - if (!_midi_adlib) { - _midi_adlib = MidiDriver_ADLIB_create(_mixer); - initMidiDriver(_midi_adlib); - } driver = _midi_adlib; } } else { - if (!_midi_adlib &&(_enable_multi_midi || !_midi_native)) { - _midi_adlib = MidiDriver_ADLIB_create(_mixer); - initMidiDriver(_midi_adlib); - } driver = _midi_adlib; } return driver; @@ -344,7 +336,6 @@ int IMuseInternal::getMusicTimer() const { void IMuseInternal::sequencer_timers(MidiDriver *midi) { Player *player = _players; int i; - for (i = ARRAYSIZE(_players); i != 0; i--, player++) { if (player->isActive() && player->getMidiDriver() == midi) { player->onTimer(); @@ -1098,6 +1089,9 @@ uint32 IMuseInternal::property(int prop, uint32 value) { } driver->close(); // FIXME: shouldn't we delete 'driver' here, too ? + } else if (_enable_multi_midi && _midi_adlib == NULL) { + _midi_adlib = MidiDriver_ADLIB_create(_mixer); + initMidiDriver(_midi_adlib); } break; @@ -1137,9 +1131,14 @@ int IMuseInternal::initialize(OSystem *syst, SoundMixer *mixer, MidiDriver *nati _mixer = mixer; _midi_native = native_midi; - _midi_adlib = NULL; if (native_midi) initMidiDriver(_midi_native); + if (!native_midi || _enable_multi_midi) { + _midi_adlib = MidiDriver_ADLIB_create(_mixer); + initMidiDriver(_midi_adlib); + } else { + _midi_adlib = NULL; + } if (!_tempoFactor) _tempoFactor = 100; _master_volume = 255; |