Opened 14 years ago
Closed 13 years ago
Last modified 4 years ago
#9067 closed patch
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.
Change History (12)
by , 14 years ago
comment:1 by , 14 years ago
Ack, this fixes bug #2211901, which is still present in SVN - despite it beeing set to "Fixed"
by , 14 years ago
Patch superseeding wave_endianness_fix.diff
comment:2 by , 14 years ago
Commited a hotfix for bug #2211901, which is less intrusive and can be tested now.
clone's patch is still valid, and should be the way to clean up the endian mess. Uploaded wave_endianness_fix_2.diff, which adapts the initial patch and reverts the hotfix too.
comment:3 by , 14 years ago
This patch seems sensible to me, but I don't think we should apply it to the 1.0.0 branch at this stage: As i understand dhewg fixed the issue there with a hotfix, so there is no improved stability to be gained, but a risk of breaking engines.
However, it would be good to apply this to trunk ASAP so we can start testing it for regressions in the modified engines.
comment:4 by , 14 years ago
Please adjust the patch for trunk. Especially change to tucker/resource.cpp is not obvious to me
comment:5 by , 14 years ago
OK, I'll make a patch for the trunk.
by , 13 years ago
Patch against current trunk (r45085)
comment:6 by , 13 years ago
I added a new patch for the trunk (which is essentially the same as the previous one).
@sev: The Tucker changes were moving from loadWAVFromStream() to makeWAVStream()
comment:7 by , 13 years ago
Great work, commited to trunk.
comment:8 by , 13 years ago
|Status:||new → closed|
comment:9 by , 4 years ago
Patch against 1.0.0 branch