From 064df1ff2761dea322c805b45c3b356067114799 Mon Sep 17 00:00:00 2001 From: Ori Avtalion Date: Thu, 14 Apr 2016 17:18:33 +0300 Subject: GOB: Reduce audio header dependencies --- engines/gob/gob.cpp | 1 + engines/gob/inter_playtoons.cpp | 1 - engines/gob/inter_v4.cpp | 2 +- engines/gob/pregob/onceupon/onceupon.cpp | 2 -- engines/gob/pregob/pregob.h | 4 ++-- engines/gob/sound/bgatmosphere.cpp | 9 +++++---- engines/gob/sound/bgatmosphere.h | 10 +++------- engines/gob/sound/sound.cpp | 3 ++- engines/gob/sound/sound.h | 10 ++++++++-- engines/gob/videoplayer.cpp | 2 ++ engines/gob/videoplayer.h | 5 ++++- 11 files changed, 28 insertions(+), 21 deletions(-) diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index d995f26d9f..b51a6382e6 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -26,6 +26,7 @@ #include "base/plugins.h" #include "common/config-manager.h" #include "audio/mididrv.h" +#include "audio/mixer.h" #include "gui/gui-manager.h" #include "gui/dialog.h" diff --git a/engines/gob/inter_playtoons.cpp b/engines/gob/inter_playtoons.cpp index 45f573efcd..13d24dc05d 100644 --- a/engines/gob/inter_playtoons.cpp +++ b/engines/gob/inter_playtoons.cpp @@ -41,7 +41,6 @@ #include "gob/video.h" #include "gob/videoplayer.h" #include "gob/save/saveload.h" -#include "gob/sound/sound.h" namespace Gob { diff --git a/engines/gob/inter_v4.cpp b/engines/gob/inter_v4.cpp index 656ca6f5c3..d379d5ab11 100644 --- a/engines/gob/inter_v4.cpp +++ b/engines/gob/inter_v4.cpp @@ -205,7 +205,7 @@ void Inter_v4::o4_playVmdOrMusic() { return; } else if (props.lastFrame == -9) { _vm->_sound->bgStop(); - _vm->_sound->bgSetPlayMode(BackgroundAtmosphere::kPlayModeRandom); + _vm->_sound->bgSetPlayMode(Sound::kPlayModeRandom); _vm->_sound->bgPlay(file.c_str(), "SND", SOUND_SND, props.palStart); return; } else if (props.lastFrame < 0) { diff --git a/engines/gob/pregob/onceupon/onceupon.cpp b/engines/gob/pregob/onceupon/onceupon.cpp index a6e4da75e7..50910e77bd 100644 --- a/engines/gob/pregob/onceupon/onceupon.cpp +++ b/engines/gob/pregob/onceupon/onceupon.cpp @@ -30,8 +30,6 @@ #include "gob/anifile.h" #include "gob/aniobject.h" -#include "gob/sound/sound.h" - #include "gob/pregob/txtfile.h" #include "gob/pregob/gctfile.h" diff --git a/engines/gob/pregob/pregob.h b/engines/gob/pregob/pregob.h index 021cf2b3d6..108771a63a 100644 --- a/engines/gob/pregob/pregob.h +++ b/engines/gob/pregob/pregob.h @@ -29,14 +29,14 @@ #include "gob/util.h" #include "gob/aniobject.h" -#include "gob/sound/sounddesc.h" - #include "gob/pregob/txtfile.h" namespace Gob { class GobEngine; +class ANIFile; class Surface; +class SoundDesc; class GCTFile; diff --git a/engines/gob/sound/bgatmosphere.cpp b/engines/gob/sound/bgatmosphere.cpp index 21fb70278a..c7be1be96a 100644 --- a/engines/gob/sound/bgatmosphere.cpp +++ b/engines/gob/sound/bgatmosphere.cpp @@ -23,6 +23,7 @@ #include "common/array.h" #include "gob/sound/bgatmosphere.h" +#include "gob/sound/sound.h" #include "gob/sound/sounddesc.h" namespace Gob { @@ -30,7 +31,7 @@ namespace Gob { BackgroundAtmosphere::BackgroundAtmosphere(Audio::Mixer &mixer) : SoundMixer(mixer, Audio::Mixer::kMusicSoundType), _rnd("gobBA") { - _playMode = kPlayModeLinear; + _playMode = Sound::kPlayModeLinear; _queuePos = -1; _shaded = false; _shadable = true; @@ -56,7 +57,7 @@ void BackgroundAtmosphere::stopBA() { SoundMixer::stop(0); } -void BackgroundAtmosphere::setPlayMode(PlayMode mode) { +void BackgroundAtmosphere::setPlayMode(Sound::BackgroundPlayMode mode) { _playMode = mode; } @@ -100,11 +101,11 @@ void BackgroundAtmosphere::getNextQueuePos() { switch (_playMode) { - case kPlayModeLinear: + case Sound::kPlayModeLinear: _queuePos = (_queuePos + 1) % _queue.size(); break; - case kPlayModeRandom: + case Sound::kPlayModeRandom: _queuePos = _rnd.getRandomNumber(_queue.size() - 1); break; diff --git a/engines/gob/sound/bgatmosphere.h b/engines/gob/sound/bgatmosphere.h index c838a2c2bb..138b65a1c1 100644 --- a/engines/gob/sound/bgatmosphere.h +++ b/engines/gob/sound/bgatmosphere.h @@ -27,6 +27,7 @@ #include "common/mutex.h" #include "common/random.h" +#include "gob/sound/sound.h" #include "gob/sound/soundmixer.h" namespace Audio { @@ -39,18 +40,13 @@ class SoundDesc; class BackgroundAtmosphere : private SoundMixer { public: - enum PlayMode { - kPlayModeLinear, - kPlayModeRandom - }; - BackgroundAtmosphere(Audio::Mixer &mixer); ~BackgroundAtmosphere(); void playBA(); void stopBA(); - void setPlayMode(PlayMode mode); + void setPlayMode(Sound::BackgroundPlayMode mode); void queueSample(SoundDesc &sndDesc); void queueClear(); @@ -60,7 +56,7 @@ public: void unshade(); private: - PlayMode _playMode; + Sound::BackgroundPlayMode _playMode; Common::Array _queue; int _queuePos; diff --git a/engines/gob/sound/sound.cpp b/engines/gob/sound/sound.cpp index 22dfe9d3c3..000eafa031 100644 --- a/engines/gob/sound/sound.cpp +++ b/engines/gob/sound/sound.cpp @@ -28,6 +28,7 @@ #include "gob/game.h" #include "gob/inter.h" +#include "gob/sound/bgatmosphere.h" #include "gob/sound/pcspeaker.h" #include "gob/sound/soundblaster.h" #include "gob/sound/adlplayer.h" @@ -717,7 +718,7 @@ void Sound::bgStop() { _bgatmos->queueClear(); } -void Sound::bgSetPlayMode(BackgroundAtmosphere::PlayMode mode) { +void Sound::bgSetPlayMode(Sound::BackgroundPlayMode mode) { if (!_bgatmos) return; diff --git a/engines/gob/sound/sound.h b/engines/gob/sound/sound.h index 6ebc323b18..f1fd46d24b 100644 --- a/engines/gob/sound/sound.h +++ b/engines/gob/sound/sound.h @@ -23,12 +23,13 @@ #ifndef GOB_SOUND_SOUND_H #define GOB_SOUND_SOUND_H +#include "common/str.h" #include "gob/sound/sounddesc.h" -#include "gob/sound/bgatmosphere.h" namespace Gob { class GobEngine; +class BackgroundAtmosphere; class PCSpeaker; class SoundBlaster; class ADLPlayer; @@ -39,6 +40,11 @@ class CDROM; class Sound { public: + enum BackgroundPlayMode { + kPlayModeLinear, + kPlayModeRandom + }; + static const int kSoundsCount = 60; Sound(GobEngine *vm); @@ -135,7 +141,7 @@ public: void bgPlay(const char *base, const char *ext, SoundType type, int count); void bgStop(); - void bgSetPlayMode(BackgroundAtmosphere::PlayMode mode); + void bgSetPlayMode(BackgroundPlayMode mode); void bgShade(); void bgUnshade(); diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index e97848d27e..bbf4ef4162 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -21,6 +21,8 @@ */ +#include "video/coktel_decoder.h" + #include "gob/videoplayer.h" #include "gob/global.h" #include "gob/dataio.h" diff --git a/engines/gob/videoplayer.h b/engines/gob/videoplayer.h index 02ed510ec5..1c39ecf2fa 100644 --- a/engines/gob/videoplayer.h +++ b/engines/gob/videoplayer.h @@ -29,11 +29,14 @@ #include "common/str.h" #include "graphics/surface.h" -#include "video/coktel_decoder.h" #include "gob/util.h" #include "gob/draw.h" +namespace Video { +class CoktelDecoder; +} + namespace Gob { class GobEngine; -- cgit v1.2.3