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 3726

Summary: PSP audio driver screws up if >2 channels are requested (patch included)
Product: SDL Reporter: Solra Bizna <solrabizna>
Component: audioAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: minor    
Priority: P2    
Version: 2.0.5   
Hardware: Other   
OS: Other   
Attachments: Let SDL_OpenAudioDevice know when we've rejected a surround configuration

Description Solra Bizna 2017-08-04 19:41:31 UTC
Created attachment 2819 [details]
Let SDL_OpenAudioDevice know when we've rejected a surround configuration

The PSP audio driver assumes that "channels == 1" means mono and anything else means stereo. If channels is greater than 2, this will result in the driver processing surround sound data as stereo, without informing SDL or the application.

I found this purely by reading SDL source, so I don't have a way to test it, but from my understanding of the SDL audio driver architecture, the attached patch is the proper fix. If more than 2 channels are requested, 2 will be obtained. SDL_OpenAudioDevice will then set up downmixing or inform the application, depending on whether SDL_AUDIO_ALLOW_CHANNELS_CHANGE is in effect.

I didn't find a similar bug in any other audio drivers.
Comment 1 Ryan C. Gordon 2017-08-04 20:19:17 UTC
Good catch; this patch is now https://hg.libsdl.org/SDL/rev/04063928c4a8, thanks!

--ryan.