[Scummvm-cvs-logs] scummvm master -> c691449958790019650829233a616c64ba726f71
dreammaster
dreammaster at scummvm.org
Sat Aug 6 05:08:41 CEST 2016
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c691449958 TITANIC: Add sounds list to QSoundManager
Commit: c691449958790019650829233a616c64ba726f71
https://github.com/scummvm/scummvm/commit/c691449958790019650829233a616c64ba726f71
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-05T23:08:34-04:00
Commit Message:
TITANIC: Add sounds list to QSoundManager
Changed paths:
engines/titanic/sound/sound_manager.cpp
engines/titanic/sound/sound_manager.h
engines/titanic/sound/wave_file.cpp
diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp
index 0d133c3..ec26b17 100644
--- a/engines/titanic/sound/sound_manager.cpp
+++ b/engines/titanic/sound/sound_manager.cpp
@@ -34,6 +34,51 @@ CSoundManager::CSoundManager() : _musicPercent(75.0), _speechPercent(75.0),
/*------------------------------------------------------------------------*/
+void QSoundManagerSounds::add(CWaveFile *waveFile, int iChannel, CEndTalkerFn endFn, TTtalker *talker) {
+ push_back(new QSoundManagerSound(waveFile, iChannel, endFn, talker));
+}
+
+void QSoundManagerSounds::flushChannel(int iChannel) {
+ for (iterator i = begin(); i != end(); ++i) {
+ QSoundManagerSound *item = *i;
+ if (item->_iChannel == iChannel) {
+ if (item->_endFn)
+ item->_endFn(item->_talker);
+
+ remove(item);
+ delete item;
+ break;
+ }
+ }
+}
+
+void QSoundManagerSounds::flushChannel(int v1, int iChannel) {
+ for (iterator i = begin(); i != end(); ++i) {
+ QSoundManagerSound *item = *i;
+ if (item->_waveFile->isLoaded() && item->_iChannel == iChannel) {
+ if (item->_endFn)
+ item->_endFn(item->_talker);
+
+ remove(item);
+ delete item;
+ break;
+ }
+ }
+}
+
+bool QSoundManagerSounds::contains(const CWaveFile *waveFile) const {
+ for (const_iterator i = begin(); i != end(); ++i) {
+ const QSoundManagerSound *item = *i;
+ if (item->_waveFile == waveFile)
+ return true;
+ }
+
+ return false;
+}
+
+
+/*------------------------------------------------------------------------*/
+
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 f703e4f..e69cfff 100644
--- a/engines/titanic/sound/sound_manager.h
+++ b/engines/titanic/sound/sound_manager.h
@@ -23,6 +23,7 @@
#ifndef TITANIC_SOUND_MANAGER_H
#define TITANIC_SOUND_MANAGER_H
+#include "titanic/core/list.h"
#include "titanic/support/simple_file.h"
#include "titanic/sound/proximity.h"
#include "titanic/sound/qmixer.h"
@@ -125,11 +126,49 @@ public:
virtual void proc29() {}
};
+class QSoundManagerSound : public ListItem {
+public:
+ CWaveFile *_waveFile;
+ int _iChannel;
+ CEndTalkerFn _endFn;
+ TTtalker *_talker;
+public:
+ QSoundManagerSound() : ListItem(), _waveFile(nullptr),
+ _iChannel(0), _endFn(nullptr), _talker(nullptr) {}
+ QSoundManagerSound(CWaveFile *waveFile, int iChannel, CEndTalkerFn endFn, TTtalker *talker) :
+ ListItem(), _waveFile(waveFile), _iChannel(iChannel), _endFn(endFn), _talker(talker) {}
+};
+
+class QSoundManagerSounds : public List<QSoundManagerSound> {
+public:
+ /**
+ * Adds a new sound entry to the list
+ */
+ void add(CWaveFile *waveFile, int iChannel, CEndTalkerFn endFn, TTtalker *talker);
+
+ /**
+ * Flushes a wave file attached to the specified channel
+ */
+ void flushChannel(int iChannel);
+
+ /**
+ * Flushes a wave file attached to the specified channel
+ */
+ void flushChannel(int v1, int iChannel);
+
+ /**
+ * Returns true if the list contains the specified wave file
+ */
+ bool contains(const CWaveFile *waveFile) const;
+};
+
/**
* Concrete sound manager class that handles interfacing with
* the QMixer sound mixer class
*/
class QSoundManager : public CSoundManager, public QMixer {
+private:
+ QSoundManagerSounds _sounds;
public:
int _field18;
int _field1C;
diff --git a/engines/titanic/sound/wave_file.cpp b/engines/titanic/sound/wave_file.cpp
index 56e12e3..6f0007f 100644
--- a/engines/titanic/sound/wave_file.cpp
+++ b/engines/titanic/sound/wave_file.cpp
@@ -48,6 +48,7 @@ bool CWaveFile::loadSound(const CString &name) {
Common::SeekableReadStream *stream = file.readStream();
_stream = Audio::makeWAVStream(stream->readStream(stream->size()), DisposeAfterUse::YES);
+ return true;
}
More information about the Scummvm-git-logs
mailing list