FF: ADPCM sound is broken in DXA cutscenes
|Reported by:||eriktorbjorn||Owned by:||Kirben|
|Game:||The Feeble Files|
It has been known for some time now that ADPCM-sound is
not supported in The Feeble File's DXA cutscenes. I
think I see why, but I can't decide on what's the
correct way of fixing it. As far as I can tell, the
problem is twofold:
* The startSound() function in FF's DXA player uses
makeWAVStream() to create a WAV stream from a memory
stream. Then it frees the original memory buffer, so it
assumes that makeWAVStream() will make a copy of the
data. The memory stream is a local variable.
* In the case of ADPCM files, an ADPCM stream is
created from the memory stream. The data is not copied.
So, unless I'm mistaken, when the mixer tries to stream
the sound from the WAV stream, the memory stream is no
longer alive, and even if it was alive it would point
to a memory block that has been freed.
From what I've seen, in the other cases where we use
ADPCM streams, we use them to decode the entire sample
and then play it with playRaw(). But that seems
wasteful on a sample that could be several megabytes.
Even if that's what we do when playing standard WAV
data for the cutscenes.
It probably makes sense to keep the DXA sound chunk in
memory to avoid seeking back and forth, though.
Ticket imported from: #1493475. Ticket imported from: bugs/2612.