BTW the reason for deprecating legacy listener is that it does not ensure the audio driver is initialized when using it. get_audio_driver() ensures this.
Op zaterdag 6 juni 2015 12:27:51 UTC+2 schreef Rob: > > It is better not to use the legacy listener anymore. It will no longer be > present in 1.3.x. pyglet.media.get_audio_driver().get_listener() should > work for all drivers now. > Rob > > Op zaterdag 6 juni 2015 07:31:21 UTC+2 schreef [email protected]: >> >> Huh, thought I deleted that post.. :/ >> >> >>> What should happen is the sound should cut into the other one before the >>> first one stops, so you get an overlap. This happens when you call play on >>> the sound itself, but not when you queue a sound onto a player and play it >>> over and over. >>> >> >> At the moment there's no way to do that without using multiple players, >> but you could handle this with an internal timer during updates and by >> keeping the Player references Source returns when you play them: >> >> timer = 0 >> running = False >> sound = pyglet.resource.media('walking.wav') >> walking = [] >> def update(time): >> timer += time >> if running == False and timer >= 1.0: >> walking.append(sound.play()) >> timer = 0 >> elif running == True and timer >= 0.3: >> walking.append(sound.play()) >> timer = 0 >> #discard finished sounds >> for a in walking: >> if a.playing == False: >> a.delete() >> walking.remove(a) >> >> >> >>> Sounds to be connected to objects like zombies. Those zombies then move >>> around the map. This changes the sound's location both when the zombie >>> moves and when the player moves. >>> >> >> It wouldn't be to hard to store playing sounds with a zombie class, but >> changing the sounds location around the map is abit more complicated. Is >> this a 2D or 3D game? I must confess, I haven't played with these >> particular features in pyglet yet, but I think you could use the Position >> variable on a Player sound object to set its position in 3D space, and then >> set up a Listener for the players position to "hear" it. You can change the >> Listeners orientation with _set_forward_orientation, and adjust the >> direction of the playing sound with player.cone_orientation. All of these >> take 3 tuple xyz floats for coordinates. >> >> I've poked around abit in the pyget.media source, for the moment you can >> try calling pyglet.media._LegacyListener(), since it seems like the newer >> Listener object may not be fully implemented yet. So for example: >> >> sound = pyglet.resource.media('walking.wav') >> walking = sound.play() >> walking.position = (-5.0, 0.0, 0.0) #xyz, off to the left of listener >> >> listener = pyglet.media._LegacyListener() >> listener.position = (0.0, 0.0, 0.0) >> >> When the zombie is behind the player, I would like it to lower in pitch. >>> >> >> You could try doing this by calculating the relative position and >> orientation between the zombie and player, then adjusting any stored >> playing sounds pitch, IE: player.pitch = (1.0). >> > -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.
