[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Re: Check Sound status in Pygame
- To: pygame-users@xxxxxxxx
- Subject: [pygame] Re: Check Sound status in Pygame
- From: Wyatt Olson <wyatt.olson@xxxxxxxxx>
- Date: Sun, 17 Feb 2008 23:47:11 -0700
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Mon, 18 Feb 2008 01:47:23 -0500
- 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:references:in-reply-to:x-enigmail-version:content-type:content-transfer-encoding; bh=qP62uBgQ1vu03cFDUIi4dRbKqX1yHLrVNtUtnns3Ep4=; b=ddH7pZN0YwFwsefPz6yBRjDN9cc9VeFhKpETXNbe2xMEPozawFU5gDA/5U26ZXZ/3d1Y9aSGEAIO4g1esqP7baF2tJOXSEyFTszj+YLVOmq31N1IzLNqxrZX4DGtL61f0xWpl6tw4UnumdaJR/6sGl6ggSdc87zMwT3Mh4utaDg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:x-enigmail-version:content-type:content-transfer-encoding; b=fQEep39Z1A+p93AOJIqbz7pUAukmyeGnrh2I4ler1QDhBgvM8A5AqSfgp1tya1oCydNgTaqXwx3ltJ5zIjWID2yZyugJALUdb/ra22WEXDbrp0m2pWL03uOUpxHq8gzoVcxmJiSFnH0abgNeN3H4LNcwLWMttoulmU2U93aAnJI=
- In-reply-to: <47B91EB0.5000008@xxxxxxxxx>
- References: <47B91EB0.5000008@xxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
- User-agent: Thunderbird 2.0.0.9 (Macintosh/20071031)
OK, I found the method get_num_channels which seems to do this.
However, I now need to be able to stop playing oldest sounds if I wish,
to clear out space for other ones. For instance, assume that I have 16
channels defined. I am trying to play 30 notes on the ride cymbal in a
5 second interval. The ride cymbal sample is 10 seconds long. Without
stopping sounds, once I play the sample 16 times, I cannot play any more
until one of the samples finished playing. What I would like to do is
check how many samples are playing, and if the count is greater than
some threshold, stop the oldest instance of the playing sound. I can't
seem to find any way to stop a single *instance* of a sound - if you
call stop() or fadeout(), all instances of the sound will be stopped. I
realize that this requirement is a bit more unique for my application,
but I imagine that manipulating individual instances of existing sounds
can be useful to anyone.
Please let me know if I am missing something else which should be
obvious to me.
Cheers
Wyatt Olson wrote:
Hello all,
I am developing a drum sequencer program using Pygame, and have a
(hopefully easy) architectural question for you. How can you tell if
a Sound object is currently playing? (On any channel - I don't care
where it is playing, I just want to know if it is). There is no
'is_playing()' or similar method which I could find. I imagine that
this is a pretty common request, so I must be just missing something.
Thanks!