[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Panning with Channel.set_volume
On Tue, 18 May 2004, Matthias [utf-8] Köster wrote:
> chan.set_volume(1.0, 0.0)
> chan.play(snd)
> chan.set_volume(1.0, 1.0)
> chan.play(snd)
>
> Here i would think that the first played sound would only play on the left
> speaker and the second on the right speaker. But as said before, i can't
> hear the difference! Maybe it's caused by non stereo sound samples? Perhaps i
> have misunderstood the set_volume method?
Hmmm. Do you actually even hear two sounds? The channel.play method
shouldn't wait for the sound to finish, so I would expect only the latter
chan.play to have any audible effect. You can wait for the sound to
finish using for example (not tested):
from pygame.locals import *
pygame.event.set_allowed(None)
pygame.event.set_allowed(USEREVENT)
chan.set_endevent(USEREVENT)
chan.set_volume(1.0, 0.0)
chan.play(snd)
pygame.event.wait()
chan.set_volume(0.0, 1.0)
chan.play(snd)
pygame.event.wait()
And the way I read the docs, you pass (1.0, 0.0) and (0.0, 1.0) to
set_volume in order to get sound from only one channel.
--
Sami Hangaslammi