diff options
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/imuse.cpp | 33 | ||||
-rw-r--r-- | scumm/imuse.h | 2 | ||||
-rw-r--r-- | scumm/imuse_internal.h | 9 | ||||
-rw-r--r-- | scumm/imuse_player.cpp | 11 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 12 |
5 files changed, 39 insertions, 28 deletions
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp index d61828f7a9..6827086afd 100644 --- a/scumm/imuse.cpp +++ b/scumm/imuse.cpp @@ -21,15 +21,18 @@ */ #include "stdafx.h" -#include "imuse.h" -#include "imuse_internal.h" -#include "instrument.h" -#include "saveload.h" -#include "scumm.h" + #include "common/util.h" -#include "sound/mididrv.h" #include "common/gameDetector.h" // For kDefaultMasterVolume etc. +#include "scumm/imuse.h" +#include "scumm/imuse_internal.h" +#include "scumm/instrument.h" +#include "scumm/saveload.h" +#include "scumm/scumm.h" + +#include "sound/mididrv.h" + //////////////////////////////////////// @@ -78,7 +81,7 @@ MidiDriver *IMuseInternal::getMidiDriver() { } else { // Route it through Adlib anyway. if (!_midi_adlib) { - _midi_adlib = MidiDriver_ADLIB_create(); + _midi_adlib = MidiDriver_ADLIB_create(_mixer); initMidiDriver(_midi_adlib); } driver = _midi_adlib; @@ -186,14 +189,14 @@ MidiDriver *IMuseInternal::getBestMidiDriver(int sound) { } else { // Route it through Adlib anyway. if (!_midi_adlib) { - _midi_adlib = MidiDriver_ADLIB_create(); + _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(); + _midi_adlib = MidiDriver_ADLIB_create(_mixer); initMidiDriver(_midi_adlib); } driver = _midi_adlib; @@ -1048,6 +1051,7 @@ uint32 IMuseInternal::property(int prop, uint32 value) { _players[i].clear(); } driver->close(); + // FIXME: shouldn't we delete 'driver' here, too ? } break; @@ -1072,15 +1076,16 @@ void IMuseInternal::setBase(byte **base) { _base_sounds = base; } -IMuseInternal *IMuseInternal::create(OSystem *syst, MidiDriver *native_midi) { +IMuseInternal *IMuseInternal::create(OSystem *syst, SoundMixer *mixer, MidiDriver *native_midi) { IMuseInternal *i = new IMuseInternal; - i->initialize(syst, native_midi); + i->initialize(syst, mixer, native_midi); return i; } -int IMuseInternal::initialize(OSystem *syst, MidiDriver *native_midi) { +int IMuseInternal::initialize(OSystem *syst, SoundMixer *mixer, MidiDriver *native_midi) { int i; + _mixer = mixer; _midi_native = native_midi; _midi_adlib = NULL; if (native_midi) @@ -1736,7 +1741,7 @@ MidiDriver *IMuse::getMidiDriver() { in(); MidiDriver *ret = _target->getMidiDri // The IMuse::create method provides a front-end factory // for creating IMuseInternal without exposing that class // to the client. -IMuse *IMuse::create(OSystem *syst, MidiDriver *midi) { - IMuseInternal *engine = IMuseInternal::create(syst, midi); +IMuse *IMuse::create(OSystem *syst, SoundMixer *mixer, MidiDriver *midi) { + IMuseInternal *engine = IMuseInternal::create(syst, mixer, midi); return new IMuse(syst, engine); } diff --git a/scumm/imuse.h b/scumm/imuse.h index cf785b84d4..2b129e27f3 100644 --- a/scumm/imuse.h +++ b/scumm/imuse.h @@ -74,7 +74,7 @@ public: MidiDriver *getMidiDriver(); // Factory methods - static IMuse *create(OSystem *syst, MidiDriver *midi); + static IMuse *create(OSystem *syst, SoundMixer *mixer, MidiDriver *midi); }; #endif diff --git a/scumm/imuse_internal.h b/scumm/imuse_internal.h index bed969c034..330dd2ea6a 100644 --- a/scumm/imuse_internal.h +++ b/scumm/imuse_internal.h @@ -22,9 +22,9 @@ #ifndef DEFINED_IMUSE_INTERNAL #define DEFINED_IMUSE_INTERNAL -#include "sound/mididrv.h" #include "common/scummsys.h" #include "scumm/instrument.h" +#include "sound/mididrv.h" // Unremark this statement to activate some of // the most common iMuse diagnostic messages. @@ -45,6 +45,7 @@ class IMuseInternal; class MidiParser; class Scumm; class OSystem; +class SoundMixer; @@ -355,6 +356,8 @@ private: MidiDriver *_midi_native; byte **_base_sounds; + + SoundMixer *_mixer; private: bool _paused; @@ -439,7 +442,7 @@ public: IMuseInternal(); ~IMuseInternal(); - int initialize(OSystem *syst, MidiDriver *midi); + int initialize(OSystem *syst, SoundMixer *mixer, MidiDriver *midi); void reallocateMidiChannels(MidiDriver *midi); void setGlobalAdlibInstrument(byte slot, byte *data); void copyGlobalAdlibInstrument(byte slot, Instrument *dest); @@ -465,7 +468,7 @@ public: uint32 property(int prop, uint32 value); MidiDriver *getMidiDriver(); - static IMuseInternal *create(OSystem *syst, MidiDriver *midi); + static IMuseInternal *create(OSystem *syst, SoundMixer *mixer, MidiDriver *midi); }; #endif diff --git a/scumm/imuse_player.cpp b/scumm/imuse_player.cpp index e5806f9d94..0e4ee34fdf 100644 --- a/scumm/imuse_player.cpp +++ b/scumm/imuse_player.cpp @@ -20,12 +20,15 @@ */ #include "stdafx.h" -#include "scumm/scumm.h" -#include "sound/midiparser.h" -#include "scumm/saveload.h" + #include "common/util.h" #include "common/engine.h" -#include "imuse_internal.h" + +#include "scumm/imuse_internal.h" +#include "scumm/saveload.h" +#include "scumm/scumm.h" + +#include "sound/midiparser.h" diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 6775a5f3dc..b94b7785f7 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -625,16 +625,16 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst) else _playerV2 = new Player_V2(this); } else { - _imuse = IMuse::create (syst, detector->createMidi()); + _imuse = IMuse::create (syst, _mixer, detector->createMidi()); if (_imuse) { if (detector->_gameTempo != 0) _imuse->property(IMuse::PROP_TEMPO_BASE, detector->_gameTempo); - _imuse->property (IMuse::PROP_OLD_ADLIB_INSTRUMENTS, (_features & GF_SMALL_HEADER) ? 1 : 0); - _imuse->property (IMuse::PROP_MULTI_MIDI, detector->_multi_midi); - _imuse->property (IMuse::PROP_NATIVE_MT32, detector->_native_mt32); + _imuse->property(IMuse::PROP_OLD_ADLIB_INSTRUMENTS, (_features & GF_SMALL_HEADER) ? 1 : 0); + _imuse->property(IMuse::PROP_MULTI_MIDI, detector->_multi_midi); + _imuse->property(IMuse::PROP_NATIVE_MT32, detector->_native_mt32); if (_features & GF_HUMONGOUS) { - _imuse->property (IMuse::PROP_LIMIT_PLAYERS, 1); - _imuse->property (IMuse::PROP_RECYCLE_PLAYERS, 1); + _imuse->property(IMuse::PROP_LIMIT_PLAYERS, 1); + _imuse->property(IMuse::PROP_RECYCLE_PLAYERS, 1); } _imuse->set_music_volume(_sound->_sound_volume_music); } |