[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] reserving an audio channel?



On 10/3/05, Peter Shinners <pete@xxxxxxxxxxxx> wrote:
First call pygame.mixer.set_reserved(1) to give you one reserved
channel. These are always the first 'n' channels in the system. Play
your longer lasting effects like this,
pygame.mixer.Channel(0).play(long_sound)


Aha... I didn't realize you could grab a specific channel by supplying an index.  Suddenly the API to reserve a certain number of channels makes sense! :)
 

If you are noticing your short effects getting cut, it's also easy to
bump up the number of mixing channels in play.
pygame.mixer.set_num_channels(20). The default is 8.

One last note, you can use stereo effects using the Sound.play() method.
This returns the channel object that is playing the sound. So a
mysound.play().set_volume(0, 1) will do the trick.

Good point, perhaps I can skip dealing with channels for the normal sounds.

Thanks!

--
// jack
// http://www.nuthole.com