Mercurial > fife-parpg
diff engine/python/fife/extensions/soundmanager.py @ 493:e29853880e87
Adapted rio_do_hola to use the new SoundManager.
Fixed a bug in the sound manager that caused a sound to not be looped if it did not have a callback assigned to it.
Looping a stream using timers doesn't loop perfectly. I'll fix this in the future.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 07 May 2010 21:46:25 +0000 |
parents | 16ceb3228324 |
children | e241d7553496 |
line wrap: on
line diff
--- a/engine/python/fife/extensions/soundmanager.py Fri May 07 21:07:27 2010 +0000 +++ b/engine/python/fife/extensions/soundmanager.py Fri May 07 21:46:25 2010 +0000 @@ -212,7 +212,6 @@ @param clip The SoundEmitter to be played """ - if clip.fifeemitter: if clip.callback: if clip.timer: @@ -224,7 +223,7 @@ def real_callback(c, e, g): c() e.stop() - e.setGain(g) + e.setGain(float(g)/255.0) e.play() clip.callback = cbwa(real_callback, clip.callback, clip.fifeemitter, clip.gain) @@ -232,10 +231,21 @@ else: repeat = 1 - clip.timer = fife_timer.delayCall(clip.duration, clip.callback) - #clip.timer.start() + clip.timer = fife_timer.Timer(clip.duration, clip.callback, repeat) + clip.timer.start() + else: + if clip.looping: + def real_callback(e, g): + e.stop() + e.setGain(float(g)/255.0) + e.play() + + clip.callback = cbwa(real_callback, clip.fifeemitter, clip.gain) + clip.timer = fife_timer.Timer(clip.duration, clip.callback, 0) + clip.timer.start() + - clip.fifeemitter.setGain(clip.gain) + clip.fifeemitter.setGain(float(clip.gain)/255.0) clip.fifeemitter.play() else: clip = self.createSoundEmitter(clip.name)