comparison pyntnclick/sound.py @ 565:88cffe418201 pyntnclick

Pyflakes sound
author Neil Muller <neil@dip.sun.ac.za>
date Sat, 11 Feb 2012 15:37:59 +0200
parents 2f7aa3cad77c
children 9c3528c2cbe5
comparison
equal deleted inserted replaced
564:2f7aa3cad77c 565:88cffe418201
32 sounds are disabled so scense don't need to worry 32 sounds are disabled so scense don't need to worry
33 about the details. 33 about the details.
34 34
35 Inpsired by the same idea in Albow (by Greg Ewing)""" 35 Inpsired by the same idea in Albow (by Greg Ewing)"""
36 36
37 def play(self, *args): 37 def play(self, *args):
38 pass 38 pass
39 39
40 def stop(self): 40 def stop(self):
41 pass 41 pass
42 42
43 def get_length(self): 43 def get_length(self):
44 return 0.0 44 return 0.0
45 45
46 def get_num_channel(self): 46 def get_num_channel(self):
47 return 0 47 return 0
48 48
49 def get_volume(self): 49 def get_volume(self):
50 return 0.0 50 return 0.0
51 51
52 def fadeout(self, *args): 52 def fadeout(self, *args):
53 pass 53 pass
54 54
55 55
56 class Sound(object): 56 class Sound(object):
57 """Global sound management and similiar useful things""" 57 """Global sound management and similiar useful things"""
58 58
80 print 'Error: %s' % exc 80 print 'Error: %s' % exc
81 print 'Sound disabled' 81 print 'Sound disabled'
82 82
83 def get_sound(self, *names): 83 def get_sound(self, *names):
84 if not self.sound_enabled: 84 if not self.sound_enabled:
85 return dummy_sound 85 return DummySound()
86 soundfile = os.path.join(names) 86 soundfile = os.path.join(names)
87 sound = None 87 sound = None
88 try: 88 try:
89 path = self._resource_finder("sounds", soundfile) 89 path = self._resource_finder("sounds", soundfile)
90 sound = sound_cache.get(path, None) 90 sound = self.sound_cache.get(path, None)
91 except ResourceNotFound: 91 except ResourceNotFound:
92 print "Sound file not found: %s" % soundfile 92 print "Sound file not found: %s" % soundfile
93 # Cache failed lookup 93 # Cache failed lookup
94 sound = DummySound() 94 sound = DummySound()
95 self.sound_cache[path] = sound 95 self.sound_cache[path] = sound
109 return albow.music.get_music(name, prefix) 109 return albow.music.get_music(name, prefix)
110 110
111 def change_playlist(self, new_playlist): 111 def change_playlist(self, new_playlist):
112 albow.music.change_playlist(new_playlist) 112 albow.music.change_playlist(new_playlist)
113 113
114
114 def start_next_music(): 115 def start_next_music():
115 """Start playing the next item from the current playlist immediately.""" 116 """Start playing the next item from the current playlist immediately."""
116 if albow.music.music_enabled and albow.music.current_playlist: 117 if albow.music.music_enabled and albow.music.current_playlist:
117 next_music = albow.music.current_playlist.next() 118 next_music = albow.music.current_playlist.next()
118 if next_music: 119 if next_music: