Warning: breaks compatibility with previous savefiles.
They were mostly broken anyway, locking any NPC who
waited for kActionEndSound when savefile was created.
Now it works just like in the original game,
including fading where it is applicable
(e.g. in a passengers list if closing the list while a sound is playing).
By the way, p2s sequence is known as http://oeis.org/A000265 ,
p1s is 4 - A007814, and p2s[i]/2**p1s[i] is just i/16.
It is time to get rid of these arrays.
SoundEntry::play() calls StreamedSound::setFilterId(),
StreamSound::setFilterId() requires the underlying reference to be alive.
SoundQueue::handleTimer() checks that the stream is still alive
by calling SoundEntry::isFinished(). However, if the stream is finalized
just between calls to SoundEntry::isFinished() and SoundEntry::play(),
the sound mixer frees the stream leading to use-after-free in setFilterId().
Turn off the automatical disposing, delete the stream in SoundEntry::~SoundEntry().
- Move filtering to SoundEntry class
- Make some methods of SoundEntry class private
- Add methods to check if a StreamedSound/AppendableSound is done playing
- Split The Last Express' ADPCM to the engine. Using the MS IMA routine was really a hack.
- Fixed stereo MS IMA ADPCM, the old routine was completely wrong.