We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 292

Summary: SDL_ConvertMono doubles volume
Product: SDL Reporter: Ryan C. Gordon <icculus>
Component: audioAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 1.2.9   
Hardware: All   
OS: All   

Description Ryan C. Gordon 2006-08-03 01:31:59 UTC
I might be on crack here.

It looks like SDL_ConvertMono() in src/audio/SDL_audiocvt.c adds the left and right channels of a stereo stream together, and clamps the new mono channel if it would overflow.

Shouldn't it be dividing by 2 to average the two sample points instead of clamping? Otherwise the mono sample point's volume doubles in the conversion. This would also make the conversion faster, as it replaces two branches per sample frame with a bitwise shift.

--ryan.
Comment 1 Sam Lantinga 2006-09-24 11:56:40 UTC
You're not on crack. :)
I fixed it in subversion, but I haven't tested it.  Can you try it out and make sure it works now?

Thanks!
Comment 2 Ryan C. Gordon 2006-09-24 12:10:39 UTC
Reopened bug and assigning to me for testing.

--ryan.

Comment 3 Ryan C. Gordon 2006-10-28 23:46:02 UTC
Looks good to me.

--ryan.