License: MIT-style permissive license - see LICENSE.txt
+shutdown.ogg
+------------
+
+Notes:
+ Generated by: tools/gen_sound.py 200 0.25 ; tools/gen_sound.py 400 0.25 ; tools/gen_sound.py 600 0.25 ; tools/gen_sound.py 800 0.25 ;
+ cat beep800.pcm beep600.pcm beep400.pcm beep200.pcm > shutdown.pcm ;
+ oggenc -o shutdown.ogg -r shutdown.pcm
+ Generated by Stefano Rivera, May 2014
+ License: MIT-style permissive license - see LICENSE.txt
+
+
zoop.ogg
--------
from naja.constants import FPS
from naja.events import SceneChangeEvent, QuitGameEvent, LoadGameEvent
+from naja.sound import sound
class Engine(object):
def quit_game(self):
self._scene.exit()
+ sound.play_sound('shutdown.ogg', foreground=True)
self._scene = None
"""Sound utilities."""
+import time
+
from pygame import mixer
from naja.options import options
sound = self._sounds[track_name] = mixer.Sound(track_name)
return sound
- def play_sound(self, name, volume=DEFAULT_SOUND_VOLUME):
+ def play_sound(self, name, volume=DEFAULT_SOUND_VOLUME, foreground=False):
sound = self.load_sound(name)
if sound is not None:
sound.set_volume(volume)
sound.play()
+ if foreground:
+ time.sleep(sound.get_length())
def play_music(self, name, volume=DEFAULT_MUSIC_VOLUME):
if not options.music: