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 - SDL_ConvertMono doubles volume
Summary: SDL_ConvertMono doubles volume
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: 1.2.9
Hardware: All All
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-03 01:31 UTC by Ryan C. Gordon
Modified: 2006-10-28 23:46 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.