| Summary: | Samplerate problems go unnoticed because of ALSA API mismatch | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Tilman Sauerbeck <tilman> |
| Component: | audio | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | sezeroz |
| Version: | 1.2.13 | Keywords: | target-1.2.14 |
| Hardware: | x86 | ||
| OS: | Linux | ||
| Attachments: |
Patch
addresses snd_pcm_hw_params_get_channels as well as not using dlvsym for ALSA 0.9 functions check return value correctly |
||
Created attachment 340 [details]
addresses snd_pcm_hw_params_get_channels as well as not using dlvsym for ALSA 0.9 functions
Part of the previous patch removes the ALSA_PCM_OLD_HW_PARAMS_API & ALSA_PCM_OLD_SW_PARAMS_API, and with that, (using pcm.h instead of pcm_old.h)
static int (*SDL_NAME(snd_pcm_hw_params_get_channels))(const snd_pcm_hw_params_t *params);
needs to be changed to:
static int (*SDL_NAME(snd_pcm_hw_params_get_channels))(const snd_pcm_hw_params_t *params, unsigned int *val);
Attached is a patch with a few more changes. Getting closer to the using the new ALSA API....
Created attachment 341 [details]
check return value correctly
Tagging this bug with "target-1.2.14" so we can try to resolve it for SDL 1.2.14. Please note that we may choose to resolve it as WONTFIX. This tag is largely so we have a comprehensive wishlist of bugs to examine for 1.2.14 (and so we can close bugs that we'll never fix, rather than have them live forever in Bugzilla). --ryan. Ryan, can you evaluate this patch for 1.2 and 1.3? Thanks! Fixed in svn revision #4991 for the 1.2 branch, and #4992 for the 1.3 branch. Thanks! --ryan. |
Created attachment 327 [details] Patch The prototype for the current snd_pcm_hw_params_set_rate_near function looks like this: int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); According to the ALSA docs, "val" is: val approximate target rate / returned approximate set rate SDL 1.2.13 however tries to use the old ALSA API, which used to return the actual samplerate from the function so SDL 1.2.13 doesn't work correctly with the current ALSA libraries. AFAIK, the current ALSA API has been in use for several years now. Please consider updating SDL to use that new API so samplerate problems don't go undetected anymore. I'm attaching a patch to fix this problem.