comparison gamelib/sound.py @ 534:6df527142e69

PEP-8 sound.py
author Jeremy Thurgood <firxen@gmail.com>
date Sat, 11 Feb 2012 12:02:21 +0200
parents 7b07ffc37ec0
children
comparison
equal deleted inserted replaced
533:42742a62f9c3 534:6df527142e69
10 from pygame.mixer import music 10 from pygame.mixer import music
11 from albow.resource import _resource_path, dummy_sound 11 from albow.resource import _resource_path, dummy_sound
12 import albow.music 12 import albow.music
13 13
14 sound_cache = {} 14 sound_cache = {}
15
15 16
16 def get_sound(*names): 17 def get_sound(*names):
17 if sound_cache is None: 18 if sound_cache is None:
18 return dummy_sound 19 return dummy_sound
19 path = _resource_path("sounds", names) 20 path = _resource_path("sounds", names)
41 print "get_sound: %s" % e 42 print "get_sound: %s" % e
42 print "get_sound: Sound not available, continuing without it" 43 print "get_sound: Sound not available, continuing without it"
43 sound_cache = None 44 sound_cache = None
44 albow.music.music_enabled = False 45 albow.music.music_enabled = False
45 46
47
46 def disable_sound(): 48 def disable_sound():
47 global sound_cache 49 global sound_cache
48 sound_cache = None 50 sound_cache = None
49 albow.music.music_enabled = False 51 albow.music.music_enabled = False
52
50 53
51 def missing_sound(e, name): 54 def missing_sound(e, name):
52 print "albow.resource.get_sound: %s: %s" % (name, e) 55 print "albow.resource.get_sound: %s: %s" % (name, e)
53 56
54 57
61 music.load(next_music) 64 music.load(next_music)
62 music.play() 65 music.play()
63 albow.music.next_change_delay = albow.music.change_delay 66 albow.music.next_change_delay = albow.music.change_delay
64 albow.music.current_music = next_music 67 albow.music.current_music = next_music
65 68
69
66 def get_current_playlist(): 70 def get_current_playlist():
67 if albow.music.music_enabled and albow.music.current_playlist: 71 if albow.music.music_enabled and albow.music.current_playlist:
68 return albow.music.current_playlist 72 return albow.music.current_playlist
69 73
70 # Monkey patch 74 # Monkey patch