[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Screenshots, music and flipping



On Fri, 19 Jan 2001, Pete Shinners wrote:

Pete,

Thanks a lot for the information. As usual you provide fast and accurate
support. Maybe you could debug our game engine too? :-) Thanks once again. 

>> So, has anybody done some mp3-playing with pygame, and what could the
>> pitfalls be? Is it worth a shot?
>
>heh, i've played a couple, but nothing on the scale you're thinking.
>it should be entirely possible, the only thing i see missing from
>pygame's music playback is there's no way to get information like
>current time, etc. if you want to display something like a playtime,
>you'll need to carefully keep track of how long the song has been
>playing by yourself. (stop the time playback when paused, etc).
>it doesn't sound like a big deal so you should be fine.
>you can check to see if the music is finished by either polling the
>music module with pygame.music.get_busy(), or you can have an event
>appear on the event queue when the music has finished,

I really don't need to get too much info about the song, mainly static
info that I can get with ID3 (I've used it heavily in the past to fix
id3-tags for my mp3-collection).

I have a proof-of-concept thing up and running now. I loads playlists and
sets a random background image, plays mp3:s as well as has some basic
interaction with the user.

Howver, smpeg:s mp3 support is quite bad. Far too many of my mp3:s don't
play with it. Sure, they probably don't follow standards etc, but xmms
plays them just fine. So I'm wondering wether this will work out in the
end.

>pygame.music.set_end_event(USEREVENT)
>...
>if event.type == USEREVENT: startnextsong()

This does not work for me. I never get any event of this type. I have to
manually use my "next" funtionality to proceed to the next song. The code
I use looks like this:

def play ():
    global currentSong
    
    # get a random song
    index = whrandom.whrandom ().randint ( 0, len (playlist) - 1 )

    # store the name of the song
    currentSong = playlist[index]

    # load the song
    pygame.mixer.music.load ( currentSong )
        
    # make sure we know when the playing has stopped
    pygame.mixer.music.set_endevent (USEREVENT) 

    # and play it
    pygame.mixer.music.play ()

>sounds like an interesting little project, make sure it can run
>windowed too (not just fullscreen), so we can all try running it
>on our own machines, :]

Sure, it runs windowed too, but I'm not sure wether I'll give it any more
time, as too many songs don't work.

--------------------+--------------------------------------------------------
Jan 'Chakie' Ekholm |     Balrog New Media    http://www.balrog.fi/
   Linux Inside     | I'm the blue screen of death, nobody hears your screams

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org