getting rid of g_mixer; removing lots of whitespace

svn-id: r9527
This commit is contained in:
Max Horn 2003-08-05 23:58:24 +00:00
parent c431e229b3
commit 75db41750e
10 changed files with 48 additions and 40 deletions

View file

@ -554,7 +554,7 @@ class MidiDriver_ADLIB : public MidiDriver {
friend class AdlibPercussionChannel; friend class AdlibPercussionChannel;
public: public:
MidiDriver_ADLIB(); MidiDriver_ADLIB(SoundMixer *mixer);
int open(); int open();
void close(); void close();
@ -810,14 +810,14 @@ void AdlibPercussionChannel::noteOn(byte note, byte velocity) {
// MidiDriver method implementations // MidiDriver method implementations
MidiDriver_ADLIB::MidiDriver_ADLIB() { MidiDriver_ADLIB::MidiDriver_ADLIB(SoundMixer *mixer)
: _mixer(mixer) {
uint i; uint i;
_isOpen = false; _isOpen = false;
_game_SmallHeader = false; _game_SmallHeader = false;
_adlib_reg_cache = 0; _adlib_reg_cache = 0;
_mixer = 0
_timer_proc = 0; _timer_proc = 0;
_timer_param = 0; _timer_param = 0;
@ -839,8 +839,7 @@ int MidiDriver_ADLIB::open() {
if (_isOpen) if (_isOpen)
return MERR_ALREADY_OPEN; return MERR_ALREADY_OPEN;
_isOpen = true; _isOpen = true;
_mixer = g_mixer;
int i; int i;
AdlibVoice *voice; AdlibVoice *voice;

View file

@ -73,7 +73,6 @@ const char *gScummVMFullVersion = "ScummVM 0.5.3cvs (" __DATE__ " " __TIME__ ")"
/* FIXME - BIG HACK for MidiEmu */ /* FIXME - BIG HACK for MidiEmu */
OSystem *g_system = 0; OSystem *g_system = 0;
SoundMixer *g_mixer = 0;
Engine *g_engine = 0; Engine *g_engine = 0;
Engine::Engine(GameDetector *detector, OSystem *syst) Engine::Engine(GameDetector *detector, OSystem *syst)
@ -83,9 +82,8 @@ Engine::Engine(GameDetector *detector, OSystem *syst)
_gameDataPath = detector->_gameDataPath; _gameDataPath = detector->_gameDataPath;
/* FIXME - BIG HACK for MidiEmu */ g_system = _system; // FIXME - BIG HACK for MidiEmu
g_system = _system;
g_mixer = _mixer;
_timer = new Timer(this); _timer = new Timer(this);
} }

View file

@ -53,7 +53,6 @@ struct VersionSettings;
/* FIXME - BIG HACK for MidiEmu */ /* FIXME - BIG HACK for MidiEmu */
extern OSystem *g_system; extern OSystem *g_system;
extern SoundMixer *g_mixer;
class Engine { class Engine {
public: public:

View file

@ -21,15 +21,18 @@
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "imuse.h"
#include "imuse_internal.h"
#include "instrument.h"
#include "saveload.h"
#include "scumm.h"
#include "common/util.h" #include "common/util.h"
#include "sound/mididrv.h"
#include "common/gameDetector.h" // For kDefaultMasterVolume etc. #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 { } else {
// Route it through Adlib anyway. // Route it through Adlib anyway.
if (!_midi_adlib) { if (!_midi_adlib) {
_midi_adlib = MidiDriver_ADLIB_create(); _midi_adlib = MidiDriver_ADLIB_create(_mixer);
initMidiDriver(_midi_adlib); initMidiDriver(_midi_adlib);
} }
driver = _midi_adlib; driver = _midi_adlib;
@ -186,14 +189,14 @@ MidiDriver *IMuseInternal::getBestMidiDriver(int sound) {
} else { } else {
// Route it through Adlib anyway. // Route it through Adlib anyway.
if (!_midi_adlib) { if (!_midi_adlib) {
_midi_adlib = MidiDriver_ADLIB_create(); _midi_adlib = MidiDriver_ADLIB_create(_mixer);
initMidiDriver(_midi_adlib); initMidiDriver(_midi_adlib);
} }
driver = _midi_adlib; driver = _midi_adlib;
} }
} else { } else {
if (!_midi_adlib &&(_enable_multi_midi || !_midi_native)) { if (!_midi_adlib &&(_enable_multi_midi || !_midi_native)) {
_midi_adlib = MidiDriver_ADLIB_create(); _midi_adlib = MidiDriver_ADLIB_create(_mixer);
initMidiDriver(_midi_adlib); initMidiDriver(_midi_adlib);
} }
driver = _midi_adlib; driver = _midi_adlib;
@ -1048,6 +1051,7 @@ uint32 IMuseInternal::property(int prop, uint32 value) {
_players[i].clear(); _players[i].clear();
} }
driver->close(); driver->close();
// FIXME: shouldn't we delete 'driver' here, too ?
} }
break; break;
@ -1072,15 +1076,16 @@ void IMuseInternal::setBase(byte **base) {
_base_sounds = 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; IMuseInternal *i = new IMuseInternal;
i->initialize(syst, native_midi); i->initialize(syst, mixer, native_midi);
return i; return i;
} }
int IMuseInternal::initialize(OSystem *syst, MidiDriver *native_midi) { int IMuseInternal::initialize(OSystem *syst, SoundMixer *mixer, MidiDriver *native_midi) {
int i; int i;
_mixer = mixer;
_midi_native = native_midi; _midi_native = native_midi;
_midi_adlib = NULL; _midi_adlib = NULL;
if (native_midi) if (native_midi)
@ -1736,7 +1741,7 @@ MidiDriver *IMuse::getMidiDriver() { in(); MidiDriver *ret = _target->getMidiDri
// The IMuse::create method provides a front-end factory // The IMuse::create method provides a front-end factory
// for creating IMuseInternal without exposing that class // for creating IMuseInternal without exposing that class
// to the client. // to the client.
IMuse *IMuse::create(OSystem *syst, MidiDriver *midi) { IMuse *IMuse::create(OSystem *syst, SoundMixer *mixer, MidiDriver *midi) {
IMuseInternal *engine = IMuseInternal::create(syst, midi); IMuseInternal *engine = IMuseInternal::create(syst, mixer, midi);
return new IMuse(syst, engine); return new IMuse(syst, engine);
} }

View file

@ -74,7 +74,7 @@ public:
MidiDriver *getMidiDriver(); MidiDriver *getMidiDriver();
// Factory methods // Factory methods
static IMuse *create(OSystem *syst, MidiDriver *midi); static IMuse *create(OSystem *syst, SoundMixer *mixer, MidiDriver *midi);
}; };
#endif #endif

View file

@ -22,9 +22,9 @@
#ifndef DEFINED_IMUSE_INTERNAL #ifndef DEFINED_IMUSE_INTERNAL
#define DEFINED_IMUSE_INTERNAL #define DEFINED_IMUSE_INTERNAL
#include "sound/mididrv.h"
#include "common/scummsys.h" #include "common/scummsys.h"
#include "scumm/instrument.h" #include "scumm/instrument.h"
#include "sound/mididrv.h"
// Unremark this statement to activate some of // Unremark this statement to activate some of
// the most common iMuse diagnostic messages. // the most common iMuse diagnostic messages.
@ -45,6 +45,7 @@ class IMuseInternal;
class MidiParser; class MidiParser;
class Scumm; class Scumm;
class OSystem; class OSystem;
class SoundMixer;
@ -355,6 +356,8 @@ private:
MidiDriver *_midi_native; MidiDriver *_midi_native;
byte **_base_sounds; byte **_base_sounds;
SoundMixer *_mixer;
private: private:
bool _paused; bool _paused;
@ -439,7 +442,7 @@ public:
IMuseInternal(); IMuseInternal();
~IMuseInternal(); ~IMuseInternal();
int initialize(OSystem *syst, MidiDriver *midi); int initialize(OSystem *syst, SoundMixer *mixer, MidiDriver *midi);
void reallocateMidiChannels(MidiDriver *midi); void reallocateMidiChannels(MidiDriver *midi);
void setGlobalAdlibInstrument(byte slot, byte *data); void setGlobalAdlibInstrument(byte slot, byte *data);
void copyGlobalAdlibInstrument(byte slot, Instrument *dest); void copyGlobalAdlibInstrument(byte slot, Instrument *dest);
@ -465,7 +468,7 @@ public:
uint32 property(int prop, uint32 value); uint32 property(int prop, uint32 value);
MidiDriver *getMidiDriver(); MidiDriver *getMidiDriver();
static IMuseInternal *create(OSystem *syst, MidiDriver *midi); static IMuseInternal *create(OSystem *syst, SoundMixer *mixer, MidiDriver *midi);
}; };
#endif #endif

View file

@ -20,12 +20,15 @@
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "scumm/scumm.h"
#include "sound/midiparser.h"
#include "scumm/saveload.h"
#include "common/util.h" #include "common/util.h"
#include "common/engine.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"

View file

@ -625,16 +625,16 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)
else else
_playerV2 = new Player_V2(this); _playerV2 = new Player_V2(this);
} else { } else {
_imuse = IMuse::create (syst, detector->createMidi()); _imuse = IMuse::create (syst, _mixer, detector->createMidi());
if (_imuse) { if (_imuse) {
if (detector->_gameTempo != 0) if (detector->_gameTempo != 0)
_imuse->property(IMuse::PROP_TEMPO_BASE, detector->_gameTempo); _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_OLD_ADLIB_INSTRUMENTS, (_features & GF_SMALL_HEADER) ? 1 : 0);
_imuse->property (IMuse::PROP_MULTI_MIDI, detector->_multi_midi); _imuse->property(IMuse::PROP_MULTI_MIDI, detector->_multi_midi);
_imuse->property (IMuse::PROP_NATIVE_MT32, detector->_native_mt32); _imuse->property(IMuse::PROP_NATIVE_MT32, detector->_native_mt32);
if (_features & GF_HUMONGOUS) { if (_features & GF_HUMONGOUS) {
_imuse->property (IMuse::PROP_LIMIT_PLAYERS, 1); _imuse->property(IMuse::PROP_LIMIT_PLAYERS, 1);
_imuse->property (IMuse::PROP_RECYCLE_PLAYERS, 1); _imuse->property(IMuse::PROP_RECYCLE_PLAYERS, 1);
} }
_imuse->set_music_volume(_sound->_sound_volume_music); _imuse->set_music_volume(_sound->_sound_volume_music);
} }

View file

@ -443,7 +443,7 @@ SimonEngine::SimonEngine(GameDetector *detector, OSystem *syst)
// Setup midi driver // Setup midi driver
if (!driver) if (!driver)
driver = MidiDriver_ADLIB_create(); driver = MidiDriver_ADLIB_create(_mixer);
midi.mapMT32toGM (!(_game & GF_SIMON2) && !detector->_native_mt32); midi.mapMT32toGM (!(_game & GF_SIMON2) && !detector->_native_mt32);
midi.set_driver(driver); midi.set_driver(driver);

View file

@ -26,6 +26,7 @@
#include "common/scummsys.h" #include "common/scummsys.h"
class MidiChannel; class MidiChannel;
class SoundMixer;
// Abstract MIDI Driver Class // Abstract MIDI Driver Class
class MidiDriver { class MidiDriver {
@ -132,7 +133,7 @@ enum {
// Factory functions, for faster compile // Factory functions, for faster compile
extern MidiDriver *MidiDriver_NULL_create(); extern MidiDriver *MidiDriver_NULL_create();
extern MidiDriver *MidiDriver_ADLIB_create(); extern MidiDriver *MidiDriver_ADLIB_create(SoundMixer *mixer);
extern MidiDriver *MidiDriver_WIN_create(); extern MidiDriver *MidiDriver_WIN_create();
extern MidiDriver *MidiDriver_SEQ_create(); extern MidiDriver *MidiDriver_SEQ_create();
extern MidiDriver *MidiDriver_QT_create(); extern MidiDriver *MidiDriver_QT_create();