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!