aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/sound/wave_file.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/sound/wave_file.cpp')
-rw-r--r--engines/titanic/sound/wave_file.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/engines/titanic/sound/wave_file.cpp b/engines/titanic/sound/wave_file.cpp
index 3f855cd053..ade94aad50 100644
--- a/engines/titanic/sound/wave_file.cpp
+++ b/engines/titanic/sound/wave_file.cpp
@@ -43,8 +43,17 @@ CWaveFile::~CWaveFile() {
}
}
-uint CWaveFile::getDuration() const {
- return _stream ? _stream->getLength().secs() : 0;
+uint CWaveFile::getDurationTicks() const {
+ if (!_stream)
+ return 0;
+
+ // FIXME: The original uses acmStreamSize to calculate
+ // a desired size. Since I have no idea how the system API
+ // method works, for now I'm using a simple ratio of a
+ // sample output to input value
+ uint size = _size - 0x46;
+ double newSize = (double)size * (1475712.0 / 199836.0);
+ return newSize * 1000.0 / _stream->getRate();
}
bool CWaveFile::loadSound(const CString &name) {