diff options
author | Paul Gilbert | 2016-10-23 20:11:30 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-10-23 20:11:30 -0400 |
commit | 3852d1406111253a0cf335c49699d862940e0323 (patch) | |
tree | befd7cf49bad6b2e5d104e0a5ce76934a268eab7 /engines/titanic/sound/wave_file.cpp | |
parent | 588aaeac393293dd5c9a2b44f48ce6644416b96b (diff) | |
download | scummvm-rg350-3852d1406111253a0cf335c49699d862940e0323.tar.gz scummvm-rg350-3852d1406111253a0cf335c49699d862940e0323.tar.bz2 scummvm-rg350-3852d1406111253a0cf335c49699d862940e0323.zip |
TITANIC: Match the CWaveFile duration method closer to original
Diffstat (limited to 'engines/titanic/sound/wave_file.cpp')
-rw-r--r-- | engines/titanic/sound/wave_file.cpp | 13 |
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) { |