pygame-community / pygame-ce

🐍🎮 pygame - Community Edition is a FOSS Python library for multimedia applications (like games). Built on top of the excellent SDL library.
https://pyga.me
930 stars 154 forks source link

Docs typo: mixer.Sound #3180

Open celeritydesign opened 1 month ago

celeritydesign commented 1 month ago

ref: https://pyga.me/docs/ref/mixer.html

What should this say? :

"The Sound object represents actual sound sample data. Methods that change the state of the Sound object will the all instances of the Sound playback."

For context, I'm looking to make copies ( copy.copy() )of Sound objects from a cached dictionary, and am getting "cannot pickle Sound" errors. It would be great if the docs could address this.

Cheers!

bilhox commented 1 month ago

For context, I'm looking to make copies ( copy.copy() )of Sound objects from a cached dictionary, and am getting "cannot pickle Sound" errors. It would be great if the docs could address this.

This is not possible right now, but I started an implementation a few weeks ago, I still have some bugs to fix. You can turn yourself to sndarray though.

What should this say? : "The Sound object represents actual sound sample data. Methods that change the state of the Sound object will the all instances of the Sound playback."

Good question.

MrRedstone058 commented 1 month ago

"The Sound object represents actual sound sample data. Methods that change the state of the Sound object will the all instances of the Sound playback."

will the all --> alter, perhaps.

celeritydesign commented 1 month ago

This is not possible right now, but I started an implementation a few weeks ago, I still have some bugs to fix. You can turn yourself to sndarray though.

That sounds great! I'm hoping you are either going to make it possible to copy.deepcopy(mysound) and/or add a Sound.copy() method ?

celeritydesign commented 1 month ago

For the docs, maybe something like:

The Sound object represents actual sound sample data. Methods that change the state of the Sound object will alter all instances of the Sound playback. Note, it is not currently possible to shallow copy or deep copy Sound objects. For multiple instances of the same sound that need to loop and play independently it is recommended to...

It's the recommendation that I am not sure about - at the moment I am just reloading the same sound file multiple times :-)

celeritydesign commented 1 month ago

Related issue: https://github.com/pygame-community/pygame-ce/issues/1328

bilhox commented 1 month ago

I'm moving it to the 2.5.3 milestone so it's not left behind and I don't forget it.