On 26/12/20 3:38 am, Pavils Jurjans wrote:
I first play a sound (get the channel object in return), and let it play until the end. channel.get_sound() returns None, as it should. Then I play this sound a second time (storing the returned channel object in another variable). While the sound is still playing, if I query the first channel.get_sound(), I get the reference to the sound object.
Because you started playing the second sound after the first one finished, it re-used the same channel. I added a couple of lines to print out the repr of the sound object returned by each play() call. This is what I got: Play the sound on channel1 channel1 = <Channel object at 0x10ddf1030> After 1 second: channel1 - True After 7 seconds: channel1 - False Play the sound on channel2 channel2 = <Channel object at 0x10ddf1030> After 1 seconds: channel1 - True , channel2 - True After 4 seconds: channel1 - True , channel2 - True After 7 seconds: channel1 - False , channel2 - False You can see that channel1 and channel2 are actually the same channel object. I don't think there's anything you can do about that; you'll have to re-think your method of detecting whether a sound is still playing. Note that you can use Channel.set_endevent() to arrange for an event to be posted when a sound finishes playing. -- Greg