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 137

Summary: Support an environment variable for specifying preferred mixer chunk size
Product: SDL_mixer Reporter: Bill Kendrick <bill>
Component: miscAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2    
Version: unspecified   
Hardware: All   
OS: All   

Description Bill Kendrick 2006-02-06 14:32:19 UTC
Differences between OSes, versions of OSes, and audio hardware has meant that the chunk size we programmers pick are occasionally not suitable for some users (e.g., they get staticy or stuttering sound... or much more sound latency than necessary).

It would be nice if there were an environment variable that SDL_mixer could check for which allowed users to specify the best value for _their_ system (without every SDL-based program having to provide some config. or command-line method for setting it).

In otherwords, similar to how we have SDL_VIDEODRIVER and SDL_AUDIODRIVER, we could have SDL_MIXERCHUNKSIZE.  Mix_OpenAudio() could than accept a 'special' value which tells it to use the user's preferred chunk size (or some default), just as SDL_Init() uses the user's preferred video driver (or some default).

Thanks! :)
Comment 1 Sam Lantinga 2006-05-09 04:56:15 UTC
In the SDL subversion code today:
If SDL_OpenAudio() is passed zero for the desired format
fields, the following environment variables will be used
to fill them in:
        SDL_AUDIO_FREQUENCY
        SDL_AUDIO_FORMAT
        SDL_AUDIO_CHANNELS
        SDL_AUDIO_SAMPLES
If an environment variable is not specified, it will be set
to a reasonable default value.

Since SDL_mixer passes it's parameters straight through to SDL, all you have to do is specify zero for the appropriate parameter.  You should probably make sure you're linking with a new enough version of SDL at runtime though. :)  See SDL/test/testver.c for an example of how to check the runtime version of SDL.