[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Mixer Quit / Restart
- To: pygame-users@xxxxxxxx
- Subject: [pygame] Mixer Quit / Restart
- From: Wyatt Olson <wyatt.olson@xxxxxxxxx>
- Date: Tue, 01 Jul 2008 12:23:50 -0600
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Tue, 01 Jul 2008 14:24:02 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:x-enigmail-version:content-type :content-transfer-encoding; bh=YM4Lh7sAbmaChkd3NsGx3k0tFRJ2u8m04ETJee8O/wI=; b=LJTZxFzdNj8BTIhmdDuNfELsZfkRU64uvoO81mtSayqrrJRBQAXKdoHnP6jr6F7oSt NXLzsGCD1PXRYPRW5/8VyV0infYDL0zJDz5qHkT/Tb9yHzd7tNrW+Q901HiBImINySyR hkSThEmWPFRBw2yS+DgK4JFZRgQ3/8wz9ISvA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :x-enigmail-version:content-type:content-transfer-encoding; b=Rurh+iBAD9b6CuZ6cVUD1m5xWwK+stD/YOD2yvIv4jdNBdo9YeIqegFsy5s0OZDlOC /LRmgcYr/Ek1FAf9GTLZYG3kxk4DYwRUGDPeIgK7x8BBpy7S5Ty+xeyH12QNk0XaDSRJ lBb3GH1biPlud5lhnVoTDMqLRZitxkT6+y5f8=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
- User-agent: Thunderbird 2.0.0.14 (Macintosh/20080421)
Hello,
This is probably a stupid question, but I am unable to find an answer in
the documentation. I am having a problem when stopping / restarting
Pygame Mixer. I have the following test code:
import pygame
for x in range(10):
print("Starting iteration " + str(x))
print("Initializing mixer")
pygame.mixer.init()
print("Loading sound")
sound = pygame.mixer.Sound("foo.wav")
print("Finding free channel")
channel = pygame.mixer.find_channel(True)
print("Channel object: " + str(channel))
print("Setting volume")
channel.set_volume(0.7)
print("Playing sound")
channel.play(sound)
print("Quitting mixer\n\n")
pygame.mixer.quit()
Note that you must have a .wav file 'foo.wav' in the same directory that
you are running this from.
I would expect this code to play the sound 10 times, then quit.
However, it hangs at the channel.set_volume line on the second
iteration. Ctrl C doesn't quit; you have to do a kill <pid> to end it.
Any ideas what I am doing wrong? I need to have some way to unload and
reload the mixer (to allow configuration changes to take effect), but
once I have quit and restarted, I can't seem to change volume on a channel.
I appreciate all suggestions.
Cheers