[Tutor] Mixer and Busy Flag Never Working?

FT chester_lab at fltg.net
Fri Jul 4 00:06:10 CEST 2008

A Question:

    Has anyone ever played with Pygame and the sound mixer? If so, has
anyone ever had the busy flag, and the problem below ever work?

Subject: Re: [pygame] Mixer Quit / Restart

This appears to get the total number of channels, not the number of active
channels.  However, I tried using get_busy(), but it still does not seem to

See the following modifications to my original code:

import pygame, time

for x in range(10):
    print("Starting iteration " + str(x))
    print("Initializing mixer")

    print("Loading sound")
    sound = pygame.mixer.Sound("foo.wav")
    print("Finding free channel")
    channel = pygame.mixer.find_channel()

    print("Channel object: " + str(channel))

    print("Setting volume")

    print("Playing sound")

    print("Sleeping until sound is finished playing...")
    while pygame.mixer.get_busy():

    print("Quitting mixer\n\n")

This displays the same behaviour.

In response to a previous comment about using channel.stop() before quitting
the mixer: this does not work either, as can be seen by adding
channel.stop() after the get_busy loop above.

Has anyone tried running this code themselves?  I am wondering if I am
experiencing some obscure bug, possibly platform specific.  I am running on
OS X, but don't have access to other systems for troubleshooting.  If
someone else has access to a Windows or Linux box, and is able to prove if
this fails on those systems as well, that may be useful.


Ian Mallett wrote:
  On 7/2/08, Wyatt Olson <wyatt.olson at gmail.com> wrote:
    Is there anything which can return a list of all currently active
  This returns 0 if none are playing and > 0 if there are.

More information about the Tutor mailing list