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

Re: [pygame] Playing OGGs in pygame



I should have said two other things:

1. This is happening on a Macintosh (mac osx 10.3.8, pygame 1.7, sdl 1.2.8, latest ogg frameworks)

2. The code generates no errors when loading or playing the ogg file.


On Mar 16, 2005, at 1:00 PM, Keith Nemitz wrote:

Okay, this is probably just a side-effect of switching pythons and upgrading frameworks, but I've got one thing that's killing me. I hope someone can look at this and say 'hey, dude you just need this file or do this...'

Basically, I'm trying to play an ogg file as a sound effect. It was all working a few weeks ago, in fact I shipped an entire python/pygame game that used oggs for it's music and SFX. But now it's not working. Here's a minimal example:



class dummysound:
    def play(self): pass

def load_sound(file):
    if not pygame.mixer: return dummysound()
    #file = os.path.join('data', file)
    try:
        sound = pygame.mixer.Sound(file)
        return sound
    except pygame.error:
        print 'Warning, unable to load,', file
    return dummysound()


def main(): global boom_sound

    pygame.init()
    screen = pygame.display.set_mode((640, 480))

    if pygame.mixer and not pygame.mixer.get_init():
        print 'Warning, no sound'
        pygame.mixer = None


boom_sound = load_sound('flame.ogg') #boom_sound = load_sound('car_door.wav') if pygame.mixer: pygame.mixer.music.load('lonTheme.ogg') pygame.mixer.music.play(-1) . . . . boom_sound.play()

-----------------------------------------

The music 'lonTheme.ogg ' streams and plays just fine, but the 'flame.ogg' doesn't make a peep. However, if I use 'car_door.wav', that works when played.

Any thoughts? I could email the full example program to anyone willing to check it further. (about 300k)



Keith Nemitz
Mousechief Co.
www.mousechief.com