TITANIC: Added skeleton QMixer class for mixer interface

This commit is contained in:
Paul Gilbert 2016-08-05 13:11:12 -04:00
parent 6e41f3673f
commit 386761f340
10 changed files with 109 additions and 9 deletions

View File

@ -30,10 +30,10 @@
namespace Titanic {
CGameManager::CGameManager(CProjectItem *project, CGameView *gameView):
CGameManager::CGameManager(CProjectItem *project, CGameView *gameView, Audio::Mixer *mixer):
_project(project), _gameView(gameView), _trueTalkManager(this),
_inputHandler(this), _inputTranslator(&_inputHandler),
_gameState(this), _sound(this), _musicRoom(this),
_gameState(this), _sound(this, mixer), _musicRoom(this),
_treeItem(nullptr), _soundMaker(nullptr), _movieRoom(nullptr),
_dragItem(nullptr), _field54(0), _lastDiskTicksCount(0), _tickCount2(0) {

View File

@ -78,7 +78,7 @@ public:
CMusicRoom _musicRoom;
CSound _sound;
public:
CGameManager(CProjectItem *project, CGameView *gameView);
CGameManager(CProjectItem *project, CGameView *gameView, Audio::Mixer *mixer);
~CGameManager();
/**

View File

@ -69,7 +69,7 @@ void CMainGameWindow::applicationStarting() {
// Create game view and manager
_gameView = new CSTGameView(this);
_gameManager = new CGameManager(_project, _gameView);
_gameManager = new CGameManager(_project, _gameView, g_vm->_mixer);
_gameView->setGameManager(_gameManager);
// Load either a new game or selected existing save

View File

@ -403,6 +403,7 @@ MODULE_OBJS := \
sound/music_player.o \
sound/node_auto_sound_player.o \
sound/proximity.o \
sound/qmixer.o \
sound/restricted_auto_music_player.o \
sound/room_auto_sound_player.o \
sound/room_trigger_auto_music_player.o \

View File

@ -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

View File

@ -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 */

View File

@ -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);
}

View File

@ -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

View File

@ -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);
}

View File

@ -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