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

[pygame] Question about sound effect playback



I'm working on a networked action game with rollback netcode, and so I need to play sound effects starting an arbitrary amount of time from the beginning of the file so they sync up with game events.

pygame.mixer.music does this via set_pos()... but apparently there's no corresponding method when playing effects directly via a Channel. Unfortunate, as I need to use Channels!

The best I've come up with is to use Sound.get_raw(), trim the starting bytes off then, create a new Sound.  But this fails several different ways, I'm guessing because I'm arbitrarily slicing the bytes and there's some format details I don't know.


Does anyone have any tips for hacking raw Sound data, or perhaps some better approach?

-Jasper