diff options
-rw-r--r-- | engines/agi/agi.cpp | 8 | ||||
-rw-r--r-- | engines/agi/agi.h | 3 | ||||
-rw-r--r-- | engines/agi/preagi.h | 1 | ||||
-rw-r--r-- | engines/agi/sound.cpp | 2 | ||||
-rw-r--r-- | engines/agi/sound.h | 8 | ||||
-rw-r--r-- | engines/agi/sound_2gs.cpp | 2 | ||||
-rw-r--r-- | engines/agi/sound_2gs.h | 2 | ||||
-rw-r--r-- | engines/agi/sound_coco3.cpp | 2 | ||||
-rw-r--r-- | engines/agi/sound_coco3.h | 2 | ||||
-rw-r--r-- | engines/agi/sound_midi.cpp | 2 | ||||
-rw-r--r-- | engines/agi/sound_midi.h | 2 | ||||
-rw-r--r-- | engines/agi/sound_pcjr.cpp | 4 | ||||
-rw-r--r-- | engines/agi/sound_pcjr.h | 2 | ||||
-rw-r--r-- | engines/agi/sound_sarien.cpp | 2 | ||||
-rw-r--r-- | engines/agi/sound_sarien.h | 2 |
15 files changed, 24 insertions, 20 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index 4cb45e8b20..4bebf97e95 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -504,6 +504,7 @@ AgiBase::AgiBase(OSystem *syst, const AGIGameDescription *gameDesc) : Engine(sys _noSaveLoadAllowed = false; _rnd = new Common::RandomSource("agi"); + _sound = 0; initFeatures(); initVersion(); @@ -511,6 +512,11 @@ AgiBase::AgiBase(OSystem *syst, const AGIGameDescription *gameDesc) : Engine(sys AgiBase::~AgiBase() { delete _rnd; + + if (_sound) { + _sound->deinitSound(); + delete _sound; + } } AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBase(syst, gameDesc) { @@ -682,8 +688,6 @@ AgiEngine::~AgiEngine() { agiDeinit(); delete _loader; - _sound->deinitSound(); - delete _sound; _gfx->deinitVideo(); delete _sprites; delete _picture; diff --git a/engines/agi/agi.h b/engines/agi/agi.h index 24c2744629..080373d27b 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -789,6 +789,8 @@ public: AgiGame _game; Common::RandomSource *_rnd; + SoundMgr *_sound; + Mouse _mouse; bool _noSaveLoadAllowed; @@ -899,7 +901,6 @@ public: char _lastSentence[40]; SpritesMgr *_sprites; - SoundMgr *_sound; PictureMgr *_picture; AgiLoader *_loader; // loader diff --git a/engines/agi/preagi.h b/engines/agi/preagi.h index 1a178497ad..bb77786c85 100644 --- a/engines/agi/preagi.h +++ b/engines/agi/preagi.h @@ -49,7 +49,6 @@ public: return _gameId; } - //SoundMgr *_sound; PictureMgr *_picture; PreAGI_Console *_console; GUI::Debugger *getDebugger() { return _console; } diff --git a/engines/agi/sound.cpp b/engines/agi/sound.cpp index 10074ef402..2a776d8914 100644 --- a/engines/agi/sound.cpp +++ b/engines/agi/sound.cpp @@ -177,7 +177,7 @@ void SoundMgr::soundIsFinished() { _endflag = -1; } -SoundMgr::SoundMgr(AgiEngine *agi, Audio::Mixer *pMixer) { +SoundMgr::SoundMgr(AgiBase *agi, Audio::Mixer *pMixer) { _vm = agi; _endflag = -1; _playingSound = -1; diff --git a/engines/agi/sound.h b/engines/agi/sound.h index bd175d3c24..6fd8dd516e 100644 --- a/engines/agi/sound.h +++ b/engines/agi/sound.h @@ -71,7 +71,7 @@ class SoundMgr; class SoundGen { public: - SoundGen(AgiEngine *vm, Audio::Mixer *pMixer) : _vm(vm), _mixer(pMixer) { + SoundGen(AgiBase *vm, Audio::Mixer *pMixer) : _vm(vm), _mixer(pMixer) { _sampleRate = pMixer->getOutputRate(); } @@ -80,7 +80,7 @@ public: virtual void play(int resnum) = 0; virtual void stop(void) = 0; - AgiEngine *_vm; + AgiBase *_vm; Audio::Mixer *_mixer; Audio::SoundHandle _soundHandle; @@ -133,7 +133,7 @@ protected: class SoundMgr { public: - SoundMgr(AgiEngine *agi, Audio::Mixer *pMixer); + SoundMgr(AgiBase *agi, Audio::Mixer *pMixer); ~SoundMgr(); void setVolume(uint8 volume); @@ -149,7 +149,7 @@ public: private: int _endflag; - AgiEngine *_vm; + AgiBase *_vm; SoundGen *_soundGen; diff --git a/engines/agi/sound_2gs.cpp b/engines/agi/sound_2gs.cpp index 38e256aa4b..c5cfa125d6 100644 --- a/engines/agi/sound_2gs.cpp +++ b/engines/agi/sound_2gs.cpp @@ -33,7 +33,7 @@ namespace Agi { -SoundGen2GS::SoundGen2GS(AgiEngine *vm, Audio::Mixer *pMixer) : SoundGen(vm, pMixer) { +SoundGen2GS::SoundGen2GS(AgiBase *vm, Audio::Mixer *pMixer) : SoundGen(vm, pMixer) { // Allocate memory for the wavetable _wavetable = new int8[SIERRASTANDARD_SIZE]; diff --git a/engines/agi/sound_2gs.h b/engines/agi/sound_2gs.h index 9123e18415..89ffc3fe11 100644 --- a/engines/agi/sound_2gs.h +++ b/engines/agi/sound_2gs.h @@ -215,7 +215,7 @@ private: class SoundGen2GS : public SoundGen, public Audio::AudioStream { public: - SoundGen2GS(AgiEngine *vm, Audio::Mixer *pMixer); + SoundGen2GS(AgiBase *vm, Audio::Mixer *pMixer); ~SoundGen2GS(); void play(int resnum); diff --git a/engines/agi/sound_coco3.cpp b/engines/agi/sound_coco3.cpp index 281f2cb2d4..64818e4e34 100644 --- a/engines/agi/sound_coco3.cpp +++ b/engines/agi/sound_coco3.cpp @@ -34,7 +34,7 @@ static int cocoFrequencies[] = { 2093, 2217, 2349, 2489, 2637, 2793, 2959, 3135, 3322, 3520, 3729, 3951 }; -SoundGenCoCo3::SoundGenCoCo3(AgiEngine *vm, Audio::Mixer *pMixer) : SoundGen(vm, pMixer) { +SoundGenCoCo3::SoundGenCoCo3(AgiBase *vm, Audio::Mixer *pMixer) : SoundGen(vm, pMixer) { } SoundGenCoCo3::~SoundGenCoCo3() { diff --git a/engines/agi/sound_coco3.h b/engines/agi/sound_coco3.h index 7058b770f5..d24acf5cc5 100644 --- a/engines/agi/sound_coco3.h +++ b/engines/agi/sound_coco3.h @@ -42,7 +42,7 @@ struct CoCoNote { class SoundGenCoCo3 : public SoundGen, public Audio::AudioStream { public: - SoundGenCoCo3(AgiEngine *vm, Audio::Mixer *pMixer); + SoundGenCoCo3(AgiBase *vm, Audio::Mixer *pMixer); ~SoundGenCoCo3(); void play(int resnum); diff --git a/engines/agi/sound_midi.cpp b/engines/agi/sound_midi.cpp index 0cbaa4af86..47d354093b 100644 --- a/engines/agi/sound_midi.cpp +++ b/engines/agi/sound_midi.cpp @@ -69,7 +69,7 @@ MIDISound::MIDISound(uint8 *data, uint32 len, int resnum, SoundMgr &manager) : A warning("Error creating MIDI sound from resource %d (Type %d, length %d)", resnum, _type, len); } -SoundGenMIDI::SoundGenMIDI(AgiEngine *vm, Audio::Mixer *pMixer) : SoundGen(vm, pMixer), _isGM(false) { +SoundGenMIDI::SoundGenMIDI(AgiBase *vm, Audio::Mixer *pMixer) : SoundGen(vm, pMixer), _isGM(false) { MidiPlayer::createDriver(MDT_MIDI | MDT_ADLIB); int ret = _driver->open(); diff --git a/engines/agi/sound_midi.h b/engines/agi/sound_midi.h index 92a4002498..36bd66ee76 100644 --- a/engines/agi/sound_midi.h +++ b/engines/agi/sound_midi.h @@ -45,7 +45,7 @@ protected: class SoundGenMIDI : public SoundGen, public Audio::MidiPlayer { public: - SoundGenMIDI(AgiEngine *vm, Audio::Mixer *pMixer); + SoundGenMIDI(AgiBase *vm, Audio::Mixer *pMixer); void play(int resnum); // We must overload stop() here to implement the pure virtual diff --git a/engines/agi/sound_pcjr.cpp b/engines/agi/sound_pcjr.cpp index 14525dc845..d21baa450f 100644 --- a/engines/agi/sound_pcjr.cpp +++ b/engines/agi/sound_pcjr.cpp @@ -102,7 +102,7 @@ const int8 dissolveDataV3[] = { }; -SoundGenPCJr::SoundGenPCJr(AgiEngine *vm, Audio::Mixer *pMixer) : SoundGen(vm, pMixer) { +SoundGenPCJr::SoundGenPCJr(AgiBase *vm, Audio::Mixer *pMixer) : SoundGen(vm, pMixer) { _chanAllocated = 10240; // preallocate something which will most likely fit _chanData = (int16 *)malloc(_chanAllocated << 1); @@ -207,7 +207,7 @@ int SoundGenPCJr::volumeCalc(SndGenChan *chan) { chan->attenuationCopy = attenuation; attenuation &= 0x0F; - attenuation += _vm->getvar(vVolume); + attenuation += _mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 17; if (attenuation > 0x0F) attenuation = 0x0F; } diff --git a/engines/agi/sound_pcjr.h b/engines/agi/sound_pcjr.h index ec3fdff972..1b4d1e9efb 100644 --- a/engines/agi/sound_pcjr.h +++ b/engines/agi/sound_pcjr.h @@ -73,7 +73,7 @@ struct ToneChan { class SoundGenPCJr : public SoundGen, public Audio::AudioStream { public: - SoundGenPCJr(AgiEngine *vm, Audio::Mixer *pMixer); + SoundGenPCJr(AgiBase *vm, Audio::Mixer *pMixer); ~SoundGenPCJr(); void play(int resnum); diff --git a/engines/agi/sound_sarien.cpp b/engines/agi/sound_sarien.cpp index 9ea8569b81..a2baf89d12 100644 --- a/engines/agi/sound_sarien.cpp +++ b/engines/agi/sound_sarien.cpp @@ -65,7 +65,7 @@ static const int16 waveformMac[WAVEFORM_SIZE] = { -175, -172, -165, -159, -137, -114, -67, -19 }; -SoundGenSarien::SoundGenSarien(AgiEngine *vm, Audio::Mixer *pMixer) : SoundGen(vm, pMixer), _chn() { +SoundGenSarien::SoundGenSarien(AgiBase *vm, Audio::Mixer *pMixer) : SoundGen(vm, pMixer), _chn() { _sndBuffer = (int16 *)calloc(2, BUFFER_SIZE); memset(_sndBuffer, 0, BUFFER_SIZE << 1); diff --git a/engines/agi/sound_sarien.h b/engines/agi/sound_sarien.h index 22bfff3395..04f274ca7d 100644 --- a/engines/agi/sound_sarien.h +++ b/engines/agi/sound_sarien.h @@ -68,7 +68,7 @@ struct ChannelInfo { class SoundGenSarien : public SoundGen, public Audio::AudioStream { public: - SoundGenSarien(AgiEngine *vm, Audio::Mixer *pMixer); + SoundGenSarien(AgiBase *vm, Audio::Mixer *pMixer); ~SoundGenSarien(); void play(int resnum); |