mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-18 07:53:12 +00:00
ALL: Reduce audio/ header dependency
This commit is contained in:
parent
6e795a89b0
commit
0dafa7f80f
@ -31,6 +31,7 @@
|
||||
|
||||
#include "audio/audiostream.h"
|
||||
#include "audio/fmopl.h"
|
||||
#include "audio/mixer.h"
|
||||
#include "audio/mods/soundfx.h"
|
||||
|
||||
namespace Cruise {
|
||||
|
@ -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"
|
||||
|
||||
|
@ -20,6 +20,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "audio/mididrv.h"
|
||||
#include "audio/mixer.h"
|
||||
|
||||
#include "groovie/groovie.h"
|
||||
#include "groovie/cursor.h"
|
||||
#include "groovie/detection.h"
|
||||
|
@ -20,6 +20,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "audio/mididrv.h"
|
||||
#include "audio/mixer.h"
|
||||
|
||||
#include "groovie/music.h"
|
||||
#include "groovie/groovie.h"
|
||||
#include "groovie/resource.h"
|
||||
|
@ -25,8 +25,6 @@
|
||||
|
||||
#include "common/array.h"
|
||||
#include "common/mutex.h"
|
||||
#include "audio/mididrv.h"
|
||||
#include "audio/mixer.h"
|
||||
|
||||
class MidiParser;
|
||||
|
||||
|
@ -20,6 +20,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "audio/mididrv.h"
|
||||
#include "audio/mixer.h"
|
||||
|
||||
#include "groovie/script.h"
|
||||
#include "groovie/cell.h"
|
||||
#include "groovie/cursor.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 {
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "common/scummsys.h"
|
||||
#include "common/util.h"
|
||||
#include "common/random.h"
|
||||
#include "audio/mididrv.h"
|
||||
|
||||
#include "engines/engine.h"
|
||||
|
||||
|
@ -30,8 +30,6 @@
|
||||
#include "common/random.h"
|
||||
#include "common/list.h"
|
||||
|
||||
#include "audio/mixer.h"
|
||||
|
||||
namespace Mohawk {
|
||||
|
||||
class CSTimeCase;
|
||||
|
@ -33,8 +33,6 @@
|
||||
#include "common/queue.h"
|
||||
#include "common/random.h"
|
||||
|
||||
#include "audio/mixer.h"
|
||||
|
||||
#include "livingbooks_code.h"
|
||||
|
||||
namespace Common {
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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?
|
||||
|
@ -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
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "common/random.h"
|
||||
#include "common/memstream.h"
|
||||
#include "common/textconsole.h"
|
||||
#include "audio/mididrv.h"
|
||||
|
||||
#include "saga/gfx.h"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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:
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user