| Summary: | wavestream.c patch | ||
|---|---|---|---|
| Product: | SDL_mixer | Reporter: | Sam Lantinga <slouken> |
| Component: | misc | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | blocker | ||
| Priority: | P2 | ||
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: | wavestream.c.diff | ||
|
Description
Sam Lantinga
2006-01-24 01:46:30 UTC
Created attachment 33 [details]
wavestream.c.diff
Obviously we don't want to do a malloc and a free here, but his observation seems valid. What do you think, Ryan? We probably can't avoid the malloc altogether, but we can make it just realloc() if a buffer is too small. However, we're always mixing against silence here, and just need to adjust volume...I'm wondering if we should avoid calling SDL_MixAudio altogether, which would totally eliminate the need for a second buffer. --ryan. (In reply to comment #3) > We probably can't avoid the malloc altogether, but we can make it just > realloc() if a buffer is too small. > However, we're always mixing against silence here, and just need to adjust > volume...I'm wondering if we should avoid calling SDL_MixAudio altogether, > which would totally eliminate the need for a second buffer. > --ryan. Sounds reasonable to me. Do we need an SDL_AttenuateVolume call? :) That might be nice, actually, but for now, we should just put a fix in here that doesn't require an SDL API change. I'll write up a patch. --ryan. Setting Sam as "QA Contact" on all bugs (even resolved ones) so he'll definitely be in the loop to any further discussion here about SDL. --ryan. Hey Ryan, any progress on this? I'd like to get this fixed for SDL_mixer 1.2.7 release, if possible. eh...mixing against silence isn't ideal, but SDL handles all the different data formats under the hood, so it's not worth changing it for the small performance boost. I'd say use the existing patch, but use an alloca() instead of malloc()/free(). Everything else is going to make things worse for otherwise stable code. --ryan. This patch is in Subversion, modified to use alloca instead of malloc. |