[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] sound crackling and fmod



On Wed, May 02, 2007 at 10:02:15AM -0700, Ian Clark wrote:
> On 5/2/07, James Paige <Bob@xxxxxxxxxxxxxxxxxxx> wrote:
> >On Wed, May 02, 2007 at 08:47:22AM -0700, Ian Clark wrote:
> >> On 5/1/07, Andrew Pape <andrew_pape@xxxxxxxxxxxx> wrote:
> >> >that works fine too now, with the same "export" line. All I do now is 
> >write
> >> >a simple script that does the export and then runs Python on the demo.
> >> >Simple. Thanks again John, and thanks also to takis and others for your
> >> >help
> >> >too.
> >>
> >> You don't need to write a wrapper for this.
> >>
> >> $ echo "export SDL_AUDIODRIVER=dsp" >> ~/.bashrc
> >>
> >> Your ~/.bashrc file gets sourced everytime you run a bash shell (which
> >> is anytime you run a #!/bin/bash, #!/usr/env python, etc)
> >>
> >> Ian
> >
> >What about something like:
> >
> >  import os
> >  import sys
> >  if sys.platform == 'linux2':
> >      os.environ['SDL_AUDIODRIVER'] = 'dsp'
> >
> >before you call pygame.init? That way it even works for games you
> >distribute to others... or better yet, and in-game config screen that
> >lets the user choose an sdl audiodriver, save it in the game prefs, and
> >use it next time they run the game.
> >
> >---
> >James Paige
> 
> I would say either let the user configure that option in game (through
> a menu as you suggested) or leave it out completely. By putting that
> in you're forcing users into using a specific sound system, a system
> that might not work for them.
> 
> Options such as this should be left completely in the user's hands.
> What if I want to use DMA? I'm now forced into using DSP regardless of
> any environment variables that I set.
> 
> Ian
> 

Good point. This would be better:

  import os
  import sys
  if sys.platform == 'linux2':
      if os.environ.has_key('SDL_AUDIODRIVER') == False:
          os.environ['SDL_AUDIODRIVER'] = 'dsp'

That way it would only override the default if the user had not manually 
set the environment variable at all.

---
James Paige