From 386761f340ca0c891ca0b207bdcb8ec34c373cba Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 5 Aug 2016 13:11:12 -0400 Subject: TITANIC: Added skeleton QMixer class for mixer interface --- engines/titanic/sound/qmixer.cpp | 27 +++++++++++++++ engines/titanic/sound/qmixer.h | 61 +++++++++++++++++++++++++++++++++ engines/titanic/sound/sound.cpp | 3 +- engines/titanic/sound/sound.h | 2 +- engines/titanic/sound/sound_manager.cpp | 3 +- engines/titanic/sound/sound_manager.h | 13 +++++-- 6 files changed, 104 insertions(+), 5 deletions(-) create mode 100644 engines/titanic/sound/qmixer.cpp create mode 100644 engines/titanic/sound/qmixer.h (limited to 'engines/titanic/sound') diff --git a/engines/titanic/sound/qmixer.cpp b/engines/titanic/sound/qmixer.cpp new file mode 100644 index 0000000000..7df6a70fd2 --- /dev/null +++ b/engines/titanic/sound/qmixer.cpp @@ -0,0 +1,27 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/sound/qmixer.h" + +namespace Titanic { + +} // End of namespace Titanic z diff --git a/engines/titanic/sound/qmixer.h b/engines/titanic/sound/qmixer.h new file mode 100644 index 0000000000..990abf5b52 --- /dev/null +++ b/engines/titanic/sound/qmixer.h @@ -0,0 +1,61 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_QMIXER_H +#define TITANIC_QMIXER_H + +#include "audio/mixer.h" + +namespace Titanic { + +/** + * Vector positioning in metres + */ +struct QSVECTOR { + double x; + double y; + double z; +}; + +/** + * This class represents an interface to the QMixer library developed by + * QSound Labs, Inc. Which itself is apparently based on Microsoft's + * WaveMix API. + * + * It does not currently have any actual code from + * the library, and instead remaps calls to ScummVM's existing mixer + * where possible. This means that advanced features of the QMixer + * library, like being able to set up both the player and sounds at + * different positions are currently ignored, and all sounds play + * at full volume. + */ +class QMixer { +private: + Audio::Mixer *_mixer; +public: + QMixer(Audio::Mixer *mixer) : _mixer(mixer) {} + virtual ~QMixer() {} +}; + +} // End of namespace Titanic + +#endif /* TITANIC_QMIXER_H */ diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index 40f5c4335e..5ee1d24d04 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -31,7 +31,8 @@ int CSoundItem::fn1() { return 0; } -CSound::CSound(CGameManager *owner) : _gameManager(owner) { +CSound::CSound(CGameManager *owner, Audio::Mixer *mixer) : + _gameManager(owner), _soundManager(mixer) { g_vm->_movieManager.setSoundManager(&_soundManager); } diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index 8c953c8f2b..e2b5470458 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -75,7 +75,7 @@ private: public: QSoundManager _soundManager; public: - CSound(CGameManager *owner); + CSound(CGameManager *owner, Audio::Mixer *mixer); /** * Save the data for the class to file diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp index bf087b6317..bd50a8ea9b 100644 --- a/engines/titanic/sound/sound_manager.cpp +++ b/engines/titanic/sound/sound_manager.cpp @@ -30,7 +30,8 @@ CSoundManager::CSoundManager() : _musicPercent(75.0), _speechPercent(75.0), /*------------------------------------------------------------------------*/ -QSoundManager::QSoundManager() : _field18(0), _field1C(0) { +QSoundManager::QSoundManager(Audio::Mixer *mixer) : CSoundManager(), QMixer(mixer), + _field18(0), _field1C(0) { Common::fill(&_field4A0[0], &_field4A0[16], 0); } diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h index ddfcba0d0f..af97db35ed 100644 --- a/engines/titanic/sound/sound_manager.h +++ b/engines/titanic/sound/sound_manager.h @@ -25,11 +25,15 @@ #include "titanic/support/simple_file.h" #include "titanic/sound/proximity.h" +#include "titanic/sound/qmixer.h" #include "titanic/sound/wave_file.h" #include "titanic/true_talk/dialogue_file.h" namespace Titanic { +/** + * Abstract interface class for a sound manager + */ class CSoundManager { protected: double _musicPercent; @@ -122,14 +126,19 @@ public: virtual void proc29() {} }; -class QSoundManager : public CSoundManager { +/** + * Concrete sound manager class that handles interfacing with + * the QMixer sound mixer class + */ +class QSoundManager : public CSoundManager, public QMixer { public: int _field18; int _field1C; int _field4A0[16]; public: - QSoundManager(); + QSoundManager(Audio::Mixer *mixer); + virtual ~QSoundManager() {} /** * Loads a sound -- cgit v1.2.3