python - How to differentiate endevent of music and channel? -


in pygame can use pygame.mixer.music load , play long audio files (by streaming), or pygame.mixer.sound & pygame.mixer.channel shorter ones (that loaded entirely memory) - understand correctly.

i'd use both of these methods. i'd know, when playback of given channel or music has finished. there methods that: set_endevent() - on both music , channel. when use pygame.locals.userevent type of event, when channel's playback finished receive event code == <channel_id>. when music's playback finished, code 0. cannot tell difference, whether music stopped, or channel id 0.

is there way tell them apart?

-.- misunderstood documentation. there said:

the type argument event id sent queue. can valid event type, choice value between pygame.locals.userevent , pygame.locals.numevents. if no type argument given channel stop sending endevents.

and understood should choose either userevent or numevents. looking way use new event types thought impossible. chose userevent, hoping no other pygame module uses it, , thinking it's better numevents.

but came idea, maybe these types numbers , "between" means literally between. after checked appeared userevent == 24 , numevents == 32. can use number 25 32...

silly me. :)

only 1 thing remain: let's take used 25 type channel.set_endevent(). how channel id now?


edit:

ok, have full image. it's better - think. if understand correctly: pygame.userevent (equal 24) first of many events pygame.numevent (equal 32). of them have attribute code can used whatever want (and channel uses put id). can use pygame.userevent + 0 channels , pygame.userevent + 1 music.

correct me please if i'm wrong.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -