[SDL] SDL_mixer bugs

David Ergo david.ergo at alterface.com
Thu Mar 10 22:57:35 PST 2005


Here is a patch to correct the 2 bugs and also other bugs.
Bug 1 (LFE channel saturated) has been corrected in a more generic way :
-    args->lfe_u8 = 255;
-    args->lfe_f = 255.0f;
+    args->lfe_u8 = speaker_amplitude[5];
+    args->lfe_f = ((float) speaker_amplitude[5]) / 255.0f;

Bug 2 has been corrected by adding code in _WIN32 "ifdef".

Other bugs corrected :
- in SetDistance(), SetPanning() and SetPosition(), if args where no-op
but effect was not already registered then it was registered instead of
doing a no-op.
- in SetPanning(), if left=right=255, it's a no-op so angle must be 0.
- there was some copy/paste errors in channel amplitudes (e.g. using
left instead of left_rear, etc.)

David

On Thu, 2005-03-03 at 10:08, David Ergo wrote:
> I have found two bugs in SDL_mixer v.1.2.6 in 5.1 surround mode :
> 
> 1. LFE channel saturated
> ------------------------
> The LFE channel gets saturated, because it's erroneously multiplied by
> 255 in SetPosition() function. 
> To correct this, edit effect_position.c, at line 1551, replace
>    args->lfe_f = 255.0f;
> by
>    args->lfe_f = 1.0f;
> Actually under Windows, it's the rear right channel that gets saturated
> because of the bug number 2 here under.
> 
> 2. Sound channels interverted under Windows
> -------------------------------------------
> Windows DirectX doesn't use the same channels order as Linux ALSA.
> For Linux ALSA, this is FL-FR-RL-RR-C-LFE
> and for Windows DirectX, this is FL-FR-C-LFE-RL-RR
> where FL = Front Left
>       FR = Front Right
>       RL = Rear Left
>       RR = Rear Right
>       C  = Center
>       LFE = Low Frequency Effects
> If you don't do any SetPosition()/SetPanning() there won't be any
> problems I think because the channels data is not modified, but if you
> do SetPosition() or SetPanning(), it will use C/LFE instead of RL/RR and
> RL/RR instead of C/LFE, so the channels data will be messed up for
> RL/RR/C/LFE.
> I'll try to make a patch for this.
> 
> 
> David Ergo
> Alterface s.a.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: SDL_mixer-1.2.6-effect_position.patch.gz
Type: application/x-gzip
Size: 2461 bytes
Desc: not available
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20050311/37858445/attachment-0008.bin>


More information about the SDL mailing list