Created
August 28, 2014 18:54
-
-
Save SpotlightKid/89e7505fd4d262516473 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sound | |
class SoundManager(object): | |
def __init__(self, name = ''): | |
self._playing = dict() | |
def load_effect(self, name): | |
sound.load_effect(name) | |
def play_effect(self, name, volume=0.5, pitch=1.0): | |
sound_id = sound.play_effect(name, volume, pitch) | |
self._playing[sound_id] = 1 | |
return sound_id | |
def stop_effect(self, sound_id): | |
sound.stop_effect(sound_id) | |
del self._playing[sound_id] | |
def set_volume(self, vol): | |
sound.set_volume(vol) | |
def stop_all_effects(self): | |
for sound_id in self._playing: | |
sound.stop_effect(sound_id) | |
self._playing.clear() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment