mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-26 20:59:00 +00:00
TITANIC: Match the CWaveFile duration method closer to original
This commit is contained in:
parent
588aaeac39
commit
3852d14061
@ -159,7 +159,7 @@ int CSound::playSound(const CString &name, CProximity &prox) {
|
||||
if (!waveFile)
|
||||
return -1;
|
||||
|
||||
prox._soundDuration = waveFile->getDuration();
|
||||
prox._soundDuration = waveFile->getDurationTicks();
|
||||
if (prox._soundType != Audio::Mixer::kPlainSoundType)
|
||||
waveFile->_soundType = prox._soundType;
|
||||
|
||||
@ -209,7 +209,7 @@ int CSound::playSpeech(CDialogueFile *dialogueFile, int speechId, CProximity &pr
|
||||
if (!waveFile)
|
||||
return -1;
|
||||
|
||||
prox._soundDuration = waveFile->getDuration();
|
||||
prox._soundDuration = waveFile->getDurationTicks();
|
||||
activateSound(waveFile, prox._disposeAfterUse);
|
||||
|
||||
return _soundManager.playSound(*waveFile, prox);
|
||||
|
@ -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) {
|
||||
|
@ -46,9 +46,11 @@ public:
|
||||
~CWaveFile();
|
||||
|
||||
/**
|
||||
* Returns the duration of the wave file in seconds
|
||||
* Returns the duration of the wave file
|
||||
* @returns Total ticks. Not really sure how ticks
|
||||
* map to real time
|
||||
*/
|
||||
uint getDuration() const;
|
||||
uint getDurationTicks() const;
|
||||
|
||||
/**
|
||||
* Return the size of the wave file
|
||||
|
@ -407,7 +407,7 @@ uint CTrueTalkManager::readDialogueSpeech() {
|
||||
CWaveFile *waveFile = _gameManager->_sound.getTrueTalkSound(
|
||||
_dialogueFile, _titleEngine._indexes[idx] - _dialogueId);
|
||||
if (waveFile) {
|
||||
_speechDuration += waveFile->getDuration();
|
||||
_speechDuration += waveFile->getDurationTicks();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user