ALL: Endianness sound problem
|Reported by:||SF/trilkk||Owned by:||fingolfin|
When playing the games on PowerPC G4 running Linux, all
sound is garbled. I examined the source code and found
out the problem being no endianness checks in the mixer
Now, the strange thing is that before 0.7.1 sound
worked just fine. The glitches began when upgrading to
the current version. Either the sound code is
completely changed, or the endianness check has been
removed (why in the name of god?).
I was able to fix the problem for me by modifying the
SoundMixer::mix method and adding implicit byte swaps
at the end of the code (after each channel has been mixed).
// This way
for(int i = 0; i < len; i++)
int8 *dst = (int8*)(&buf[i * 2]);
int16 l = buf[i * 2], r = buf[i * 2 + 1];
dst = l & 0xFF;
dst = l >> 8;
dst = r & 0xFF;
dst = r >> 8;
Now, as we can see this piece of code is bullshit.
Although it makes sound play ok, I don't know about
your methods about checking the endianness nor I do
know in which point would you like the check to be done.
Please fix this in an elegant manner or provide me some
information on how it should be done.
Ticket imported from: #1294413. Ticket imported from: bugs/2203.
Change History (13)
comment:8 by , 14 years ago
|Status:||pending → new|
|Summary:||Endianness sound problem → ALL: Endianness sound problem|