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

Re: [pygame] sound crackling and fmod



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