[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] reserving an audio channel?
- To: pygame-users@xxxxxxxx
- Subject: [pygame] reserving an audio channel?
- From: Jack Nutting <jnutting@xxxxxxxxx>
- Date: Mon, 3 Oct 2005 11:35:24 +0200
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Mon, 03 Oct 2005 05:35:39 -0400
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type; b=laicAAbCq4oM5t7MYXKErcLC/CmfkbU5owvcnDRcoCrwKV2MOSEstVxr05z93Aq/LbHOpIEXu6IdQfxYuMRNkIQ8zF7jpI2FdS/Z9zW/JBWNioMXgd5optwf7nPXrzXaqP65lwU5GtSmuUwsuNcLVxwmEALaFvCc52/E3t3pSKQ=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Hi gang,
Most of the sounds I've used in my games so far are short,
fire'n'forget thingies. I manually grab a channel (so I can do
stereo effects) with pygame.mixer.find_channel(True) so that if there
are no available channels, it will grab the longest-running busy one.
Now I've got a sound effect that I want to continue looping under
certain conditions. Unfortunately, since this quickly ends up
being the longest-running busy channel, it always ends up getting
appropriated by another sound.
What I'd like to do is essentially "lock" this one channel where I'm
playing the long-running sample. I see
pygame.mixer.set_reserved(), but that just takes a number of channels
to reserve; How do I specify that I want to lock just *this*
channel? Do I need to first grab my channel and then call
set_reserved(1) before any other sound stuff? That seems sort of
convoluted... Also, the documentation says that "calling
Sound.play() will not use the reserved channels." Does that apply
to find_channel() as well?
TIA,
--
// jack
// http://www.nuthole.com