Opened 19 years ago

Closed 19 years ago

Last modified 19 years ago

#2612 closed defect (fixed)

FF: ADPCM sound is broken in DXA cutscenes

Reported by: eriktorbjorn Owned by: Kirben
Priority: normal Component: Engine: AGOS
Version: Keywords:
Cc: Game: The Feeble Files

Description

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.

Change History (4)

comment:1 by eriktorbjorn, 19 years ago

Component: Engine: AGOS
Game: The Feeble Files

comment:2 by eriktorbjorn, 19 years ago

Owner: set to Kirben

comment:3 by Kirben, 19 years ago

Compressed sound support in makeWAVStream() was never really tested, since it was not used at all for long time. Based on original code of fuction, it should copy the data in all cases. It will increase memory usage, but we already use large amount of memory during cutscenes, so doubt it will make much difference.

In other places where ADPCM streams are used (HE Games and FF in game), sound looping is required. Which is only supported by playRaw() at the moment.

comment:4 by Kirben, 19 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.