Wave/ADPCM Endianness Fixes (WIP)
|Reported by:||SF/mthreepwood||Owned by:||fingolfin|
As the mixer states, an audio stream should be in the platform's native endianness. Considering that, several of the ADPCM decoders use the TO_LE_16 macro and then engines (such as AGOS and SCUMM) read all of the data out of the AudioStream returned and use it in a LinearMemoryStream (via Mixer::playRaw()). This would be fine for LE systems, but breaks sounds on BE systems. This patch changes the ADPCM decoders to not use TO_LE_16 and changes the calls in both AGOS and SCUMM (HE) to adapt to this as well as makeWAVStream(). AGOS uses the streams directly and SCUMM still reads out the data, but sets the Little Endian flag if on an LE system. As a bonus, the WAV code now supports looping so the AGOS code that originally was used for that has been removed. The Feeble Files' DXA sound problem on BE systems is fixed by this patch.
As of the other engines which use loadWAVFromStream(), I converted both sword1 and Tucker to use makeWAVStream(), but I have not tested them. I did not modify SAGA, Sword2 or Gob - they are more complicated than the other engines. They may even work without any changes if the sound is raw, but I do not know.
This patch is against the 1.0.0 branch. I will also upload a patch for the trunk (my trunk was modified at the time of writing, and it was easier to code for the branch).
dhewg tested the patch on both Linux and Wii with the Feeble Files DXA. I tested on my Mac (x86) with football2002. I did not test sword1 or tucker (I don't have Tucker and I only have the PSX version of sword1).
Ticket imported from: #2834677. Ticket imported from: patches/1172.