Thanks for the response, sorry for the delay. Yeah I have come to the same 
conclusion about doing it like that, I think I might end up doing a 
combination of this.

 
I have discovered however, at least for DirectSound, there is a simple flag 
for the muting past max distance. I just add this as part of the buffer 
flag: lib.DSBCAPS_MUTE3DATMAXDISTANCE

On Monday, October 12, 2015 at 1:59:34 AM UTC-5, [email protected] wrote:
>
> Actually, another approach may be to just manually adjust the volume based 
> on a distance calculation from the players position and the position of the 
> sound using the pyglet convience functions. The only issue with that is you 
> don't get stereo positioning (which is what the OpenAL examples are more 
> about), but can still get an effect to what you describe.
>
> For example:
> self.sound = pyglet.media.load('tone5.wav')
> self.player = pyglet.media.Player()
> self.player.queue(self.sound)
> self.player.eos_action = 'loop'
> self.player.play()
>
> self.player_pos = [32,0]
> self.sound_pos = [64,0]
>
>
> if self.player_pos[0] < self.sound_pos[0]:
>     self.player.volume = float(self.player_pos[0]) / float(self.sound_pos[
> 0])
>
> if self.player.volume <= 0.0:
>     self.player.pause()
>
>
>

-- 
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.

Reply via email to