def get_pos(): """ get_pos() -> time get the music play time """ check_mixer() if _music_pos_time < 0: return -1 ticks = (1000 * _music_pos / (float(_music_channels) * _music_frequency * ((_music_format & 0xff) >> 3))) if not sdl.Mix_PausedMusic(): ticks += sdl.SDL_GetTicks() - _music_pos_time return ticks
def _mixmusic_callback(udata, stream, len): global _music_pos, _music_pos_time if not sdl.Mix_PausedMusic(): _music_pos += len _music_pos_time = sdl.SDL_GetTicks()