[ scummvm-Bugs-1294413 ] Endianness sound problem

SourceForge.net noreply at sourceforge.net
Sun Sep 18 10:46:04 CEST 2005


Bugs item #1294413, was opened at 2005-09-18 08:46
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418820&aid=1294413&group_id=37116

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: iMuse/Music
Group: All Games
Status: Open
Resolution: None
Priority: 5
Submitted By: Trilkk (trilkk)
Assigned to: Nobody/Anonymous (nobody)
Summary: Endianness sound problem

Initial Comment:
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
code.

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[0] = l & 0xFF;
  dst[1] = l >> 8;
  dst[2] = r & 0xFF;
  dst[3] = 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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418820&aid=1294413&group_id=37116




More information about the Scummvm-tracker mailing list