aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/sound
diff options
context:
space:
mode:
authorPaul Gilbert2016-09-02 20:10:48 -0400
committerPaul Gilbert2016-09-02 20:10:48 -0400
commit6e5072e1b253038d1eb05e66937637069a3a84f8 (patch)
tree30244e044c8041dd1652d092c6cbd64aa75394ca /engines/titanic/sound
parenta4d577beffbd33e0472efe5b3d3a99cb97b8ecb5 (diff)
downloadscummvm-rg350-6e5072e1b253038d1eb05e66937637069a3a84f8.tar.gz
scummvm-rg350-6e5072e1b253038d1eb05e66937637069a3a84f8.tar.bz2
scummvm-rg350-6e5072e1b253038d1eb05e66937637069a3a84f8.zip
TITANIC: Figured out sound durations for speeches & SFX
Diffstat (limited to 'engines/titanic/sound')
-rw-r--r--engines/titanic/sound/proximity.cpp2
-rw-r--r--engines/titanic/sound/proximity.h2
-rw-r--r--engines/titanic/sound/sound.cpp4
-rw-r--r--engines/titanic/sound/wave_file.cpp5
-rw-r--r--engines/titanic/sound/wave_file.h5
5 files changed, 10 insertions, 8 deletions
diff --git a/engines/titanic/sound/proximity.cpp b/engines/titanic/sound/proximity.cpp
index 9e70722520..59639fd9b5 100644
--- a/engines/titanic/sound/proximity.cpp
+++ b/engines/titanic/sound/proximity.cpp
@@ -31,7 +31,7 @@ CProximity::CProximity() : _field4(0), _channelVolume(100), _fieldC(0),
_range(0.5), _elevation(0), _posX(0.0), _posY(0.0), _posZ(0.0),
_hasVelocity(false), _velocityX(0), _velocityY(0), _velocityZ(0),
_field54(0), _field58(0), _field5C(0), _freeSoundFlag(false), _endTalkerFn(nullptr),
- _talker(nullptr), _field6C(0), _soundType(Audio::Mixer::kPlainSoundType) {
+ _talker(nullptr), _soundDuration(0), _soundType(Audio::Mixer::kPlainSoundType) {
}
} // End of namespace Titanic
diff --git a/engines/titanic/sound/proximity.h b/engines/titanic/sound/proximity.h
index 41c2268c2f..adad97d099 100644
--- a/engines/titanic/sound/proximity.h
+++ b/engines/titanic/sound/proximity.h
@@ -62,7 +62,7 @@ public:
bool _freeSoundFlag;
CEndTalkerFn _endTalkerFn;
TTtalker *_talker;
- int _field6C;
+ uint _soundDuration;
Audio::Mixer::SoundType _soundType;
public:
CProximity();
diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp
index 6d27d1de49..39c8d04769 100644
--- a/engines/titanic/sound/sound.cpp
+++ b/engines/titanic/sound/sound.cpp
@@ -158,7 +158,7 @@ int CSound::playSound(const CString &name, CProximity &prox) {
if (!waveFile)
return -1;
- prox._field6C = waveFile->fn1();
+ prox._soundDuration = waveFile->getDuration();
if (prox._soundType != Audio::Mixer::kPlainSoundType)
waveFile->_soundType = prox._soundType;
@@ -208,7 +208,7 @@ int CSound::playSpeech(CDialogueFile *dialogueFile, int speechId, CProximity &pr
if (!waveFile)
return -1;
- prox._field6C = waveFile->fn1();
+ prox._soundDuration = waveFile->getDuration();
activateSound(waveFile, prox._freeSoundFlag);
return _soundManager.playSound(*waveFile, prox);
diff --git a/engines/titanic/sound/wave_file.cpp b/engines/titanic/sound/wave_file.cpp
index 8c00637d73..3f855cd053 100644
--- a/engines/titanic/sound/wave_file.cpp
+++ b/engines/titanic/sound/wave_file.cpp
@@ -43,9 +43,8 @@ CWaveFile::~CWaveFile() {
}
}
-int CWaveFile::fn1() {
- // TODO
- return 0;
+uint CWaveFile::getDuration() const {
+ return _stream ? _stream->getLength().secs() : 0;
}
bool CWaveFile::loadSound(const CString &name) {
diff --git a/engines/titanic/sound/wave_file.h b/engines/titanic/sound/wave_file.h
index aede0c9328..4237f1a203 100644
--- a/engines/titanic/sound/wave_file.h
+++ b/engines/titanic/sound/wave_file.h
@@ -45,7 +45,10 @@ public:
CWaveFile(QSoundManager *owner);
~CWaveFile();
- int fn1();
+ /**
+ * Returns the duration of the wave file in seconds
+ */
+ uint getDuration() const;
/**
* Return the size of the wave file