comparison demos/rio_de_hola/run.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 3a6441d9e01c
children 987307d12235
comparison
equal deleted inserted replaced
492:16ceb3228324 493:e29853880e87
120 super(IslandDemo,self).__init__() 120 super(IslandDemo,self).__init__()
121 pychan.init(self.engine, debug=TDS.readSetting("PychanDebug", type='bool')) 121 pychan.init(self.engine, debug=TDS.readSetting("PychanDebug", type='bool'))
122 self.world = world.World(self.engine) 122 self.world = world.World(self.engine)
123 self.listener = ApplicationListener(self.engine, self.world) 123 self.listener = ApplicationListener(self.engine, self.world)
124 self.world.load(str(TDS.readSetting("MapFile"))) 124 self.world.load(str(TDS.readSetting("MapFile")))
125
126 self.soundmanager = self.engine.getSoundManager()
127 self.soundmanager.init()
128
129 if int(TDS.readSetting("PlaySounds")):
130 # play track as background music
131 emitter = self.soundmanager.createEmitter()
132 id = self.engine.getSoundClipPool().addResourceFromFile('music/rio_de_hola.ogg')
133 emitter.setSoundClip(id)
134 emitter.setLooping(True)
135 emitter.play()
136 125
137 def loadSettings(self): 126 def loadSettings(self):
138 """ 127 """
139 Load the settings from a python file and load them into the engine. 128 Load the settings from a python file and load them into the engine.
140 Called in the ApplicationBase constructor. 129 Called in the ApplicationBase constructor.