aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2011-08-05 13:33:42 +0100
committerEugene Sandulenko2011-08-06 11:30:42 +0100
commit0dafa7f80fbc271e599092e81655d8073ab91abe (patch)
tree1d33034c8c8dc5258417431c6023567a4501be6f
parent6e795a89b0d45c79f99dcd9d50fda467e9a2466e (diff)
downloadscummvm-rg350-0dafa7f80fbc271e599092e81655d8073ab91abe.tar.gz
scummvm-rg350-0dafa7f80fbc271e599092e81655d8073ab91abe.tar.bz2
scummvm-rg350-0dafa7f80fbc271e599092e81655d8073ab91abe.zip
ALL: Reduce audio/ header dependency
-rw-r--r--engines/cruise/sound.cpp1
-rw-r--r--engines/cruise/sound.h4
-rw-r--r--engines/groovie/groovie.cpp3
-rw-r--r--engines/groovie/music.cpp3
-rw-r--r--engines/groovie/music.h2
-rw-r--r--engines/groovie/script.cpp3
-rw-r--r--engines/lure/sound.h3
-rw-r--r--engines/m4/m4.h1
-rw-r--r--engines/mohawk/cstime.h2
-rw-r--r--engines/mohawk/livingbooks.h2
-rw-r--r--engines/mohawk/mohawk.cpp2
-rw-r--r--engines/mohawk/sound.cpp5
-rw-r--r--engines/mohawk/sound.h7
-rw-r--r--engines/parallaction/sound.h3
-rw-r--r--engines/saga/saga.h1
-rw-r--r--engines/scumm/detection.cpp2
-rw-r--r--engines/scumm/scumm.cpp41
-rw-r--r--engines/scumm/scumm.h3
-rw-r--r--engines/scumm/sound.cpp14
-rw-r--r--engines/scumm/sound.h3
-rw-r--r--engines/scumm/vars.cpp5
-rw-r--r--engines/tinsel/tinsel.h4
22 files changed, 58 insertions, 56 deletions
diff --git a/engines/cruise/sound.cpp b/engines/cruise/sound.cpp
index 290cc220d4..21d9a75297 100644
--- a/engines/cruise/sound.cpp
+++ b/engines/cruise/sound.cpp
@@ -31,6 +31,7 @@
#include "audio/audiostream.h"
#include "audio/fmopl.h"
+#include "audio/mixer.h"
#include "audio/mods/soundfx.h"
namespace Cruise {
diff --git a/engines/cruise/sound.h b/engines/cruise/sound.h
index 11aec0b04e..c1975dc579 100644
--- a/engines/cruise/sound.h
+++ b/engines/cruise/sound.h
@@ -23,10 +23,6 @@
#ifndef CRUISE_SOUND_H
#define CRUISE_SOUND_H
-#include "audio/mididrv.h"
-#include "audio/midiparser.h"
-#include "audio/mixer.h"
-
#include "common/config-manager.h"
#include "common/serializer.h"
diff --git a/engines/groovie/groovie.cpp b/engines/groovie/groovie.cpp
index 5f95de649a..f5f02b5cdd 100644
--- a/engines/groovie/groovie.cpp
+++ b/engines/groovie/groovie.cpp
@@ -20,6 +20,9 @@
*
*/
+#include "audio/mididrv.h"
+#include "audio/mixer.h"
+
#include "groovie/groovie.h"
#include "groovie/cursor.h"
#include "groovie/detection.h"
diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp
index 0a812939a6..af929d439b 100644
--- a/engines/groovie/music.cpp
+++ b/engines/groovie/music.cpp
@@ -20,6 +20,9 @@
*
*/
+#include "audio/mididrv.h"
+#include "audio/mixer.h"
+
#include "groovie/music.h"
#include "groovie/groovie.h"
#include "groovie/resource.h"
diff --git a/engines/groovie/music.h b/engines/groovie/music.h
index 7af482e45d..cc852aa8dc 100644
--- a/engines/groovie/music.h
+++ b/engines/groovie/music.h
@@ -25,8 +25,6 @@
#include "common/array.h"
#include "common/mutex.h"
-#include "audio/mididrv.h"
-#include "audio/mixer.h"
class MidiParser;
diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index 5a24559e8b..9003a58ab8 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -20,6 +20,9 @@
*
*/
+#include "audio/mididrv.h"
+#include "audio/mixer.h"
+
#include "groovie/script.h"
#include "groovie/cell.h"
#include "groovie/cursor.h"
diff --git a/engines/lure/sound.h b/engines/lure/sound.h
index 9fa9a91260..365a7ccdb6 100644
--- a/engines/lure/sound.h
+++ b/engines/lure/sound.h
@@ -30,10 +30,11 @@
#include "common/mutex.h"
#include "common/singleton.h"
#include "common/ptr.h"
+
#include "audio/mididrv.h"
-#include "audio/mixer.h"
class MidiParser;
+class MidiChannel;
namespace Lure {
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 46107cb20a..b40ba0e878 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -26,7 +26,6 @@
#include "common/scummsys.h"
#include "common/util.h"
#include "common/random.h"
-#include "audio/mididrv.h"
#include "engines/engine.h"
diff --git a/engines/mohawk/cstime.h b/engines/mohawk/cstime.h
index 3a1de6a137..0bc236f930 100644
--- a/engines/mohawk/cstime.h
+++ b/engines/mohawk/cstime.h
@@ -30,8 +30,6 @@
#include "common/random.h"
#include "common/list.h"
-#include "audio/mixer.h"
-
namespace Mohawk {
class CSTimeCase;
diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h
index 27e703a578..008a7dbf23 100644
--- a/engines/mohawk/livingbooks.h
+++ b/engines/mohawk/livingbooks.h
@@ -33,8 +33,6 @@
#include "common/queue.h"
#include "common/random.h"
-#include "audio/mixer.h"
-
#include "livingbooks_code.h"
namespace Common {
diff --git a/engines/mohawk/mohawk.cpp b/engines/mohawk/mohawk.cpp
index faf52595b7..cb419064c0 100644
--- a/engines/mohawk/mohawk.cpp
+++ b/engines/mohawk/mohawk.cpp
@@ -31,8 +31,6 @@
#include "mohawk/sound.h"
#include "mohawk/video.h"
-#include "audio/mixer.h"
-
namespace Mohawk {
MohawkEngine::MohawkEngine(OSystem *syst, const MohawkGameDescription *gamedesc) : Engine(syst), _gameDescription(gamedesc) {
diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp
index 791b18db49..68b60515be 100644
--- a/engines/mohawk/sound.cpp
+++ b/engines/mohawk/sound.cpp
@@ -20,19 +20,20 @@
*
*/
-#include "mohawk/sound.h"
-
#include "common/debug.h"
#include "common/system.h"
#include "common/util.h"
#include "common/textconsole.h"
+#include "audio/midiparser.h"
#include "audio/musicplugin.h"
#include "audio/audiostream.h"
#include "audio/decoders/mp3.h"
#include "audio/decoders/raw.h"
#include "audio/decoders/wave.h"
+#include "mohawk/sound.h"
+
namespace Mohawk {
Sound::Sound(MohawkEngine* vm) : _vm(vm) {
diff --git a/engines/mohawk/sound.h b/engines/mohawk/sound.h
index 593f2fcd0b..12a59cdedf 100644
--- a/engines/mohawk/sound.h
+++ b/engines/mohawk/sound.h
@@ -27,14 +27,15 @@
#include "common/str.h"
#include "audio/audiostream.h"
-#include "audio/decoders/adpcm.h"
-#include "audio/mididrv.h"
-#include "audio/midiparser.h"
#include "audio/mixer.h"
+#include "audio/decoders/adpcm.h"
#include "mohawk/mohawk.h"
#include "mohawk/resource.h"
+class MidiDriver;
+class MidiParser;
+
namespace Mohawk {
#define MAX_CHANNELS 2 // Can there be more than 2?
diff --git a/engines/parallaction/sound.h b/engines/parallaction/sound.h
index d0b5e5c175..e875e69334 100644
--- a/engines/parallaction/sound.h
+++ b/engines/parallaction/sound.h
@@ -26,10 +26,9 @@
#include "common/util.h"
#include "common/mutex.h"
+#include "audio/mixer.h"
#include "audio/audiostream.h"
#include "audio/decoders/iff_sound.h"
-#include "audio/mixer.h"
-#include "audio/mididrv.h"
#define PATH_LEN 200
diff --git a/engines/saga/saga.h b/engines/saga/saga.h
index 336883680a..fb01b1ac5d 100644
--- a/engines/saga/saga.h
+++ b/engines/saga/saga.h
@@ -29,7 +29,6 @@
#include "common/random.h"
#include "common/memstream.h"
#include "common/textconsole.h"
-#include "audio/mididrv.h"
#include "saga/gfx.h"
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index 38b758b8fa..037c12bdbf 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -33,6 +33,8 @@
#include "common/savefile.h"
#include "common/system.h"
+#include "audio/mididrv.h"
+
#include "scumm/detection.h"
#include "scumm/detection_tables.h"
#include "scumm/he/intern_he.h"
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index d546f039fe..54c99144c8 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -299,7 +299,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
_haveActorSpeechMsg = false;
_useTalkAnims = false;
_defaultTalkDelay = 0;
- _musicType = MDT_NONE;
_saveSound = 0;
memset(_extraBoxFlags, 0, sizeof(_extraBoxFlags));
memset(_scaleSlots, 0, sizeof(_scaleSlots));
@@ -1746,36 +1745,36 @@ void ScummEngine::setupMusic(int midi) {
switch (MidiDriver::getMusicType(dev)) {
case MT_NULL:
- _musicType = MDT_NONE;
+ _sound->_musicType = MDT_NONE;
break;
case MT_PCSPK:
- _musicType = MDT_PCSPK;
+ _sound->_musicType = MDT_PCSPK;
break;
case MT_PCJR:
- _musicType = MDT_PCJR;
+ _sound->_musicType = MDT_PCJR;
break;
case MT_CMS:
_musicType = MDT_CMS;
break;
case MT_TOWNS:
- _musicType = MDT_TOWNS;
+ _sound->_musicType = MDT_TOWNS;
break;
case MT_ADLIB:
- _musicType = MDT_ADLIB;
+ _sound->_musicType = MDT_ADLIB;
break;
case MT_C64:
- _musicType = MDT_C64;
+ _sound->_musicType = MDT_C64;
break;
case MT_APPLEIIGS:
- _musicType = MDT_APPLEIIGS;
+ _sound->_musicType = MDT_APPLEIIGS;
break;
default:
- _musicType = MDT_MIDI;
+ _sound->_musicType = MDT_MIDI;
break;
}
if ((_game.id == GID_MONKEY_EGA || (_game.id == GID_LOOM && _game.version == 3))
- && (_game.platform == Common::kPlatformPC) && _musicType == MDT_MIDI) {
+ && (_game.platform == Common::kPlatformPC) && _sound->_musicType == MDT_MIDI) {
Common::String fileName;
bool missingFile = false;
if (_game.id == GID_LOOM) {
@@ -1805,7 +1804,7 @@ void ScummEngine::setupMusic(int midi) {
"but %s is missing. Using AdLib instead."), fileName.c_str()),
_("OK"));
dialog.runModal();
- _musicType = MDT_ADLIB;
+ _sound->_musicType = MDT_ADLIB;
}
}
@@ -1819,9 +1818,9 @@ void ScummEngine::setupMusic(int midi) {
* automatically when samples need to be generated */
if (!_mixer->isReady()) {
warning("Sound mixer initialization failed");
- if (_musicType == MDT_ADLIB || _musicType == MDT_PCSPK || _musicType == MDT_PCJR || _musicType == MDT_CMS) {
+ if (_sound->_musicType == MDT_ADLIB || _sound->_musicType == MDT_PCSPK || _sound->_musicType == MDT_PCJR || _sound->_musicType == MDT_CMS) {
dev = 0;
- _musicType = MDT_NONE;
+ _sound->_musicType = MDT_NONE;
warning("MIDI driver depends on sound mixer, switching to null MIDI driver");
}
}
@@ -1853,9 +1852,9 @@ void ScummEngine::setupMusic(int midi) {
_musicEngine = new Player_V1(this, _mixer, MidiDriver::getMusicType(dev) != MT_PCSPK);
} else if (_game.version <= 2) {
_musicEngine = new Player_V2(this, _mixer, MidiDriver::getMusicType(dev) != MT_PCSPK);
- } else if ((_musicType == MDT_PCSPK || _musicType == MDT_PCJR) && (_game.version > 2 && _game.version <= 4)) {
+ } else if ((_sound->_musicType == MDT_PCSPK || _sound->_musicType == MDT_PCJR) && (_game.version > 2 && _game.version <= 4)) {
_musicEngine = new Player_V2(this, _mixer, MidiDriver::getMusicType(dev) != MT_PCSPK);
- } else if (_musicType == MDT_CMS) {
+ } else if (_sound->_musicType == MDT_CMS) {
_musicEngine = new Player_V2CMS(this, _mixer);
} else if (_game.platform == Common::kPlatform3DO && _game.heversion <= 62) {
// 3DO versions use digital music and sound samples.
@@ -1867,15 +1866,15 @@ void ScummEngine::setupMusic(int midi) {
MidiDriver *nativeMidiDriver = 0;
MidiDriver *adlibMidiDriver = 0;
- if (_musicType != MDT_ADLIB && _musicType != MDT_TOWNS && _musicType != MDT_PCSPK)
+ if (_sound->_musicType != MDT_ADLIB && _sound->_musicType != MDT_TOWNS && _sound->_musicType != MDT_PCSPK)
nativeMidiDriver = MidiDriver::createMidi(dev);
if (nativeMidiDriver != NULL && _native_mt32)
nativeMidiDriver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
- bool multi_midi = ConfMan.getBool("multi_midi") && _musicType != MDT_NONE && _musicType != MDT_PCSPK && (midi & MDT_ADLIB);
- if (_musicType == MDT_ADLIB || _musicType == MDT_TOWNS || multi_midi) {
- adlibMidiDriver = MidiDriver::createMidi(MidiDriver::detectDevice(_musicType == MDT_TOWNS ? MDT_TOWNS : MDT_ADLIB));
+ bool multi_midi = ConfMan.getBool("multi_midi") && _sound->_musicType != MDT_NONE && _sound->_musicType != MDT_PCSPK && (midi & MDT_ADLIB);
+ if (_sound->_musicType == MDT_ADLIB || _sound->_musicType == MDT_TOWNS || multi_midi) {
+ adlibMidiDriver = MidiDriver::createMidi(MidiDriver::detectDevice(_sound->_musicType == MDT_TOWNS ? MDT_TOWNS : MDT_ADLIB));
adlibMidiDriver->property(MidiDriver::PROP_OLD_ADLIB, (_game.features & GF_SMALL_HEADER) ? 1 : 0);
- } else if (_musicType == MDT_PCSPK) {
+ } else if (_sound->_musicType == MDT_PCSPK) {
adlibMidiDriver = new PcSpkDriver(_mixer);
}
@@ -1905,7 +1904,7 @@ void ScummEngine::setupMusic(int midi) {
_imuse->property(IMuse::PROP_LIMIT_PLAYERS, 1);
_imuse->property(IMuse::PROP_RECYCLE_PLAYERS, 1);
}
- if (_musicType == MDT_PCSPK)
+ if (_sound->_musicType == MDT_PCSPK)
_imuse->property(IMuse::PROP_PC_SPEAKER, 1);
}
}
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 4944fbed5a..04a175e732 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -40,8 +40,6 @@
#include "scumm/detection.h"
#include "scumm/script.h"
-#include "audio/mididrv.h"
-
#ifdef __DS__
/* This disables the dual layer mode which is used in FM-Towns versions
* of SCUMM games and which emulates the behavior of the original code.
@@ -1085,7 +1083,6 @@ protected:
int _saveSound;
bool _native_mt32;
bool _enable_gs;
- MidiDriverFlags _musicType;
bool _copyProtection;
public:
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index 7fdc710142..823a406a1e 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -84,6 +84,8 @@ Sound::Sound(ScummEngine *parent, Audio::Mixer *mixer)
memset(_soundQue, 0, sizeof(_soundQue));
memset(_soundQue2, 0, sizeof(_soundQue2));
memset(_mouthSyncTimes, 0, sizeof(_mouthSyncTimes));
+
+ _musicType = MDT_NONE;
}
Sound::~Sound() {
@@ -1094,7 +1096,7 @@ int ScummEngine::readSoundResource(ResId idx) {
switch (basetag) {
case MKTAG('M','I','D','I'):
case MKTAG('i','M','U','S'):
- if (_musicType != MDT_PCSPK && _musicType != MDT_PCJR) {
+ if (_sound->_musicType != MDT_PCSPK && _sound->_musicType != MDT_PCJR) {
_fileHandle->seek(-8, SEEK_CUR);
_fileHandle->read(_res->createResource(rtSound, idx, total_size + 8), total_size + 8);
return 1;
@@ -1118,7 +1120,7 @@ int ScummEngine::readSoundResource(ResId idx) {
break;
case MKTAG('A','D','L',' '):
pri = 1;
- if (_musicType == MDT_ADLIB || _musicType == MDT_TOWNS)
+ if (_sound->_musicType == MDT_ADLIB || _sound->_musicType == MDT_TOWNS)
pri = 10;
break;
case MKTAG('A','M','I',' '):
@@ -1137,7 +1139,7 @@ int ScummEngine::readSoundResource(ResId idx) {
break;
case MKTAG('S','P','K',' '):
pri = -1;
- if (_musicType == MDT_PCSPK || _musicType == MDT_PCJR)
+ if (_sound->_musicType == MDT_PCSPK || _sound->_musicType == MDT_PCJR)
pri = 11;
break;
}
@@ -1145,7 +1147,7 @@ int ScummEngine::readSoundResource(ResId idx) {
// We only allow SPK resources for PC Speaker, PCJr and CMS here
// since other resource would sound horribly with their output
// drivers.
- if ((_musicType == MDT_PCSPK || _musicType == MDT_PCJR || _musicType == MDT_CMS) && pri != 11)
+ if ((_sound->_musicType == MDT_PCSPK || _sound->_musicType == MDT_PCJR || _sound->_musicType == MDT_CMS) && pri != 11)
pri = -1;
// We only allow ADL resources when AdLib or FM-Towns is used as
@@ -1155,7 +1157,7 @@ int ScummEngine::readSoundResource(ResId idx) {
// only contains a ROL resource for sound id 60. Formerly we tried
// to play that via the AdLib or FM-Towns audio driver resulting
// in strange noises. Now we behave like the original did.
- if ((_musicType == MDT_ADLIB || _musicType == MDT_TOWNS) && pri != 10)
+ if ((_sound->_musicType == MDT_ADLIB || _sound->_musicType == MDT_TOWNS) && pri != 10)
pri = -1;
debugC(DEBUG_RESOURCE, " tag: %s, total_size=%d, pri=%d", tag2str(tag), size, pri);
@@ -2095,7 +2097,7 @@ int ScummEngine::readSoundResourceSmallHeader(ResId idx) {
}
}
- if ((_musicType == MDT_PCSPK || _musicType == MDT_PCJR) && wa_offs != 0) {
+ if ((_sound->_musicType == MDT_PCSPK || _sound->_musicType == MDT_PCJR) && wa_offs != 0) {
if (_game.features & GF_OLD_BUNDLE) {
_fileHandle->seek(wa_offs, SEEK_SET);
_fileHandle->read(_res->createResource(rtSound, idx, wa_size), wa_size);
diff --git a/engines/scumm/sound.h b/engines/scumm/sound.h
index 03659ceff1..e9a37ac9fa 100644
--- a/engines/scumm/sound.h
+++ b/engines/scumm/sound.h
@@ -24,6 +24,7 @@
#include "common/scummsys.h"
#include "audio/audiostream.h"
+#include "audio/mididrv.h"
#include "audio/mixer.h"
#include "scumm/saveload.h"
@@ -90,6 +91,8 @@ public:
byte _sfxMode;
uint _lastSound;
+ MidiDriverFlags _musicType;
+
public:
Sound(ScummEngine *parent, Audio::Mixer *mixer);
virtual ~Sound();
diff --git a/engines/scumm/vars.cpp b/engines/scumm/vars.cpp
index 4527d7a121..26a6a2f3b1 100644
--- a/engines/scumm/vars.cpp
+++ b/engines/scumm/vars.cpp
@@ -25,9 +25,12 @@
#include "scumm/scumm.h"
#include "scumm/scumm_v0.h"
#include "scumm/scumm_v8.h"
+#include "scumm/sound.h"
#include "scumm/he/intern_he.h"
#include "scumm/he/logic_he.h"
+#include "audio/mididrv.h"
+
namespace Scumm {
void ScummEngine::setupScummVars() {
@@ -722,7 +725,7 @@ void ScummEngine::resetScummVars() {
// 2 CMS
// 3 AdLib
// 4 Roland
- switch (_musicType) {
+ switch (_sound->_musicType) {
case MDT_NONE:
case MDT_PCSPK:
VAR(VAR_SOUNDCARD) = 0;
diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h
index 30b060766e..e18216cdf7 100644
--- a/engines/tinsel/tinsel.h
+++ b/engines/tinsel/tinsel.h
@@ -31,9 +31,6 @@
#include "common/random.h"
#include "common/util.h"
-#include "audio/mididrv.h"
-#include "audio/mixer.h"
-
#include "engines/engine.h"
#include "tinsel/debugger.h"
#include "tinsel/graphics.h"
@@ -53,6 +50,7 @@ namespace Tinsel {
class BMVPlayer;
class Config;
+class MidiDriver;
class MidiMusicPlayer;
class PCMMusicPlayer;
class Scheduler;