3

What is the difference between pygame.mixer init and pygame.mixer pre init? I saw a tutorial and he used pre-init, but the explanation wasn't clear. Should I just use mixer init, or do both?

marienbad
  • 1,461
  • 1
  • 9
  • 19

1 Answers1

3

The problem is that pygame.init(), which initialize all imported Pygame modules, calls pygame.mixer.init() with its default arguments, because

some platforms require the pygame.mixer to be initialized after the display modules have initialized.

as the documentation states.

To solve this problem and set proper default values for frequency, channels and buffersize you could call pygame.mixer.pre_init() to preset the default mixer init arguments before you call the pygame.init() toplevel function.

elegent
  • 3,857
  • 3
  • 23
  • 36